Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mininet/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import select
from distutils.version import StrictVersion
from re import findall
from shlex import quote
from subprocess import Popen, PIPE
from sys import exit # pylint: disable=redefined-builtin
from time import sleep
Expand Down Expand Up @@ -1410,6 +1411,7 @@ def __init__( self, name, inNamespace=False, command='controller',
ip, port = ip.split( ':' )
port = int( port )
self.ip = ip
assert isinstance( port, int )
self.port = port
self.protocol = protocol
Node.__init__( self, name, inNamespace=inNamespace,
Expand All @@ -1424,8 +1426,8 @@ def checkListening( self ):
raise Exception( "Error running telnet to check for listening "
"controllers; please check that it is "
"installed." )
listening = self.cmd( "echo A | telnet -e A %s %d" %
( self.ip, self.port ) )
listening = self.cmd( "echo A | telnet -e A %s %s" %
( quote( self.ip ), quote( self.port ) ) )
if 'Connected' in listening:
servers = self.cmd( 'netstat -natp' ).split( '\n' )
pstr = ':%d ' % self.port
Expand Down Expand Up @@ -1567,7 +1569,8 @@ def checkListening( self ):

def isListening( self, ip, port ):
"Check if a remote controller is listening at a specific ip and port"
listening = self.cmd( "echo A | telnet -e A %s %d" % ( ip, port ) )
listening = self.cmd( "echo A | telnet -e A %s %s" %
( quote( ip ), quote( port ) ) )
if 'Connected' not in listening:
warn( "Unable to contact the remote controller"
" at %s:%d\n" % ( ip, port ) )
Expand Down