Commit ab636138 authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 23a44b77 175e6692
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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;