From 8e429ee4c120ed5b116b78f13bcee9fc71b4609b Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 3 May 2016 21:07:01 +0200 Subject: [PATCH] Ban port dissalowed by chrome and firefox --- gns3server/modules/docker/docker_vm.py | 4 ++-- gns3server/modules/port_manager.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gns3server/modules/docker/docker_vm.py b/gns3server/modules/docker/docker_vm.py index 701d4b9b..6b97c0ba 100644 --- a/gns3server/modules/docker/docker_vm.py +++ b/gns3server/modules/docker/docker_vm.py @@ -396,8 +396,8 @@ class DockerVM(BaseVM): # We replace the port in the server answer otherwise somelink could be broke server = AsyncioRawCommandServer(command, replaces=[ ( - ':{}'.format(self._console_http_port).encode(), - ':{}'.format(self.console).encode(), + '{}'.format(self._console_http_port).encode(), + '{}'.format(self.console).encode(), ) ]) self._telnet_servers.append((yield from asyncio.start_server(server.run, self._manager.port_manager.console_host, self.console))) diff --git a/gns3server/modules/port_manager.py b/gns3server/modules/port_manager.py index 02fddfe6..46b2b114 100644 --- a/gns3server/modules/port_manager.py +++ b/gns3server/modules/port_manager.py @@ -24,6 +24,10 @@ import logging log = logging.getLogger(__name__) +# This ports are disallowed by Chrome and Firefox to avoid trouble with skip them +BANNED_PORTS = set((1, 7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,139,143,179,389,465,512,513,514,515,526,530,531,532,540,556,563,587,601,636,993,995,2049,3659,4045,6000,6665,6666,6667,6668,6669)) + + class PortManager: """ @@ -144,7 +148,7 @@ class PortManager: last_exception = None for port in range(start_port, end_port + 1): - if port in ignore_ports: + if port in ignore_ports or port in BANNED_PORTS: continue try: