* [PATCH v2 net] bridge: Add extack warning when enabling STP in netns.
@ 2023-07-12 15:44 Kuniyuki Iwashima
2023-07-12 15:46 ` Nikolay Aleksandrov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2023-07-12 15:44 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Eric W. Biederman, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev,
bridge, Harry Coin, Ido Schimmel
When we create an L2 loop on a bridge in netns, we will see packets storm
even if STP is enabled.
# unshare -n
# ip link add br0 type bridge
# ip link add veth0 type veth peer name veth1
# ip link set veth0 master br0 up
# ip link set veth1 master br0 up
# ip link set br0 type bridge stp_state 1
# ip link set br0 up
# sleep 30
# ip -s link show br0
2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether b6:61:98:1c:1c:b5 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped missed mcast
956553768 12861249 0 0 0 12861249 <-. Keep
TX: bytes packets errors dropped carrier collsns | increasing
1027834 11951 0 0 0 0 <-' rapidly
This is because llc_rcv() drops all packets in non-root netns and BPDU
is dropped.
Let's add extack warning when enabling STP in netns.
# unshare -n
# ip link add br0 type bridge
# ip link set br0 type bridge stp_state 1
Warning: bridge: STP does not work in non-root netns.
Note this commit will be reverted later when we namespacify the whole LLC
infra.
Fixes: e730c15519d0 ("[NET]: Make packet reception network namespace safe")
Suggested-by: Harry Coin <hcoin@quietfountain.com>
Link: https://lore.kernel.org/netdev/0f531295-e289-022d-5add-5ceffa0df9bc@quietfountain.com/
Suggested-by: Ido Schimmel <idosch@idosch.org>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
v2:
- Just add extack instead of returning error (Ido Schimmel)
v1: https://lore.kernel.org/netdev/20230711235415.92166-1-kuniyu@amazon.com/
---
net/bridge/br_stp_if.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 75204d36d7f9..b65962682771 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -201,6 +201,9 @@ int br_stp_set_enabled(struct net_bridge *br, unsigned long val,
{
ASSERT_RTNL();
+ if (!net_eq(dev_net(br->dev), &init_net))
+ NL_SET_ERR_MSG_MOD(extack, "STP does not work in non-root netns");
+
if (br_mrp_enabled(br)) {
NL_SET_ERR_MSG_MOD(extack,
"STP can't be enabled if MRP is already enabled");
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 net] bridge: Add extack warning when enabling STP in netns.
2023-07-12 15:44 [PATCH v2 net] bridge: Add extack warning when enabling STP in netns Kuniyuki Iwashima
@ 2023-07-12 15:46 ` Nikolay Aleksandrov
2023-07-12 16:14 ` Ido Schimmel
2023-07-14 7:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2023-07-12 15:46 UTC (permalink / raw)
To: Kuniyuki Iwashima, Roopa Prabhu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Eric W. Biederman, Kuniyuki Iwashima, netdev, bridge, Harry Coin,
Ido Schimmel
On 12/07/2023 18:44, Kuniyuki Iwashima wrote:
> When we create an L2 loop on a bridge in netns, we will see packets storm
> even if STP is enabled.
>
> # unshare -n
> # ip link add br0 type bridge
> # ip link add veth0 type veth peer name veth1
> # ip link set veth0 master br0 up
> # ip link set veth1 master br0 up
> # ip link set br0 type bridge stp_state 1
> # ip link set br0 up
> # sleep 30
> # ip -s link show br0
> 2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
> link/ether b6:61:98:1c:1c:b5 brd ff:ff:ff:ff:ff:ff
> RX: bytes packets errors dropped missed mcast
> 956553768 12861249 0 0 0 12861249 <-. Keep
> TX: bytes packets errors dropped carrier collsns | increasing
> 1027834 11951 0 0 0 0 <-' rapidly
>
> This is because llc_rcv() drops all packets in non-root netns and BPDU
> is dropped.
>
> Let's add extack warning when enabling STP in netns.
>
> # unshare -n
> # ip link add br0 type bridge
> # ip link set br0 type bridge stp_state 1
> Warning: bridge: STP does not work in non-root netns.
>
> Note this commit will be reverted later when we namespacify the whole LLC
> infra.
>
> Fixes: e730c15519d0 ("[NET]: Make packet reception network namespace safe")
> Suggested-by: Harry Coin <hcoin@quietfountain.com>
> Link: https://lore.kernel.org/netdev/0f531295-e289-022d-5add-5ceffa0df9bc@quietfountain.com/
> Suggested-by: Ido Schimmel <idosch@idosch.org>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> ---
> v2:
> - Just add extack instead of returning error (Ido Schimmel)
>
> v1: https://lore.kernel.org/netdev/20230711235415.92166-1-kuniyu@amazon.com/
> ---
> net/bridge/br_stp_if.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
> index 75204d36d7f9..b65962682771 100644
> --- a/net/bridge/br_stp_if.c
> +++ b/net/bridge/br_stp_if.c
> @@ -201,6 +201,9 @@ int br_stp_set_enabled(struct net_bridge *br, unsigned long val,
> {
> ASSERT_RTNL();
>
> + if (!net_eq(dev_net(br->dev), &init_net))
> + NL_SET_ERR_MSG_MOD(extack, "STP does not work in non-root netns");
> +
> if (br_mrp_enabled(br)) {
> NL_SET_ERR_MSG_MOD(extack,
> "STP can't be enabled if MRP is already enabled");
Thanks,
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 net] bridge: Add extack warning when enabling STP in netns.
2023-07-12 15:44 [PATCH v2 net] bridge: Add extack warning when enabling STP in netns Kuniyuki Iwashima
2023-07-12 15:46 ` Nikolay Aleksandrov
@ 2023-07-12 16:14 ` Ido Schimmel
2023-07-14 7:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2023-07-12 16:14 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Eric W. Biederman, Kuniyuki Iwashima,
netdev, bridge, Harry Coin
On Wed, Jul 12, 2023 at 08:44:49AM -0700, Kuniyuki Iwashima wrote:
> When we create an L2 loop on a bridge in netns, we will see packets storm
> even if STP is enabled.
>
> # unshare -n
> # ip link add br0 type bridge
> # ip link add veth0 type veth peer name veth1
> # ip link set veth0 master br0 up
> # ip link set veth1 master br0 up
> # ip link set br0 type bridge stp_state 1
> # ip link set br0 up
> # sleep 30
> # ip -s link show br0
> 2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
> link/ether b6:61:98:1c:1c:b5 brd ff:ff:ff:ff:ff:ff
> RX: bytes packets errors dropped missed mcast
> 956553768 12861249 0 0 0 12861249 <-. Keep
> TX: bytes packets errors dropped carrier collsns | increasing
> 1027834 11951 0 0 0 0 <-' rapidly
>
> This is because llc_rcv() drops all packets in non-root netns and BPDU
> is dropped.
>
> Let's add extack warning when enabling STP in netns.
>
> # unshare -n
> # ip link add br0 type bridge
> # ip link set br0 type bridge stp_state 1
> Warning: bridge: STP does not work in non-root netns.
>
> Note this commit will be reverted later when we namespacify the whole LLC
> infra.
>
> Fixes: e730c15519d0 ("[NET]: Make packet reception network namespace safe")
> Suggested-by: Harry Coin <hcoin@quietfountain.com>
> Link: https://lore.kernel.org/netdev/0f531295-e289-022d-5add-5ceffa0df9bc@quietfountain.com/
> Suggested-by: Ido Schimmel <idosch@idosch.org>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 net] bridge: Add extack warning when enabling STP in netns.
2023-07-12 15:44 [PATCH v2 net] bridge: Add extack warning when enabling STP in netns Kuniyuki Iwashima
2023-07-12 15:46 ` Nikolay Aleksandrov
2023-07-12 16:14 ` Ido Schimmel
@ 2023-07-14 7:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-14 7:40 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: roopa, razor, davem, edumazet, kuba, pabeni, ebiederm, kuni1840,
netdev, bridge, hcoin, idosch
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 12 Jul 2023 08:44:49 -0700 you wrote:
> When we create an L2 loop on a bridge in netns, we will see packets storm
> even if STP is enabled.
>
> # unshare -n
> # ip link add br0 type bridge
> # ip link add veth0 type veth peer name veth1
> # ip link set veth0 master br0 up
> # ip link set veth1 master br0 up
> # ip link set br0 type bridge stp_state 1
> # ip link set br0 up
> # sleep 30
> # ip -s link show br0
> 2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
> link/ether b6:61:98:1c:1c:b5 brd ff:ff:ff:ff:ff:ff
> RX: bytes packets errors dropped missed mcast
> 956553768 12861249 0 0 0 12861249 <-. Keep
> TX: bytes packets errors dropped carrier collsns | increasing
> 1027834 11951 0 0 0 0 <-' rapidly
>
> [...]
Here is the summary with links:
- [v2,net] bridge: Add extack warning when enabling STP in netns.
https://git.kernel.org/netdev/net/c/56a16035bb6e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-14 7:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 15:44 [PATCH v2 net] bridge: Add extack warning when enabling STP in netns Kuniyuki Iwashima
2023-07-12 15:46 ` Nikolay Aleksandrov
2023-07-12 16:14 ` Ido Schimmel
2023-07-14 7:40 ` patchwork-bot+netdevbpf
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).