From 2e704f996b6332c2094d809a785126dc5e9740cc Mon Sep 17 00:00:00 2001 From: Andrew Ferguson <adferguson@gmail.com> Date: Thu, 23 Jan 2014 16:39:27 -0500 Subject: [PATCH] print error messages when making interfaces without this, thereis no indication in Mininet that creating an interface has failed. for example, this may happen when the interface name is too long (longer than IFNAMSIZ, which is 16 chars). --- mininet/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mininet/util.py b/mininet/util.py index 1b6440bb..99480002 100644 --- a/mininet/util.py +++ b/mininet/util.py @@ -155,7 +155,12 @@ def makeIntfPair( intf1, intf2 ): quietRun( 'ip link del ' + intf2 ) # Create new pair cmd = 'ip link add name ' + intf1 + ' type veth peer name ' + intf2 - return quietRun( cmd ) + cmdOutput = quietRun( cmd ) + if cmdOutput == '': + return True + else: + error( "Error creating interface pair: %s " % cmdOutput ) + return False def retry( retries, delaySecs, fn, *args, **keywords ): """Try something several times before giving up. -- GitLab