1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix racecondition when listing interface

Fix #1060
This commit is contained in:
Julien Duponchelle 2017-06-07 15:55:50 +02:00
parent eb6068c3d3
commit 40cc5d76b3
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -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