Use ifconfig for interface verification.
Previously we were using both ip link and ifconfig - not only is this inconsistent and redundant, but it also broke when newer ip link changed the reported names of certain interfacs to "h1-eth0@36:". Fixes #592
This commit is contained in:
+3
-2
@@ -17,10 +17,11 @@ from mininet.util import quietRun
|
||||
|
||||
def checkIntf( intf ):
|
||||
"Make sure intf exists and is not configured."
|
||||
if ( ' %s:' % intf ) not in quietRun( 'ip link show' ):
|
||||
config = quietRun( 'ifconfig %s 2>/dev/null' % intf, shell=True )
|
||||
if not config:
|
||||
error( 'Error:', intf, 'does not exist!\n' )
|
||||
exit( 1 )
|
||||
ips = re.findall( r'\d+\.\d+\.\d+\.\d+', quietRun( 'ifconfig ' + intf ) )
|
||||
ips = re.findall( r'\d+\.\d+\.\d+\.\d+', config )
|
||||
if ips:
|
||||
error( 'Error:', intf, 'has an IP address,'
|
||||
'and is probably in use!\n' )
|
||||
|
||||
Reference in New Issue
Block a user