mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Force Npcap DLL to be used first for Dynamips and uBridge (instead of the one from Winpcap if installed).
This commit is contained in:
parent
67e346ba92
commit
a2ebbaa322
@ -19,6 +19,7 @@
|
|||||||
Represents a Dynamips hypervisor and starts/stops the associated Dynamips process.
|
Represents a Dynamips hypervisor and starts/stops the associated Dynamips process.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -117,6 +118,12 @@ class Hypervisor(DynamipsHypervisor):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self._command = self._build_command()
|
self._command = self._build_command()
|
||||||
|
env = os.environ.copy()
|
||||||
|
if sys.platform.startswith("win"):
|
||||||
|
# add the Npcap directory to $PATH to force Dynamips to use npcap DLL instead of Winpcap (if installed)
|
||||||
|
system_root = os.path.join(os.path.expandvars("%SystemRoot%"), "System32", "Npcap")
|
||||||
|
if os.path.isdir(system_root):
|
||||||
|
env["PATH"] = system_root + ';' + env["PATH"]
|
||||||
try:
|
try:
|
||||||
log.info("Starting Dynamips: {}".format(self._command))
|
log.info("Starting Dynamips: {}".format(self._command))
|
||||||
self._stdout_file = os.path.join(self.working_dir, "dynamips_i{}_stdout.txt".format(self._id))
|
self._stdout_file = os.path.join(self.working_dir, "dynamips_i{}_stdout.txt".format(self._id))
|
||||||
@ -125,7 +132,8 @@ class Hypervisor(DynamipsHypervisor):
|
|||||||
self._process = yield from asyncio.create_subprocess_exec(*self._command,
|
self._process = yield from asyncio.create_subprocess_exec(*self._command,
|
||||||
stdout=fd,
|
stdout=fd,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
cwd=self._working_dir)
|
cwd=self._working_dir,
|
||||||
|
env=env)
|
||||||
log.info("Dynamips process started PID={}".format(self._process.pid))
|
log.info("Dynamips process started PID={}".format(self._process.pid))
|
||||||
self._started = True
|
self._started = True
|
||||||
except (OSError, subprocess.SubprocessError) as e:
|
except (OSError, subprocess.SubprocessError) as e:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
Represents a uBridge hypervisor and starts/stops the associated uBridge process.
|
Represents a uBridge hypervisor and starts/stops the associated uBridge process.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -140,6 +141,12 @@ class Hypervisor(UBridgeHypervisor):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
yield from self._check_ubridge_version()
|
yield from self._check_ubridge_version()
|
||||||
|
env = os.environ.copy()
|
||||||
|
if sys.platform.startswith("win"):
|
||||||
|
# add the Npcap directory to $PATH to force Dynamips to use npcap DLL instead of Winpcap (if installed)
|
||||||
|
system_root = os.path.join(os.path.expandvars("%SystemRoot%"), "System32", "Npcap")
|
||||||
|
if os.path.isdir(system_root):
|
||||||
|
env["PATH"] = system_root + ';' + env["PATH"]
|
||||||
try:
|
try:
|
||||||
command = self._build_command()
|
command = self._build_command()
|
||||||
log.info("starting ubridge: {}".format(command))
|
log.info("starting ubridge: {}".format(command))
|
||||||
@ -149,7 +156,8 @@ class Hypervisor(UBridgeHypervisor):
|
|||||||
self._process = yield from asyncio.create_subprocess_exec(*command,
|
self._process = yield from asyncio.create_subprocess_exec(*command,
|
||||||
stdout=fd,
|
stdout=fd,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
cwd=self._working_dir)
|
cwd=self._working_dir,
|
||||||
|
env=env)
|
||||||
|
|
||||||
log.info("ubridge started PID={}".format(self._process.pid))
|
log.info("ubridge started PID={}".format(self._process.pid))
|
||||||
except (OSError, subprocess.SubprocessError) as e:
|
except (OSError, subprocess.SubprocessError) as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user