From c5d9e0e03ca46585e9d08612ced5cf481d8b9f41 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Mon, 1 Dec 2014 14:59:01 -0800
Subject: [PATCH] Set default route in one cmd line to avoid dc'ing root NS

Usually you won't want to create a node in the root namespace,
and usually you won't want to use the Mininet API to set your
(real) default route, but if you do then you will probably want
to use a single command line to avoid disconnecting an SSH
session while we wait for the reulst of the 'ip route del default
command.
---
 mininet/node.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mininet/node.py b/mininet/node.py
index 474b7e7d..7fe45913 100644
--- a/mininet/node.py
+++ b/mininet/node.py
@@ -488,8 +488,8 @@ def setDefaultRoute( self, intf=None ):
             params = intf
         else:
             params = 'dev %s' % intf
-        self.cmd( 'ip route del default' )
-        return self.cmd( 'ip route add default', params )
+        # Do this in one line in case we're messing with the root namespace
+        self.cmd( 'ip route del default; ip route add default', params )
 
     # Convenience and configuration methods
 
-- 
GitLab