netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] Revert "net-loopback: set lo dev initial state to UP"
@ 2021-02-09 17:52 Petr Machata
  2021-02-09 18:29 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Machata @ 2021-02-09 17:52 UTC (permalink / raw)
  To: netdev; +Cc: Petr Machata, Jian Yang, davem, Mahesh Bandewar, Jian Yang

In commit c9dca822c729 ("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: c9dca822c729 ("net-loopback: set lo dev initial state to UP")
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
 drivers/net/loopback.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 24487ec17f8b..a1c77cc00416 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -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:
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] Revert "net-loopback: set lo dev initial state to UP"
  2021-02-09 17:52 [PATCH net-next] Revert "net-loopback: set lo dev initial state to UP" Petr Machata
@ 2021-02-09 18:29 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-02-09 18:29 UTC (permalink / raw)
  To: Petr Machata; +Cc: netdev, Jian Yang, davem, Mahesh Bandewar, Jian Yang

On Tue, 9 Feb 2021 18:52:04 +0100 Petr Machata wrote:
> In commit c9dca822c729 ("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: c9dca822c729 ("net-loopback: set lo dev initial state to UP")
> Signed-off-by: Petr Machata <petrm@nvidia.com>

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-09 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 17:52 [PATCH net-next] Revert "net-loopback: set lo dev initial state to UP" Petr Machata
2021-02-09 18:29 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).