From c01bb2436e8d16c173a7c7f5059ed2645d8b30b7 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 25 Aug 2016 17:22:22 +0200 Subject: [PATCH] Return netmask with list of interfaces --- gns3server/utils/interfaces.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gns3server/utils/interfaces.py b/gns3server/utils/interfaces.py index 3f97f4ad..16f29c38 100644 --- a/gns3server/utils/interfaces.py +++ b/gns3server/utils/interfaces.py @@ -170,11 +170,13 @@ def interfaces(): for interface in sorted(psutil.net_if_addrs().keys()): ip_address = "" mac_address = "" + netmask = "" interface_type = "ethernet" for addr in psutil.net_if_addrs()[interface]: # get the first available IPv4 address only if addr.family == socket.AF_INET: ip_address = addr.address + netmask = addr.netmask if addr.family == psutil.AF_LINK: mac_address = addr.address if interface.startswith("tap"): @@ -183,6 +185,7 @@ def interfaces(): results.append({"id": interface, "name": interface, "ip_address": ip_address, + "netmask": netmask, "mac_address": mac_address, "type": interface_type}) else: