Skip to content

Commit c9dca82

Browse files
sheepx86kuba-moo
authored andcommitted
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 <[email protected]> Signed-off-by: Jian Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e64ffa8 commit c9dca82

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/loopback.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ static __net_init int loopback_net_init(struct net *net)
219219

220220
BUG_ON(dev->ifindex != LOOPBACK_IFINDEX);
221221
net->loopback_dev = dev;
222+
223+
/* bring loopback device UP */
224+
rtnl_lock();
225+
dev_open(dev, NULL);
226+
rtnl_unlock();
227+
222228
return 0;
223229

224230
out_free_netdev:

0 commit comments

Comments
 (0)