From c94dc1ec07657b4756954c5984d924c924aa1654 Mon Sep 17 00:00:00 2001 From: Brett Lykins Date: Mon, 20 Jul 2015 10:42:34 -0500 Subject: [PATCH 1/2] Update gns3.conf.upstart Fixing start-stop-daemon syntax so that it accepts the aruments --- init/gns3.conf.upstart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/gns3.conf.upstart b/init/gns3.conf.upstart index aadf4c9b..113e8cbd 100644 --- a/init/gns3.conf.upstart +++ b/init/gns3.conf.upstart @@ -6,7 +6,7 @@ stop on shutdown script echo $$ > /var/run/gns3.pid - exec start-stop-daemon --start -c gns3 --exec /usr/local/bin/gns3server --log /var/log/gns3.log + exec start-stop-daemon --start -c gns3 --exec /usr/local/bin/gns3server -- --log /var/log/gns3.log end script pre-start script From 439e0df058485bec9b632ed659f3b16033baa9e0 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 20 Jul 2015 19:27:14 -0600 Subject: [PATCH 2/2] Bind host on 0.0.0.0 when checking for a free UDP port. --- gns3server/modules/dynamips/nodes/router.py | 19 ++++++++++++++----- gns3server/modules/port_manager.py | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index 784e9451..e58d516b 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -1178,11 +1178,20 @@ class Router(BaseVM): if not adapter.port_exists(port_number): raise DynamipsError("Port {port_number} does not exist in adapter {adapter}".format(adapter=adapter, port_number=port_number)) - - yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name, - slot_number=slot_number, - port_number=port_number, - nio=nio)) + try: + yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name, + slot_number=slot_number, + port_number=port_number, + nio=nio)) + except DynamipsError: + # in case of error try to remove and add the nio binding + yield from self._hypervisor.send('vm slot_remove_nio_binding "{name}" {slot_number} {port_number}'.format(name=self._name, + slot_number=slot_number, + port_number=port_number)) + yield from self._hypervisor.send('vm slot_add_nio_binding "{name}" {slot_number} {port_number} {nio}'.format(name=self._name, + slot_number=slot_number, + port_number=port_number, + nio=nio)) log.info('Router "{name}" [{id}]: NIO {nio_name} bound to port {slot_number}/{port_number}'.format(name=self._name, id=self._id, diff --git a/gns3server/modules/port_manager.py b/gns3server/modules/port_manager.py index 76248cd7..71409dc8 100644 --- a/gns3server/modules/port_manager.py +++ b/gns3server/modules/port_manager.py @@ -34,8 +34,9 @@ class PortManager: def __init__(self, host="127.0.0.1"): self._console_host = host - self._udp_host = host + # UDP host must be 0.0.0.0, reason: https://github.com/GNS3/gns3-server/issues/265 + self._udp_host = "0.0.0.0" self._used_tcp_ports = set() self._used_udp_ports = set()