d9bd8c73a010665f151bead8896010d88a13154e
[openwrt/openwrt.git] /
1 From a496d2f0fd612ab9e10700afe00dc9267bad788b Mon Sep 17 00:00:00 2001
2 From: Shengyu Qu <wiagn233@outlook.com>
3 Date: Mon, 14 Apr 2025 18:56:01 +0800
4 Subject: net: bridge: locally receive all multicast packets if IFF_ALLMULTI is
5 set
6
7 If multicast snooping is enabled, multicast packets may not always end up
8 on the local bridge interface, if the host is not a member of the multicast
9 group. Similar to how IFF_PROMISC allows all packets to be received
10 locally, let IFF_ALLMULTI allow all multicast packets to be received.
11
12 OpenWrt uses a user space daemon for DHCPv6/RA/NDP handling, and in relay
13 mode it sets the ALLMULTI flag in order to receive all relevant queries on
14 the network.
15
16 This works for normal network interfaces and non-snooping bridges, but not
17 snooping bridges (unless multicast routing is enabled).
18
19 Reported-by: Felix Fietkau <nbd@nbd.name>
20 Closes: https://github.com/openwrt/openwrt/issues/15857#issuecomment-2662851243
21 Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
22 Reviewed-by: Ido Schimmel <idosch@nvidia.com>
23 Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
24 Link: https://patch.msgid.link/OSZPR01MB8434308370ACAFA90A22980798B32@OSZPR01MB8434.jpnprd01.prod.outlook.com
25 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
26 ---
27 net/bridge/br_input.c | 3 ++-
28 1 file changed, 2 insertions(+), 1 deletion(-)
29
30 --- a/net/bridge/br_input.c
31 +++ b/net/bridge/br_input.c
32 @@ -184,7 +184,8 @@ int br_handle_frame_finish(struct net *n
33 if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) &&
34 br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) {
35 if ((mdst && mdst->host_joined) ||
36 - br_multicast_is_router(brmctx, skb)) {
37 + br_multicast_is_router(brmctx, skb) ||
38 + br->dev->flags & IFF_ALLMULTI) {
39 local_rcv = true;
40 DEV_STATS_INC(br->dev, multicast);
41 }