summaryrefslogtreecommitdiff
path: root/drivers/net/loopback.c
diff options
context:
space:
mode:
authorJian Yang <jianyang@google.com>2021-02-02 02:34:45 +0300
committerJakub Kicinski <kuba@kernel.org>2021-02-05 05:37:08 +0300
commitc9dca822c72914ff33593b12f9fb229f0c0afd47 (patch)
treed8ced9584683d96f1c0ce1ea4fb6df319c2e4dcc /drivers/net/loopback.c
parente64ffa887541ba1cfc8e2e5c4bd7f279d26bb08f (diff)
downloadlinux-c9dca822c72914ff33593b12f9fb229f0c0afd47.tar.xz
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>
Diffstat (limited to 'drivers/net/loopback.c')
-rw-r--r--drivers/net/loopback.c6
1 files changed, 6 insertions, 0 deletions
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: