netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
@ 2025-04-14 10:56 Shengyu Qu
  2025-04-15  6:10 ` Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shengyu Qu @ 2025-04-14 10:56 UTC (permalink / raw)
  To: razor, idosch, davem, edumazet, kuba, pabeni, horms, bridge,
	netdev, linux-kernel
  Cc: Shengyu Qu, Felix Fietkau

If multicast snooping is enabled, multicast packets may not always end up
on the local bridge interface, if the host is not a member of the multicast
group. Similar to how IFF_PROMISC allows all packets to be received
locally, let IFF_ALLMULTI allow all multicast packets to be received.

OpenWrt uses a user space daemon for DHCPv6/RA/NDP handling, and in relay
mode it sets the ALLMULTI flag in order to receive all relevant queries on
the network.

This works for normal network interfaces and non-snooping bridges, but not
snooping bridges (unless multicast routing is enabled).

Reported-by: Felix Fietkau <nbd@nbd.name>
Closes:https://github.com/openwrt/openwrt/issues/15857#issuecomment-2662851243
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
---
Changes since v1:
 - Move to net-next
 - Changed code according to Nikolay's advice

Changes since v2:
 - Fix alignment
 - Remove redundant parenthesis
 - Add more infomation in commit message
---
 net/bridge/br_input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 232133a0fd21..5f6ac9bf1527 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -189,7 +189,8 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
 		if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
 		    br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) {
 			if ((mdst && mdst->host_joined) ||
-			    br_multicast_is_router(brmctx, skb)) {
+			    br_multicast_is_router(brmctx, skb) ||
+			    br->dev->flags & IFF_ALLMULTI) {
 				local_rcv = true;
 				DEV_STATS_INC(br->dev, multicast);
 			}
-- 
2.43.0


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

* Re: [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
  2025-04-14 10:56 [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set Shengyu Qu
@ 2025-04-15  6:10 ` Ido Schimmel
  2025-04-15  9:39 ` Nikolay Aleksandrov
  2025-04-16  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2025-04-15  6:10 UTC (permalink / raw)
  To: Shengyu Qu
  Cc: razor, davem, edumazet, kuba, pabeni, horms, bridge, netdev,
	linux-kernel, Felix Fietkau

On Mon, Apr 14, 2025 at 06:56:01PM +0800, Shengyu Qu wrote:
> If multicast snooping is enabled, multicast packets may not always end up
> on the local bridge interface, if the host is not a member of the multicast
> group. Similar to how IFF_PROMISC allows all packets to be received
> locally, let IFF_ALLMULTI allow all multicast packets to be received.
> 
> OpenWrt uses a user space daemon for DHCPv6/RA/NDP handling, and in relay
> mode it sets the ALLMULTI flag in order to receive all relevant queries on
> the network.
> 
> This works for normal network interfaces and non-snooping bridges, but not
> snooping bridges (unless multicast routing is enabled).
> 
> Reported-by: Felix Fietkau <nbd@nbd.name>
> Closes:https://github.com/openwrt/openwrt/issues/15857#issuecomment-2662851243
> Signed-off-by: Shengyu Qu <wiagn233@outlook.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

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

* Re: [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
  2025-04-14 10:56 [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set Shengyu Qu
  2025-04-15  6:10 ` Ido Schimmel
@ 2025-04-15  9:39 ` Nikolay Aleksandrov
  2025-04-16  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2025-04-15  9:39 UTC (permalink / raw)
  To: Shengyu Qu, idosch, davem, edumazet, kuba, pabeni, horms, bridge,
	netdev, linux-kernel
  Cc: Felix Fietkau

On 4/14/25 13:56, Shengyu Qu wrote:
> If multicast snooping is enabled, multicast packets may not always end up
> on the local bridge interface, if the host is not a member of the multicast
> group. Similar to how IFF_PROMISC allows all packets to be received
> locally, let IFF_ALLMULTI allow all multicast packets to be received.
> 
> OpenWrt uses a user space daemon for DHCPv6/RA/NDP handling, and in relay
> mode it sets the ALLMULTI flag in order to receive all relevant queries on
> the network.
> 
> This works for normal network interfaces and non-snooping bridges, but not
> snooping bridges (unless multicast routing is enabled).
> 
> Reported-by: Felix Fietkau <nbd@nbd.name>
> Closes:https://github.com/openwrt/openwrt/issues/15857#issuecomment-2662851243
> Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
> ---
> Changes since v1:
>  - Move to net-next
>  - Changed code according to Nikolay's advice
> 
> Changes since v2:
>  - Fix alignment
>  - Remove redundant parenthesis
>  - Add more infomation in commit message
> ---
>  net/bridge/br_input.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
> index 232133a0fd21..5f6ac9bf1527 100644
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> @@ -189,7 +189,8 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
>  		if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
>  		    br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) {
>  			if ((mdst && mdst->host_joined) ||
> -			    br_multicast_is_router(brmctx, skb)) {
> +			    br_multicast_is_router(brmctx, skb) ||
> +			    br->dev->flags & IFF_ALLMULTI) {
>  				local_rcv = true;
>  				DEV_STATS_INC(br->dev, multicast);
>  			}

Thanks,
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>

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

* Re: [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
  2025-04-14 10:56 [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set Shengyu Qu
  2025-04-15  6:10 ` Ido Schimmel
  2025-04-15  9:39 ` Nikolay Aleksandrov
@ 2025-04-16  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-16  1:00 UTC (permalink / raw)
  To: Shengyu Qu
  Cc: razor, idosch, davem, edumazet, kuba, pabeni, horms, bridge,
	netdev, linux-kernel, nbd

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 14 Apr 2025 18:56:01 +0800 you wrote:
> If multicast snooping is enabled, multicast packets may not always end up
> on the local bridge interface, if the host is not a member of the multicast
> group. Similar to how IFF_PROMISC allows all packets to be received
> locally, let IFF_ALLMULTI allow all multicast packets to be received.
> 
> OpenWrt uses a user space daemon for DHCPv6/RA/NDP handling, and in relay
> mode it sets the ALLMULTI flag in order to receive all relevant queries on
> the network.
> 
> [...]

Here is the summary with links:
  - [net-next,v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
    https://git.kernel.org/netdev/net-next/c/a496d2f0fd61

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:[~2025-04-16  0:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 10:56 [PATCH net-next v3] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set Shengyu Qu
2025-04-15  6:10 ` Ido Schimmel
2025-04-15  9:39 ` Nikolay Aleksandrov
2025-04-16  1:00 ` 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).