]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.136/bridge-do-not-add-port-to-router-list-when-receives-query-with-source-0.0.0.0.patch
Linux 4.9.136
[thirdparty/kernel/stable-queue.git] / releases / 4.9.136 / bridge-do-not-add-port-to-router-list-when-receives-query-with-source-0.0.0.0.patch
1 From 5a2de63fd1a59c30c02526d427bc014b98adf508 Mon Sep 17 00:00:00 2001
2 From: Hangbin Liu <liuhangbin@gmail.com>
3 Date: Fri, 26 Oct 2018 10:28:43 +0800
4 Subject: bridge: do not add port to router list when receives query with source 0.0.0.0
5
6 From: Hangbin Liu <liuhangbin@gmail.com>
7
8 commit 5a2de63fd1a59c30c02526d427bc014b98adf508 upstream.
9
10 Based on RFC 4541, 2.1.1. IGMP Forwarding Rules
11
12 The switch supporting IGMP snooping must maintain a list of
13 multicast routers and the ports on which they are attached. This
14 list can be constructed in any combination of the following ways:
15
16 a) This list should be built by the snooping switch sending
17 Multicast Router Solicitation messages as described in IGMP
18 Multicast Router Discovery [MRDISC]. It may also snoop
19 Multicast Router Advertisement messages sent by and to other
20 nodes.
21
22 b) The arrival port for IGMP Queries (sent by multicast routers)
23 where the source address is not 0.0.0.0.
24
25 We should not add the port to router list when receives query with source
26 0.0.0.0.
27
28 Reported-by: Ying Xu <yinxu@redhat.com>
29 Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
30 Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
31 Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
32 Signed-off-by: David S. Miller <davem@davemloft.net>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34
35 ---
36 net/bridge/br_multicast.c | 10 +++++++++-
37 1 file changed, 9 insertions(+), 1 deletion(-)
38
39 --- a/net/bridge/br_multicast.c
40 +++ b/net/bridge/br_multicast.c
41 @@ -1287,7 +1287,15 @@ static void br_multicast_query_received(
42 return;
43
44 br_multicast_update_query_timer(br, query, max_delay);
45 - br_multicast_mark_router(br, port);
46 +
47 + /* Based on RFC4541, section 2.1.1 IGMP Forwarding Rules,
48 + * the arrival port for IGMP Queries where the source address
49 + * is 0.0.0.0 should not be added to router port list.
50 + */
51 + if ((saddr->proto == htons(ETH_P_IP) && saddr->u.ip4) ||
52 + (saddr->proto == htons(ETH_P_IPV6) &&
53 + !ipv6_addr_any(&saddr->u.ip6)))
54 + br_multicast_mark_router(br, port);
55 }
56
57 static int br_ip4_multicast_query(struct net_bridge *br,