Agent: Fix broken logic in get_local_network_interfaces()

This commit is contained in:
Mike Salvatore 2021-12-17 07:08:48 -05:00
parent 9e127b49ae
commit 19bcaad7f2
1 changed files with 3 additions and 1 deletions

View File

@ -23,11 +23,13 @@ RTF_REJECT = 0x0200
def get_local_network_interfaces() -> List[NetworkInterface]: def get_local_network_interfaces() -> List[NetworkInterface]:
network_interfaces = []
for i in get_host_subnets(): for i in get_host_subnets():
netmask_bits = IPv4Network(f"{i['addr']}/{i['netmask']}", strict=False).prefixlen netmask_bits = IPv4Network(f"{i['addr']}/{i['netmask']}", strict=False).prefixlen
cidr_netmask = f"/{netmask_bits}" cidr_netmask = f"/{netmask_bits}"
network_interfaces.append(NetworkInterface(i["addr"], cidr_netmask))
return [NetworkInterface(i["addr"], cidr_netmask) for i in get_host_subnets()] return network_interfaces
def get_host_subnets(): def get_host_subnets():