net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
Subsystems (3)
PATCH 1/1 net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set
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.
--- net/bridge/br_input.c | 2 ++ 1 file changed, 2 insertions(+)
net/bridge/br_input.c +2 -0
@@ -155,6 +155,8 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb pkt_type =BR_PKT_MULTICAST ;if (br_multicast_rcv (&brmctx, &pmctx, vlan, skb, vid)) goto drop; +if (br->dev->flags &IFF_ALLMULTI ) + local_rcv = true; } }
Signature · 1 line
2.47.1
Nikolay Aleksandrov
maintainerQuoted 15 lines · 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_PROMISCallows all packets to be received locally, letIFF_ALLMULTIallow all multicast packets to be received.Signed-off-by Felix Fietkau <[email protected]>--- net/bridge/br_input.c | 2 ++ 1 file changed, 2 insertions(+)net/bridge/br_input.c +0
-0
net/bridge/br_input.c int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb · line 162
Quoted 8 lines
net/bridge/br_input.c +2
-0@@ -155,6 +155,8 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb pkt_type =BR_PKT_MULTICAST ;if (br_multicast_rcv (&brmctx, &pmctx, vlan, skb, vid)) goto drop; +if (br->dev->flags &IFF_ALLMULTI ) + local_rcv = true; } }
This doesn't look like a bug fix, IMO it should be for net-next.
Also you might miss a mcast stat increase, see the multicast code below, the only case that this would cover is the missing "else" branch of:
if ((mdst && mdst->host_joined) ||
br_multicast_is_router(brmctx, skb)) {
local_rcv = true;
DEV_STATS_INC(br->dev, multicast);
}So I'd suggest to augment the condition and include this ALLMULTI check there, maybe with a comment to mention that all other cases are covered by the current code so people are not surprised.
By the way what is the motivation for supporting this flag? I mean you can make the bridge mcast router and it will receive all mcast anyway.
Thanks,
Nik
Quoted 36 lines · Nikolay Aleksandrov
Quoted 15 lines · 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_PROMISCallows all packets to be received locally, letIFF_ALLMULTIallow all multicast packets to be received.Signed-off-by Felix Fietkau <[email protected]>--- net/bridge/br_input.c | 2 ++ 1 file changed, 2 insertions(+)net/bridge/br_input.c +0
-0net/bridge/br_input.c int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb · line 162
Quoted 8 lines
net/bridge/br_input.c +2
-0@@ -155,6 +155,8 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb pkt_type =BR_PKT_MULTICAST ;if (br_multicast_rcv (&brmctx, &pmctx, vlan, skb, vid)) goto drop; +if (br->dev->flags &IFF_ALLMULTI ) + local_rcv = true; } }This doesn't look like a bug fix, IMO it should be for net-next.
Also you might miss a mcast stat increase, see the multicast code below, the only case that this would cover is the missing "else" branch of:
if ((mdst && mdst->host_joined) || br_multicast_is_router(brmctx, skb)) { local_rcv = true; DEV_STATS_INC(br->dev, multicast); }
Quoted 3 lines
So I'd suggest to augment the condition and include this ALLMULTI check there, maybe with a comment to mention that all other cases are covered by the current code so people are not surprised.
Will do, thanks.
Quoted 2 lines
By the way what is the motivation for supporting this flag? I mean you can make the bridge mcast router and it will receive all mcast anyway.
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, as you pointed out, multicast routing is enabled).
- Felix
Ping for next version.
Quoted 50 lines · Felix Fietkau
Quoted 37 lines · Nikolay Aleksandrov
Quoted 15 lines · 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_PROMISCallows all packets to be received locally, letIFF_ALLMULTIallow all multicast packets to be received.Signed-off-by Felix Fietkau <[email protected]>---
net/bridge/br_input.c | 2 ++1 file changed, 2 insertions(+)net/bridge/br_input.c +0
-0@@ -155,6 +155,8 @@ int br_handle_frame_finish(struct net *net,Quoted 9 lines
struct sock *sk, struct
sk_buff*skb
pkt_type=BR_PKT_MULTICAST;
if (br_multicast_rcv(&brmctx, &pmctx, vlan, skb, vid)) goto drop;
+ if (br->dev->flags&IFF_ALLMULTI)
+local_rcv= true;
}
}This doesn't look like a bug fix, IMO it should be for net-next.
Also you might miss a mcast stat increase, see the multicast code below, the only case that this would cover is the missing "else" branch of:
if ((mdst &&mdst->host_joined) ||br_multicast_is_router(brmctx, skb)) {local_rcv= true;DEV_STATS_INC(br->dev, multicast); }Quoted 3 lines
So I'd suggest to augment the condition and include this ALLMULTI check there, maybe with a comment to mention that all other cases are covered by the current code so people are not surprised.
Will do, thanks.
Quoted 2 lines
By the way what is the motivation for supporting this flag? I mean you can make the bridge mcast router and it will receive all mcast anyway.
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, as you pointed out, multicast routing is enabled).
- Felix