diff --git a/gns3server/utils/interfaces.py b/gns3server/utils/interfaces.py index af792cf2..c1000f55 100644 --- a/gns3server/utils/interfaces.py +++ b/gns3server/utils/interfaces.py @@ -198,12 +198,13 @@ def interfaces(): results = [] if not sys.platform.startswith("win"): - for interface in sorted(psutil.net_if_addrs().keys()): + net_if_addrs = psutil.net_if_addrs() + for interface in sorted(net_if_addrs.keys()): ip_address = "" mac_address = "" netmask = "" interface_type = "ethernet" - for addr in psutil.net_if_addrs()[interface]: + for addr in net_if_addrs[interface]: # get the first available IPv4 address only if addr.family == socket.AF_INET: ip_address = addr.address