summaryrefslogtreecommitdiff
path: root/net/bridge/br_mdb.c
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@c0d3.blue>2021-05-13 15:20:51 +0200
committerDavid S. Miller <davem@davemloft.net>2021-05-13 14:04:31 -0700
commita3c02e769efe66dce5e2c716862b60c8d44d191e (patch)
tree1d3027e91f885618aea5c135c7e0cdb4e94bfc62 /net/bridge/br_mdb.c
parented2d35971a8066aa24ce65dd66c113c0506bb206 (diff)
net: bridge: mcast: split multicast router state for IPv4 and IPv6
A multicast router for IPv4 does not imply that the same host also is a multicast router for IPv6 and vice versa. To reduce multicast traffic when a host is only a multicast router for one of these two protocol families, keep router state for IPv4 and IPv6 separately. Similar to how querier state is kept separately. For backwards compatibility for netlink and switchdev notifications these two will still only notify if a port switched from either no IPv4/IPv6 multicast router to any IPv4/IPv6 multicast router or the other way round. However a full netlink MDB router dump will now also include a multicast router timeout for both IPv4 and IPv6. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_mdb.c')
-rw-r--r--net/bridge/br_mdb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 482edb9aadc7..10c416c7bf47 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -18,7 +18,12 @@
static bool br_rports_have_mc_router(struct net_bridge *br)
{
+#if IS_ENABLED(CONFIG_IPV6)
+ return !hlist_empty(&br->ip4_mc_router_list) ||
+ !hlist_empty(&br->ip6_mc_router_list);
+#else
return !hlist_empty(&br->ip4_mc_router_list);
+#endif
}
static bool
@@ -31,8 +36,13 @@ br_ip4_rports_get_timer(struct net_bridge_port *port, unsigned long *timer)
static bool
br_ip6_rports_get_timer(struct net_bridge_port *port, unsigned long *timer)
{
+#if IS_ENABLED(CONFIG_IPV6)
+ *timer = br_timer_value(&port->ip6_mc_router_timer);
+ return !hlist_unhashed(&port->ip6_rlist);
+#else
*timer = 0;
return false;
+#endif
}
static int br_rports_fill_info(struct sk_buff *skb, struct netlink_callback *cb,