diff --git a/gns3server/compute/builtin/nodes/cloud.py b/gns3server/compute/builtin/nodes/cloud.py index ddeb2b77..1f6fa3e4 100644 --- a/gns3server/compute/builtin/nodes/cloud.py +++ b/gns3server/compute/builtin/nodes/cloud.py @@ -54,12 +54,8 @@ class Cloud(BaseNode): host_interfaces = [] network_interfaces = interfaces() for interface in network_interfaces: - interface_type = "ethernet" - if interface["name"].startswith("tap"): - # found no way to reliably detect a TAP interface - interface_type = "tap" host_interfaces.append({"name": interface["name"], - "type": interface_type}) + "type": interface["type"]}) return {"name": self.name, "node_id": self.id, diff --git a/gns3server/utils/interfaces.py b/gns3server/utils/interfaces.py index bb12151d..5b7d1942 100644 --- a/gns3server/utils/interfaces.py +++ b/gns3server/utils/interfaces.py @@ -60,7 +60,8 @@ def _get_windows_interfaces_from_registry(): "name": name, "ip_address": ip_address, "mac_address": "", # TODO: find MAC address in registry - "netcard": netcard}) + "netcard": netcard, + "type": "ethernet"}) winreg.CloseKey(hkeyinterface) winreg.CloseKey(hkeycon) winreg.CloseKey(hkeycard) @@ -101,7 +102,8 @@ def get_windows_interfaces(): "name": adapter.NetConnectionID, "ip_address": ip_address, "mac_address": adapter.MACAddress, - "netcard": adapter.name}) + "netcard": adapter.name, + "type": "ethernet"}) except (AttributeError, pywintypes.com_error): log.warn("Could not use the COM service to retrieve interface info, trying using the registry...") return _get_windows_interfaces_from_registry() @@ -166,16 +168,21 @@ def interfaces(): for interface in sorted(psutil.net_if_addrs().keys()): ip_address = "" mac_address = "" + 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 if addr.family == psutil.AF_LINK: mac_address = addr.address + if interface.startswith("tap"): + # found no way to reliably detect a TAP interface + interface_type = "tap" results.append({"id": interface, "name": interface, "ip_address": ip_address, - "mac_address": mac_address}) + "mac_address": mac_address, + "type": interface_type}) else: try: if not _check_windows_service("npf") and not _check_windows_service("npcap"):