summaryrefslogtreecommitdiffstats
path: root/net/bridge/br_private.h
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 23:04:31 +0200
commita3c02e769efe66dce5e2c716862b60c8d44d191e (patch)
tree1d3027e91f885618aea5c135c7e0cdb4e94bfc62 /net/bridge/br_private.h
parentnet: bridge: mcast: split router port del+notify for mcast router split (diff)
downloadlinux-a3c02e769efe66dce5e2c716862b60c8d44d191e.tar.xz
linux-a3c02e769efe66dce5e2c716862b60c8d44d191e.zip
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 '')
-rw-r--r--net/bridge/br_private.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index f9a381fcff09..03197ab4af76 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -311,6 +311,8 @@ struct net_bridge_port {
struct hlist_node ip4_rlist;
#if IS_ENABLED(CONFIG_IPV6)
struct bridge_mcast_own_query ip6_own_query;
+ struct timer_list ip6_mc_router_timer;
+ struct hlist_node ip6_rlist;
#endif /* IS_ENABLED(CONFIG_IPV6) */
u32 multicast_eht_hosts_limit;
u32 multicast_eht_hosts_cnt;
@@ -457,6 +459,8 @@ struct net_bridge {
struct bridge_mcast_querier ip4_querier;
struct bridge_mcast_stats __percpu *mcast_stats;
#if IS_ENABLED(CONFIG_IPV6)
+ struct hlist_head ip6_mc_router_list;
+ struct timer_list ip6_mc_router_timer;
struct bridge_mcast_other_query ip6_other_query;
struct bridge_mcast_own_query ip6_own_query;
struct bridge_mcast_querier ip6_querier;
@@ -866,11 +870,19 @@ static inline bool br_group_is_l2(const struct br_ip *group)
static inline struct hlist_node *
br_multicast_get_first_rport_node(struct net_bridge *b, struct sk_buff *skb) {
+#if IS_ENABLED(CONFIG_IPV6)
+ if (skb->protocol == htons(ETH_P_IPV6))
+ return rcu_dereference(hlist_first_rcu(&b->ip6_mc_router_list));
+#endif
return rcu_dereference(hlist_first_rcu(&b->ip4_mc_router_list));
}
static inline struct net_bridge_port *
br_multicast_rport_from_node_skb(struct hlist_node *rp, struct sk_buff *skb) {
+#if IS_ENABLED(CONFIG_IPV6)
+ if (skb->protocol == htons(ETH_P_IPV6))
+ return hlist_entry_safe(rp, struct net_bridge_port, ip6_rlist);
+#endif
return hlist_entry_safe(rp, struct net_bridge_port, ip4_rlist);
}
@@ -882,7 +894,7 @@ static inline bool br_ip4_multicast_is_router(struct net_bridge *br)
static inline bool br_ip6_multicast_is_router(struct net_bridge *br)
{
#if IS_ENABLED(CONFIG_IPV6)
- return timer_pending(&br->ip4_mc_router_timer);
+ return timer_pending(&br->ip6_mc_router_timer);
#else
return false;
#endif