diff options
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_multicast.c | 37 |
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: | |||
2216 | EXPORT_SYMBOL_GPL(br_multicast_list_adjacent); | 2216 | EXPORT_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 | */ | ||
2227 | bool 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(ð, 0, sizeof(eth)); | ||
2245 | eth.h_proto = htons(proto); | ||
2246 | |||
2247 | ret = br_multicast_querier_exists(br, ð); | ||
2248 | |||
2249 | unlock: | ||
2250 | rcu_read_unlock(); | ||
2251 | return ret; | ||
2252 | } | ||
2253 | EXPORT_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 |