mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 06:21:15 +02:00
Merge branch 'master' into 2.0
This commit is contained in:
4 files changed
+22
-5
No files matched your search
@@ -326,7 +326,7 @@ class VMwareVM(BaseNode):
|
||||
yield from self._ubridge_send('bridge add_nio_fusion_vmnet {name} "{interface}"'.format(name=vnet, interface=vmnet_interface))
|
||||
else:
|
||||
yield from self._ubridge_send('bridge add_nio_ethernet {name} "{interface}"'.format(name=vnet,
|
||||
interface=vmnet_interface))
|
||||
interface=vmnet_interface))
|
||||
|
||||
if isinstance(nio, NIOUDP):
|
||||
yield from self._ubridge_send('bridge add_nio_udp {name} {lport} {rhost} {rport}'.format(name=vnet,
|
||||
@@ -375,7 +375,7 @@ class VMwareVM(BaseNode):
|
||||
if not self._ubridge_hypervisor:
|
||||
raise VMwareError("Cannot start the packet capture: uBridge is not running")
|
||||
yield from self._ubridge_send('bridge start_capture {name} "{output_file}"'.format(name=vnet,
|
||||
output_file=output_file))
|
||||
output_file=output_file))
|
||||
|
||||
@asyncio.coroutine
|
||||
def _stop_ubridge_capture(self, adapter_number):
|
||||
|
||||
@@ -252,7 +252,7 @@ class VMwareHandler:
|
||||
vmware_manager = VMware.instance()
|
||||
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
|
||||
nio_type = request.json["type"]
|
||||
if nio_type not in ("nio_udp", "nio_vmnet", "nio_nat"):
|
||||
if nio_type not in ("nio_udp", "nio_vmnet", "nio_nat", "nio_tap"):
|
||||
raise HTTPConflict(text="NIO of type {} is not supported".format(nio_type))
|
||||
nio = vmware_manager.create_nio(request.json)
|
||||
yield from vm.adapter_add_nio_binding(int(request.match_info["adapter_number"]), nio)
|
||||
|
||||
@@ -140,6 +140,7 @@ def is_interface_up(interface):
|
||||
# TODO: Windows & OSX support
|
||||
return True
|
||||
|
||||
|
||||
def _check_windows_service(service_name):
|
||||
|
||||
import pywintypes
|
||||
@@ -156,6 +157,7 @@ def _check_windows_service(service_name):
|
||||
raise aiohttp.web.HTTPInternalServerError(text="Could not check if the {} service is running: {}".format(service_name, e.strerror))
|
||||
return True
|
||||
|
||||
|
||||
def interfaces():
|
||||
"""
|
||||
Gets the network interfaces on this server.
|
||||
@@ -185,13 +187,19 @@ def interfaces():
|
||||
"type": interface_type})
|
||||
else:
|
||||
try:
|
||||
service_installed = True
|
||||
if not _check_windows_service("npf") and not _check_windows_service("npcap"):
|
||||
raise aiohttp.web.HTTPInternalServerError("The NPF or Npcap is not installed or running")
|
||||
results = get_windows_interfaces()
|
||||
service_installed = False
|
||||
else:
|
||||
results = get_windows_interfaces()
|
||||
except ImportError:
|
||||
message = "pywin32 module is not installed, please install it on the server to get the available interface names"
|
||||
raise aiohttp.web.HTTPInternalServerError(text=message)
|
||||
except Exception as e:
|
||||
log.error("uncaught exception {type}".format(type=type(e)), exc_info=1)
|
||||
raise aiohttp.web.HTTPInternalServerError(text="uncaught exception: {}".format(e))
|
||||
|
||||
if service_installed is False:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="The Winpcap or Npcap is not installed or running")
|
||||
|
||||
return results
|
||||
Reference in new issue
Block a user