Skip to content

Commit 20a599b

Browse files
T-Xdavem330
authored andcommitted
bridge: multicast: enable snooping on general queries only
Without this check someone could easily create a denial of service by injecting multicast-specific queries to enable the bridge snooping part if no real querier issuing periodic general queries is present on the link which would result in the bridge wrongly shutting down ports for multicast traffic as the bridge did not learn about these listeners. With this patch the snooping code is enabled upon receiving valid, general queries only. Signed-off-by: Linus Lüssing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9ed973c commit 20a599b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/bridge/br_multicast.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,10 @@ static void br_multicast_query_received(struct net_bridge *br,
11271127
struct net_bridge_port *port,
11281128
struct bridge_mcast_querier *querier,
11291129
int saddr,
1130+
bool is_general_query,
11301131
unsigned long max_delay)
11311132
{
1132-
if (saddr)
1133+
if (saddr && is_general_query)
11331134
br_multicast_update_querier_timer(br, querier, max_delay);
11341135
else if (timer_pending(&querier->timer))
11351136
return;
@@ -1190,7 +1191,7 @@ static int br_ip4_multicast_query(struct net_bridge *br,
11901191
}
11911192

11921193
br_multicast_query_received(br, port, &br->ip4_querier, !!iph->saddr,
1193-
max_delay);
1194+
!group, max_delay);
11941195

11951196
if (!group)
11961197
goto out;
@@ -1282,7 +1283,8 @@ static int br_ip6_multicast_query(struct net_bridge *br,
12821283
}
12831284

12841285
br_multicast_query_received(br, port, &br->ip6_querier,
1285-
!ipv6_addr_any(&ip6h->saddr), max_delay);
1286+
!ipv6_addr_any(&ip6h->saddr),
1287+
is_general_query, max_delay);
12861288

12871289
if (!group)
12881290
goto out;

0 commit comments

Comments
 (0)