Merge pull request #704 from mininet/devel/ipBase

Updating Mininet to start with host IP request in ipBase
This commit is contained in:
lantz
2017-01-03 16:55:37 -08:00
committed by GitHub
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -144,7 +144,8 @@ class Mininet( object ):
self.intf = intf
self.ipBase = ipBase
self.ipBaseNum, self.prefixLen = netParse( self.ipBase )
self.nextIP = 1 # start for address allocation
hostIP = ( 0xffffffff >> self.prefixLen ) & self.ipBaseNum
self.nextIP = hostIP if hostIP > 0 else 1 # start for address allocation
self.inNamespace = inNamespace
self.xterms = xterms
self.cleanup = cleanup
+1 -1
View File
@@ -321,7 +321,7 @@ def ipParse( ip ):
"Parse an IP address and return an unsigned int."
args = [ int( arg ) for arg in ip.split( '.' ) ]
while len(args) < 4:
args.append( 0 )
args.insert( len(args) - 1, 0 )
return ipNum( *args )
def netParse( ipstr ):