From a4f8675c935ab257d179df3558a6aa9a32e56bfd Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 19 Oct 2016 16:55:33 +0200 Subject: [PATCH] Support named remote servers for VPCS Fix #722 --- gns3server/modules/vpcs/vpcs_vm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gns3server/modules/vpcs/vpcs_vm.py b/gns3server/modules/vpcs/vpcs_vm.py index e1b11bea..08efcf10 100644 --- a/gns3server/modules/vpcs/vpcs_vm.py +++ b/gns3server/modules/vpcs/vpcs_vm.py @@ -22,6 +22,7 @@ order to run a VPCS VM. import os import sys +import socket import subprocess import signal import re @@ -432,7 +433,10 @@ class VPCSVM(BaseVM): # UDP tunnel command.extend(["-s", str(nio.lport)]) # source UDP port command.extend(["-c", str(nio.rport)]) # destination UDP port - command.extend(["-t", nio.rhost]) # destination host + try: + command.extend(["-t", socket.gethostbyname(nio.rhost)]) # destination host, we need to resolve the hostname because VPCS doesn't support it + except socket.gaierror as e: + raise VPCSError("Can't resolve hostname {}".format(nio.rhost)) elif isinstance(nio, NIOTAP): # TAP interface