1
1
mirror of https://github.com/eblot/pybootd.git synced 2024-09-11 22:17:44 +03:00

Fixes issue with empty netmasks on host interfaces

Pybootd fails is the host contains interfaces where the
netmask is not set, for example in case on auto assigned
RFC 3927 IPs (169.254.0.0./16).
This commit is contained in:
Alessandro Pilotti 2014-12-02 19:39:00 +02:00
parent f5ff5f3825
commit 5b7e756764

View File

@ -135,8 +135,13 @@ def get_iface_config(address):
if netifaces.AF_INET not in ifinfo:
continue
for inetinfo in netifaces.ifaddresses(iface)[netifaces.AF_INET]:
addr = iptoint(inetinfo['addr'])
mask = iptoint(inetinfo['netmask'])
addr_s = inetinfo.get('addr')
netmask_s = inetinfo.get('netmask')
if addr_s is None or netmask_s is None:
continue
addr = iptoint(addr_s)
mask = iptoint(netmask_s)
ip = addr & mask
ip_client = pool & mask
delta = ip ^ ip_client