From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikolay Aleksandrov Subject: Re: [PATCH net] bridge: do not add port to router list when receives query with source 0.0.0.0 Date: Fri, 26 Oct 2018 10:27:23 +0300 Message-ID: References: <1540520923-17589-1-git-send-email-liuhangbin@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Jiri Pirko , =?UTF-8?Q?Linus_L=c3=bcssing?= , "David S. Miller" , bridge@lists.linux-foundation.org, Roopa Prabhu To: Hangbin Liu , netdev@vger.kernel.org Return-path: Received: from mail-wm1-f68.google.com ([209.85.128.68]:36121 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbeJZQDS (ORCPT ); Fri, 26 Oct 2018 12:03:18 -0400 Received: by mail-wm1-f68.google.com with SMTP id a8-v6so419147wmf.1 for ; Fri, 26 Oct 2018 00:27:26 -0700 (PDT) In-Reply-To: <1540520923-17589-1-git-send-email-liuhangbin@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 26/10/2018 05:28, Hangbin Liu wrote: > Based on RFC 4541, 2.1.1. IGMP Forwarding Rules > > The switch supporting IGMP snooping must maintain a list of > multicast routers and the ports on which they are attached. This > list can be constructed in any combination of the following ways: > > a) This list should be built by the snooping switch sending > Multicast Router Solicitation messages as described in IGMP > Multicast Router Discovery [MRDISC]. It may also snoop > Multicast Router Advertisement messages sent by and to other > nodes. > > b) The arrival port for IGMP Queries (sent by multicast routers) > where the source address is not 0.0.0.0. > > We should not add the port to router list when receives query with source > 0.0.0.0. > > Reported-by: Ying Xu > Signed-off-by: Hangbin Liu > --- > net/bridge/br_multicast.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c > index 024139b..41cdafb 100644 > --- a/net/bridge/br_multicast.c > +++ b/net/bridge/br_multicast.c > @@ -1422,7 +1422,15 @@ static void br_multicast_query_received(struct net_bridge *br, > return; > > br_multicast_update_query_timer(br, query, max_delay); > - br_multicast_mark_router(br, port); > + > + /* Based on RFC4541, section 2.1.1 IGMP Forwarding Rules, > + * the arrival port for IGMP Queries where the source address > + * is 0.0.0.0 should not be added to router port list. > + */ > + if ((saddr->proto == htons(ETH_P_IP) && saddr->u.ip4) || > + (saddr->proto == htons(ETH_P_IPV6) && > + !ipv6_addr_any(&saddr->u.ip6))) > + br_multicast_mark_router(br, port); > } > > static void br_ip4_multicast_query(struct net_bridge *br, > +CC Roopa & bridge@lists.linux-foundation.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cr2F1hwHZmWBwnGRKpFa6pvacft3AfXnIGQrbOXQTvU=; b=fHSO0yBjRGXVI4U8CZkjkAsHd+G0me47cHVVHqa4KKKpClhGjlmz+i/QxgIGzGpViX zbXBwiu6evblF0xvIaN3Jci6INSKXeLxjokbBFawwZ3IIjuoxerWI18awfnkqkLBdE+F 5LdCXmNsYly7K3ZKuXqRSLORmw2ltOr6mveNk= References: <1540520923-17589-1-git-send-email-liuhangbin@gmail.com> From: Nikolay Aleksandrov Message-ID: Date: Fri, 26 Oct 2018 10:27:23 +0300 MIME-Version: 1.0 In-Reply-To: <1540520923-17589-1-git-send-email-liuhangbin@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Bridge] [PATCH net] bridge: do not add port to router list when receives query with source 0.0.0.0 List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hangbin Liu , netdev@vger.kernel.org Cc: Jiri Pirko , bridge@lists.linux-foundation.org, Roopa Prabhu , "David S. Miller" On 26/10/2018 05:28, Hangbin Liu wrote: > Based on RFC 4541, 2.1.1. IGMP Forwarding Rules > > The switch supporting IGMP snooping must maintain a list of > multicast routers and the ports on which they are attached. This > list can be constructed in any combination of the following ways: > > a) This list should be built by the snooping switch sending > Multicast Router Solicitation messages as described in IGMP > Multicast Router Discovery [MRDISC]. It may also snoop > Multicast Router Advertisement messages sent by and to other > nodes. > > b) The arrival port for IGMP Queries (sent by multicast routers) > where the source address is not 0.0.0.0. > > We should not add the port to router list when receives query with source > 0.0.0.0. > > Reported-by: Ying Xu > Signed-off-by: Hangbin Liu > --- > net/bridge/br_multicast.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c > index 024139b..41cdafb 100644 > --- a/net/bridge/br_multicast.c > +++ b/net/bridge/br_multicast.c > @@ -1422,7 +1422,15 @@ static void br_multicast_query_received(struct net_bridge *br, > return; > > br_multicast_update_query_timer(br, query, max_delay); > - br_multicast_mark_router(br, port); > + > + /* Based on RFC4541, section 2.1.1 IGMP Forwarding Rules, > + * the arrival port for IGMP Queries where the source address > + * is 0.0.0.0 should not be added to router port list. > + */ > + if ((saddr->proto == htons(ETH_P_IP) && saddr->u.ip4) || > + (saddr->proto == htons(ETH_P_IPV6) && > + !ipv6_addr_any(&saddr->u.ip6))) > + br_multicast_mark_router(br, port); > } > > static void br_ip4_multicast_query(struct net_bridge *br, > +CC Roopa & bridge@lists.linux-foundation.org