machine: fix issues with network interface parsing
Don't parse non "ether" types. Don't add interfaces that don't have mac addresses and at least one IP address. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
c0c34ea045
commit
ac73036857
|
@ -424,7 +424,8 @@ class Machine:
|
|||
for interface in decoded:
|
||||
if (
|
||||
interface['operstate'] != "UP" or
|
||||
interface['link_type'] == "loopback"
|
||||
interface['link_type'] != "ether" or
|
||||
'address' not in interface
|
||||
):
|
||||
continue
|
||||
addresses: List[Dict[str, Any]] = [
|
||||
|
@ -436,6 +437,8 @@ class Machine:
|
|||
for addr in interface.get('addr_info', [])
|
||||
if 'family' in addr and 'local' in addr
|
||||
]
|
||||
if not addresses:
|
||||
continue
|
||||
network[interface['ifname']] = {
|
||||
'mac_address': interface['address'],
|
||||
'ip_addresses': addresses
|
||||
|
|
Loading…
Reference in New Issue