aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@web.de>2014-07-06 23:41:17 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-08 19:12:53 -0400
commitc34963e21685659eb513e1c4d847f81d8a8f13f3 (patch)
treed4247dfb6ac918beb7b515cac71c6f334635a486 /net/bridge
parentf941a6d9a9e0612eb807af822b0d1ac004da8175 (diff)
bridge: export knowledge about the presence of IGMP/MLD queriers
With this patch other modules are able to ask the bridge whether an IGMP or MLD querier exists on the according, bridged link layer. Multicast snooping can only be performed if a valid, selected querier exists on a link. Just like the bridge only enables its multicast snooping if a querier exists, e.g. batman-adv too can only activate its multicast snooping in bridged scenarios if a querier is present. For instance this export avoids having to reimplement IGMP/MLD querier message snooping and parsing in e.g. batman-adv, when multicast optimizations for bridged scenarios are added in the future. Signed-off-by: Linus Lüssing <linus.luessing@web.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_multicast.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index abfa0b65a111..b4845f4b2bb4 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -2216,6 +2216,43 @@ unlock:
2216EXPORT_SYMBOL_GPL(br_multicast_list_adjacent); 2216EXPORT_SYMBOL_GPL(br_multicast_list_adjacent);
2217 2217
2218/** 2218/**
2219 * br_multicast_has_querier_anywhere - Checks for a querier on a bridge
2220 * @dev: The bridge port providing the bridge on which to check for a querier
2221 * @proto: The protocol family to check for: IGMP -> ETH_P_IP, MLD -> ETH_P_IPV6
2222 *
2223 * Checks whether the given interface has a bridge on top and if so returns
2224 * true if a valid querier exists anywhere on the bridged link layer.
2225 * Otherwise returns false.
2226 */
2227bool br_multicast_has_querier_anywhere(struct net_device *dev, int proto)
2228{
2229 struct net_bridge *br;
2230 struct net_bridge_port *port;
2231 struct ethhdr eth;
2232 bool ret = false;
2233
2234 rcu_read_lock();
2235 if (!br_port_exists(dev))
2236 goto unlock;
2237
2238 port = br_port_get_rcu(dev);
2239 if (!port || !port->br)
2240 goto unlock;
2241
2242 br = port->br;
2243
2244 memset(&eth, 0, sizeof(eth));
2245 eth.h_proto = htons(proto);
2246
2247 ret = br_multicast_querier_exists(br, &eth);
2248
2249unlock:
2250 rcu_read_unlock();
2251 return ret;
2252}
2253EXPORT_SYMBOL_GPL(br_multicast_has_querier_anywhere);
2254
2255/**
2219 * br_multicast_has_querier_adjacent - Checks for a querier behind a bridge port 2256 * br_multicast_has_querier_adjacent - Checks for a querier behind a bridge port
2220 * @dev: The bridge port adjacent to which to check for a querier 2257 * @dev: The bridge port adjacent to which to check for a querier
2221 * @proto: The protocol family to check for: IGMP -> ETH_P_IP, MLD -> ETH_P_IPV6 2258 * @proto: The protocol family to check for: IGMP -> ETH_P_IP, MLD -> ETH_P_IPV6