netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] net-loopback: set lo dev initial state to UP
@ 2021-02-01 23:34 Jian Yang
  2021-02-05  3:00 ` patchwork-bot+netdevbpf
  2021-02-09 11:54 ` Petr Machata
  0 siblings, 2 replies; 11+ messages in thread
From: Jian Yang @ 2021-02-01 23:34 UTC (permalink / raw)
  To: davem, kuba, netdev; +Cc: Mahesh Bandewar, Jian Yang

From: Jian Yang <jianyang@google.com>

Traditionally loopback devices come up with initial state as DOWN for
any new network-namespace. This would mean that anyone needing this
device would have to bring this UP by issuing something like 'ip link
set lo up'. This can be avoided if the initial state is set as UP.

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: Jian Yang <jianyang@google.com>
---
v3:
  * Addressed Jakub's comment to remove the sysctl knob

v2:
  * Updated sysctl name from `netdev_loopback_state` to `loopback_init_state`
  * Fixed the linking error when CONFIG_SYSCTL is not defined

 drivers/net/loopback.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index a1c77cc00416..24487ec17f8b 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -219,6 +219,12 @@ static __net_init int loopback_net_init(struct net *net)
 
 	BUG_ON(dev->ifindex != LOOPBACK_IFINDEX);
 	net->loopback_dev = dev;
+
+	/* bring loopback device UP */
+	rtnl_lock();
+	dev_open(dev, NULL);
+	rtnl_unlock();
+
 	return 0;
 
 out_free_netdev:
-- 
2.30.0.365.g02bc693789-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-09 20:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-01 23:34 [PATCH net-next v3] net-loopback: set lo dev initial state to UP Jian Yang
2021-02-05  3:00 ` patchwork-bot+netdevbpf
2021-02-09 11:54 ` Petr Machata
2021-02-09 16:23   ` Jakub Kicinski
2021-02-09 17:19     ` Petr Machata
2021-02-09 18:49     ` Mahesh Bandewar (महेश बंडेवार)
2021-02-09 19:04       ` Jakub Kicinski
2021-02-09 19:18         ` Mahesh Bandewar (महेश बंडेवार)
2021-02-09 19:43           ` Jakub Kicinski
2021-02-09 19:06       ` Ido Schimmel
2021-02-09 19:19         ` Mahesh Bandewar (महेश बंडेवार)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).