public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH net v3] net: bridge: mst: Check vlan state for egress decision
@ 2024-07-12  1:31 Elliot Ayrey
  2024-07-12  7:27 ` Nikolay Aleksandrov
  2024-07-15 12:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Elliot Ayrey @ 2024-07-12  1:31 UTC (permalink / raw)
  To: davem
  Cc: Elliot Ayrey, Roopa Prabhu, Nikolay Aleksandrov, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Tobias Waldekranz, bridge, netdev,
	linux-kernel

If a port is blocking in the common instance but forwarding in an MST
instance, traffic egressing the bridge will be dropped because the
state of the common instance is overriding that of the MST instance.

Fix this by skipping the port state check in MST mode to allow
checking the vlan state via br_allowed_egress(). This is similar to
what happens in br_handle_frame_finish() when checking ingress
traffic, which was introduced in the change below.

Fixes: ec7328b59176 ("net: bridge: mst: Multiple Spanning Tree (MST) mode")
Signed-off-by: Elliot Ayrey <elliot.ayrey@alliedtelesis•co.nz>
---

v3:
  - Properly reference port state to fix compile error
v2: https://lore.kernel.org/all/20240711045926.756958-1-elliot.ayrey@alliedtelesis.co.nz/
  - Restructure the MST mode check to make it read better
v1: https://lore.kernel.org/all/20240705030041.1248472-1-elliot.ayrey@alliedtelesis.co.nz/

 net/bridge/br_forward.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index d97064d460dc..e19b583ff2c6 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -25,8 +25,8 @@ static inline int should_deliver(const struct net_bridge_port *p,
 
 	vg = nbp_vlan_group_rcu(p);
 	return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) &&
-		p->state == BR_STATE_FORWARDING && br_allowed_egress(vg, skb) &&
-		nbp_switchdev_allowed_egress(p, skb) &&
+		(br_mst_is_enabled(p->br) || p->state == BR_STATE_FORWARDING) &&
+		br_allowed_egress(vg, skb) && nbp_switchdev_allowed_egress(p, skb) &&
 		!br_skb_isolated(p, skb);
 }
 
-- 
2.45.2


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

* Re: [PATCH net v3] net: bridge: mst: Check vlan state for egress decision
  2024-07-12  1:31 [PATCH net v3] net: bridge: mst: Check vlan state for egress decision Elliot Ayrey
@ 2024-07-12  7:27 ` Nikolay Aleksandrov
  2024-07-15 12:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2024-07-12  7:27 UTC (permalink / raw)
  To: Elliot Ayrey, davem
  Cc: Roopa Prabhu, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Tobias Waldekranz, bridge, netdev, linux-kernel

On 12/07/2024 04:31, Elliot Ayrey wrote:
> If a port is blocking in the common instance but forwarding in an MST
> instance, traffic egressing the bridge will be dropped because the
> state of the common instance is overriding that of the MST instance.
> 
> Fix this by skipping the port state check in MST mode to allow
> checking the vlan state via br_allowed_egress(). This is similar to
> what happens in br_handle_frame_finish() when checking ingress
> traffic, which was introduced in the change below.
> 
> Fixes: ec7328b59176 ("net: bridge: mst: Multiple Spanning Tree (MST) mode")
> Signed-off-by: Elliot Ayrey <elliot.ayrey@alliedtelesis•co.nz>
> ---
> 
> v3:
>   - Properly reference port state to fix compile error
> v2: https://lore.kernel.org/all/20240711045926.756958-1-elliot.ayrey@alliedtelesis.co.nz/
>   - Restructure the MST mode check to make it read better
> v1: https://lore.kernel.org/all/20240705030041.1248472-1-elliot.ayrey@alliedtelesis.co.nz/
> 
>  net/bridge/br_forward.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
> index d97064d460dc..e19b583ff2c6 100644
> --- a/net/bridge/br_forward.c
> +++ b/net/bridge/br_forward.c
> @@ -25,8 +25,8 @@ static inline int should_deliver(const struct net_bridge_port *p,
>  
>  	vg = nbp_vlan_group_rcu(p);
>  	return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) &&
> -		p->state == BR_STATE_FORWARDING && br_allowed_egress(vg, skb) &&
> -		nbp_switchdev_allowed_egress(p, skb) &&
> +		(br_mst_is_enabled(p->br) || p->state == BR_STATE_FORWARDING) &&
> +		br_allowed_egress(vg, skb) && nbp_switchdev_allowed_egress(p, skb) &&
>  		!br_skb_isolated(p, skb);
>  }
>  

Acked-by: Nikolay Aleksandrov <razor@blackwall•org>


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

* Re: [PATCH net v3] net: bridge: mst: Check vlan state for egress decision
  2024-07-12  1:31 [PATCH net v3] net: bridge: mst: Check vlan state for egress decision Elliot Ayrey
  2024-07-12  7:27 ` Nikolay Aleksandrov
@ 2024-07-15 12:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-15 12:50 UTC (permalink / raw)
  To: Elliot Ayrey
  Cc: davem, roopa, razor, edumazet, kuba, pabeni, tobias, bridge,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft•net>:

On Fri, 12 Jul 2024 13:31:33 +1200 you wrote:
> If a port is blocking in the common instance but forwarding in an MST
> instance, traffic egressing the bridge will be dropped because the
> state of the common instance is overriding that of the MST instance.
> 
> Fix this by skipping the port state check in MST mode to allow
> checking the vlan state via br_allowed_egress(). This is similar to
> what happens in br_handle_frame_finish() when checking ingress
> traffic, which was introduced in the change below.
> 
> [...]

Here is the summary with links:
  - [net,v3] net: bridge: mst: Check vlan state for egress decision
    https://git.kernel.org/netdev/net/c/0a1868b93fad

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] 3+ messages in thread

end of thread, other threads:[~2024-07-15 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12  1:31 [PATCH net v3] net: bridge: mst: Check vlan state for egress decision Elliot Ayrey
2024-07-12  7:27 ` Nikolay Aleksandrov
2024-07-15 12:50 ` 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