mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Merge branch 'master' into 3.0
# Conflicts: # .github/workflows/testing.yml # gns3server/compute/builtin/nodes/nat.py # gns3server/compute/qemu/__init__.py # gns3server/controller/link.py # gns3server/utils/asyncio/embed_shell.py # gns3server/utils/asyncio/raw_command_server.py # gns3server/utils/asyncio/telnet_server.py # gns3server/version.py # gns3server/web/web_server.py
This commit is contained in:
commit
afdda427d2
27 files changed
+409
-34
No files matched your search
@@ -36,10 +36,16 @@ class Nat(Cloud):
|
||||
|
||||
def __init__(self, name, node_id, project, manager, ports=None):
|
||||
|
||||
allowed_interfaces = Config.instance().get_section_config("Server").get("allowed_interfaces", None)
|
||||
if allowed_interfaces:
|
||||
allowed_interfaces = allowed_interfaces.split(',')
|
||||
if sys.platform.startswith("linux"):
|
||||
nat_interface = Config.instance().settings.Server.default_nat_interface
|
||||
if not nat_interface:
|
||||
nat_interface = "virbr0"
|
||||
if allowed_interfaces and nat_interface not in allowed_interfaces:
|
||||
raise NodeError("NAT interface {} is not allowed be used on this server. "
|
||||
"Please check the server configuration file.".format(nat_interface))
|
||||
if nat_interface not in [interface["name"] for interface in gns3server.utils.interfaces.interfaces()]:
|
||||
raise NodeError(f"NAT interface {nat_interface} is missing, please install libvirt")
|
||||
interface = nat_interface
|
||||
@@ -47,6 +53,9 @@ class Nat(Cloud):
|
||||
nat_interface = Config.instance().settings.Server.default_nat_interface
|
||||
if not nat_interface:
|
||||
nat_interface = "vmnet8"
|
||||
if allowed_interfaces and nat_interface not in allowed_interfaces:
|
||||
raise NodeError("NAT interface {} is not allowed be used on this server. "
|
||||
"Please check the server configuration file.".format(nat_interface))
|
||||
interfaces = list(
|
||||
filter(
|
||||
lambda x: nat_interface in x.lower(),
|
||||
|
||||
Reference in new issue
Block a user