aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <[email protected]>2021-08-16 13:58:00 +0100
committerDavid S. Miller <[email protected]>2021-08-16 13:58:00 +0100
commitab6361382fc1cd57e2d06a1ee29bf7b8e98ca257 (patch)
treeb33988ac3eaeb7ba5532276a7c7f63b875651ad7
parent23a44b77e03f577e93ad1b0ce203bd15e99285f5 (diff)
parent175e66924719090f3f43884a419e7c32dabb800f (diff)
Merge branch 'bridge-mcast-fixes'
Nikolay Aleksandrov says: ==================== net: bridge: mcast: fixes for mcast querier state These three fix querier state dumping. The first patch can be considered a minor behaviour improvement, it avoids dumping querier state when mcast snooping is disabled. The second patch was a report of sizeof(0) used for nested netlink attribute size which should be just 0, and the third patch accounts for IPv6 querier state size when allocating skb for notifications. ==================== Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--net/bridge/br_multicast.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 0e5d6ba03457..e411dd814c58 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -2928,10 +2928,16 @@ __br_multicast_get_querier_port(struct net_bridge *br,
size_t br_multicast_querier_state_size(void)
{
- return nla_total_size(sizeof(0)) + /* nest attribute */
+ return nla_total_size(0) + /* nest attribute */
nla_total_size(sizeof(__be32)) + /* BRIDGE_QUERIER_IP_ADDRESS */
nla_total_size(sizeof(int)) + /* BRIDGE_QUERIER_IP_PORT */
- nla_total_size_64bit(sizeof(u64)); /* BRIDGE_QUERIER_IP_OTHER_TIMER */
+ nla_total_size_64bit(sizeof(u64)) + /* BRIDGE_QUERIER_IP_OTHER_TIMER */
+#if IS_ENABLED(CONFIG_IPV6)
+ nla_total_size(sizeof(struct in6_addr)) + /* BRIDGE_QUERIER_IPV6_ADDRESS */
+ nla_total_size(sizeof(int)) + /* BRIDGE_QUERIER_IPV6_PORT */
+ nla_total_size_64bit(sizeof(u64)) + /* BRIDGE_QUERIER_IPV6_OTHER_TIMER */
+#endif
+ 0;
}
/* protected by rtnl or rcu */
@@ -2943,6 +2949,10 @@ int br_multicast_dump_querier_state(struct sk_buff *skb,
struct net_bridge_port *p;
struct nlattr *nest;
+ if (!br_opt_get(brmctx->br, BROPT_MULTICAST_ENABLED) ||
+ br_multicast_ctx_vlan_global_disabled(brmctx))
+ return 0;
+
nest = nla_nest_start(skb, nest_attr);
if (!nest)
return -EMSGSIZE;