Fix issue in retrieving MAC address
Retrieving the MAC address fails when there are interfaces that don't have a AF_INET address. Change-Id: I1e7f4bd897e8e2a0b79f16326f59f2495b946b80 Closes-Bug: #1787361
This commit is contained in:
parent
bb2e3484d6
commit
b2f738236d
@ -99,7 +99,7 @@ def _parse_dhcp_reply(data, id_req):
|
||||
def _get_mac_address_by_local_ip(ip_addr):
|
||||
for iface in netifaces.interfaces():
|
||||
addrs = netifaces.ifaddresses(iface)
|
||||
for addr in addrs[netifaces.AF_INET]:
|
||||
for addr in addrs.get(netifaces.AF_INET, []):
|
||||
if addr['addr'] == ip_addr:
|
||||
return addrs[netifaces.AF_LINK][0]['addr']
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user