Skip to content

Commit

Permalink
net-loopback: set lo dev initial state to UP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jian Yang authored and Jakub Kicinski committed Feb 5, 2021
1 parent e64ffa8 commit c9dca82
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c9dca82

Please sign in to comment.