Skip to content
Snippets Groups Projects
Commit b3055067 authored by Cody Burkard's avatar Cody Burkard
Browse files

fixed netParse bug that caused mininet crash when no ip prefix was specified

parent 87b60214
No related branches found
No related tags found
No related merge requests found
...@@ -281,6 +281,8 @@ def ipAdd( i, prefixLen=8, ipBaseNum=0x0a000000 ): ...@@ -281,6 +281,8 @@ def ipAdd( i, prefixLen=8, ipBaseNum=0x0a000000 ):
def ipParse( ip ): def ipParse( ip ):
"Parse an IP address and return an unsigned int." "Parse an IP address and return an unsigned int."
args = [ int( arg ) for arg in ip.split( '.' ) ] args = [ int( arg ) for arg in ip.split( '.' ) ]
while ( len(args) < 4 ):
args.append( 0 )
return ipNum( *args ) return ipNum( *args )
def netParse( ipstr ): def netParse( ipstr ):
...@@ -290,6 +292,10 @@ def netParse( ipstr ): ...@@ -290,6 +292,10 @@ def netParse( ipstr ):
if '/' in ipstr: if '/' in ipstr:
ip, pf = ipstr.split( '/' ) ip, pf = ipstr.split( '/' )
prefixLen = int( pf ) prefixLen = int( pf )
#if no prefix is specified, set the prefix to 24
else:
ip = ipstr
prefixLen = 24
return ipParse( ip ), prefixLen return ipParse( ip ), prefixLen
def checkInt( s ): def checkInt( s ):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment