[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF2d9jhTcVgLHs_iqw+RRS=WhMtRF0ra5SygGMymuYQUW6HP0A@mail.gmail.com>
Date: Thu, 29 Jun 2017 16:57:39 -0700
From: Mahesh Bandewar (महेश बंडेवार)
<maheshb@...gle.com>
To: Eric Dumazet <edumazet@...gle.com>, ebiederm@...ssion.com,
adobriyan@...il.com, David Miller <davem@...emloft.net>,
xiyou.wangcong@...il.com
Cc: linux-netdev <netdev@...r.kernel.org>
Subject: RFC: bring UP 'lo' by default after creating new netns
Creation of new network namespace is almost always followed up by
bringing up the loopback device.
ip netns add foo
ip -netns foo link set lo up
I'm not sure if there are any consequences of bringing the device UP
at the creation of network-namespace.
thanks,
--mahesh..
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 2178db8e47cd..ac0e86c9a17f 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -428,6 +428,11 @@ struct net *copy_net_ns(unsigned long flags,
net_drop_ns(net);
return ERR_PTR(rv);
}
+ /* Set the loopback device UP */
+ rtnl_lock();
+ dev_open(net->loopback_dev);
+ rtnl_unlock();
+
return net;
}
Powered by blists - more mailing lists