From 12758046e18030f43f780e9b0220190de2283cd8 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Tue, 25 Jun 2013 12:51:08 -0700 Subject: [PATCH] Fix setDefaultRoute to work with passed parameters. --- mininet/node.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mininet/node.py b/mininet/node.py index c4efd3a..ca5d8b7 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -371,7 +371,7 @@ class Node( object ): """ if not intf: return self.defaultIntf() - elif type( intf) is str: + elif type( intf ) is str: return self.nameToIntf[ intf ] else: return intf @@ -420,16 +420,12 @@ class Node( object ): """Set the default route to go through intf. intf: Intf or {dev via ...}""" # Note setParam won't call us if intf is none - # See if interface is an actual interface - intf = self.intf( intf ) - if intf in self.ports: - params = 'dev %s' % intf - elif type( intf ) is str: + if type( intf ) is str and ' ' in intf: params = intf else: - raise ValueError( 'intf or param string required' ) + params = 'dev %s' % intf self.cmd( 'ip route del default' ) - return self.cmd( 'ip route add default dev %s' % intf ) + return self.cmd( 'ip route add default', params ) # Convenience and configuration methods