DORMANTno replies

[PATCH 2/2] loopback: bringup 'lo' by default at initialization

From: Mahesh Bandewar <hidden>
Date: 2017-07-04 19:16:26
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Mahesh Bandewar <redacted>

loopback devices are always brought up right after its initialization
including the case of network namespace creation. e.g.

    ip netns add foo
    ip -netns foo link set lo up

This patch will eliminate the need to do that separately and would bring
it up as part of the loopback initialization.

Signed-off-by: Mahesh Bandewar <redacted>
---
 drivers/net/loopback.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 30612497643c..3216977935d1 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -217,6 +217,12 @@ static __net_init int loopback_net_init(struct net *net)
 
 	BUG_ON(dev->ifindex != LOOPBACK_IFINDEX);
 	net->loopback_dev = dev;
+
+	/* Set the loopback device UP */
+	rtnl_lock();
+	dev_open(net->loopback_dev);
+	rtnl_unlock();
+
 	return 0;
 
 out_free_netdev:
-- 
2.13.2.725.g09c95d1e9-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help