Skip to content

Commit

Permalink
Revert "net-loopback: set lo dev initial state to UP"
Browse files Browse the repository at this point in the history
In commit c9dca82 ("net-loopback: set lo dev initial state to UP"),
linux started automatically bringing up the loopback device of a newly
created namespace. However, an existing user script might reasonably have
the following stanza when creating a new namespace -- and in fact at least
tools/testing/selftests/net/fib_nexthops.sh in Linux's very own testsuite
does:

 # set -e
 # ip netns add foo
 # ip -netns foo addr add 127.0.0.1/8 dev lo
 # ip -netns foo link set lo up
 # set +e

This will now fail, because the kernel reasonably rejects "ip addr add" of
a duplicate address. The described change of behavior therefore constitutes
a breakage. Revert it.

Fixes: c9dca82 ("net-loopback: set lo dev initial state to UP")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Petr Machata authored and David S. Miller committed Feb 11, 2021
1 parent 4217a64 commit 1edb5cb
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,6 @@ 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 1edb5cb

Please sign in to comment.