diff mbox series

[net-next,v2] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set

Message ID TYCPR01MB84378490F19C7BE975037B1698B12@TYCPR01MB8437.jpnprd01.prod.outlook.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2025-04-12--15-00 (tests: 900)

Commit Message

Shengyu Qu April 12, 2025, 1:16 p.m. UTC
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.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
---
Since Felix didn't send v2 for this patch, I decided to do it by myself.

Changes since v1:
 - Move to net-next
 - Changed code according to Nikolay's advice
---
 net/bridge/br_input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ido Schimmel April 14, 2025, 8:42 a.m. UTC | #1
On Sat, Apr 12, 2025 at 09:16:13PM +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.

Would be good to explain in the commit message why this is needed when
you can instead configure the bridge as a router port. Felix provided
useful information on v1:

https://lore.kernel.org/netdev/7932cd23-571e-4646-b5dd-467ec8106695@nbd.name/

> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
> ---
> Since Felix didn't send v2 for this patch, I decided to do it by myself.

Felix provided his SoB on v2? If not, "Reported-by" might be more
appropriate.

> 
> Changes since v1:
>  - Move to net-next
>  - Changed code according to Nikolay's advice
> ---
>  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..aefcc3614373 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)) {

The alignment here is off. Also, you can drop the parenthesis.

>  				local_rcv = true;
>  				DEV_STATS_INC(br->dev, multicast);
>  			}
> -- 
> 2.43.0
>
Shengyu Qu April 14, 2025, 10:42 a.m. UTC | #2
在 2025/4/14 16:42, Ido Schimmel 写道:
> On Sat, Apr 12, 2025 at 09:16:13PM +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.
> 
> Would be good to explain in the commit message why this is needed when
> you can instead configure the bridge as a router port. Felix provided
> useful information on v1:
> 
> https://lore.kernel.org/netdev/7932cd23-571e-4646-b5dd-467ec8106695@nbd.name/
Hi,

Thanks for reply. I'll add that in next version.

> 
>>
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
>> ---
>> Since Felix didn't send v2 for this patch, I decided to do it by myself.
> 
> Felix provided his SoB on v2? If not, "Reported-by" might be more
> appropriate.
Will change.
> 
>>
>> Changes since v1:
>>   - Move to net-next
>>   - Changed code according to Nikolay's advice
>> ---
>>   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..aefcc3614373 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)) {
> 
> The alignment here is off. Also, you can drop the parenthesis.
Will fix.

> 
>>   				local_rcv = true;
>>   				DEV_STATS_INC(br->dev, multicast);
>>   			}
>> -- 
>> 2.43.0
>>
diff mbox series

Patch

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 232133a0fd21..aefcc3614373 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);
 			}