From 9a22e2b73715209ea202abb7323bf1bdb976a11f Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Mon, 25 Jan 2016 14:27:34 -0800 Subject: [PATCH] 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 --- examples/hwintf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/hwintf.py b/examples/hwintf.py index b376538..bbcff34 100755 --- a/examples/hwintf.py +++ b/examples/hwintf.py @@ -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' )