Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net-loopback: set lo dev initial state to UP

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>
Link: https://lore.kernel.org/r/20210201233445.2044327-1-jianyang.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jian Yang and committed by
Jakub Kicinski
c9dca822 e64ffa88

+6
+6
drivers/net/loopback.c
··· 219 219 220 220 BUG_ON(dev->ifindex != LOOPBACK_IFINDEX); 221 221 net->loopback_dev = dev; 222 + 223 + /* bring loopback device UP */ 224 + rtnl_lock(); 225 + dev_open(dev, NULL); 226 + rtnl_unlock(); 227 + 222 228 return 0; 223 229 224 230 out_free_netdev: