Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751395AbeAPEzg (ORCPT + 1 other); Mon, 15 Jan 2018 23:55:36 -0500 Received: from smtps.newmedia-net.de ([185.84.6.167]:47169 "EHLO webmail.newmedia-net.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751043AbeAPEze (ORCPT ); Mon, 15 Jan 2018 23:55:34 -0500 Subject: Re: [PATCH 4.9 27/75] net: igmp: Use correct source address on IGMPv3 reports From: Sebastian Gottschall To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Kevin Cernekee , Andrew Lunn , "David S. Miller" References: <20180101140056.475827799@linuxfoundation.org> <20180101140100.858496151@linuxfoundation.org> Message-ID: <74dc3b65-bebb-c417-dc18-b88c6c21ad7e@dd-wrt.com> Date: Tue, 16 Jan 2018 05:55:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 3.18 and 4.4 is affected too Am 16.01.2018 um 04:50 schrieb Sebastian Gottschall: > please revert that on 4.9 and 4.14 > it breaks igmp routing. it can be reproduced with any iptv connection > using igmp-proxy. reverting this patch fixes the issue. > > Sebastian > > > > Am 01.01.2018 um 15:32 schrieb Greg Kroah-Hartman: >> 4.9-stable review patch.  If anyone has any objections, please let me >> know. >> >> ------------------ >> >> From: Kevin Cernekee >> >> >> [ Upstream commit a46182b00290839fa3fa159d54fd3237bd8669f0 ] >> >> Closing a multicast socket after the final IPv4 address is deleted >> from an interface can generate a membership report that uses the >> source IP from a different interface.  The following test script, run >> from an isolated netns, reproduces the issue: >> >>      #!/bin/bash >> >>      ip link add dummy0 type dummy >>      ip link add dummy1 type dummy >>      ip link set dummy0 up >>      ip link set dummy1 up >>      ip addr add 10.1.1.1/24 dev dummy0 >>      ip addr add 192.168.99.99/24 dev dummy1 >> >>      tcpdump -U -i dummy0 & >>      socat EXEC:"sleep 2" \ >> UDP4-DATAGRAM:239.101.1.68:8889,ip-add-membership=239.0.1.68:10.1.1.1 & >> >>      sleep 1 >>      ip addr del 10.1.1.1/24 dev dummy0 >>      sleep 5 >>      kill %tcpdump >> >> RFC 3376 specifies that the report must be sent with a valid IP source >> address from the destination subnet, or from address 0.0.0.0. Add an >> extra check to make sure this is the case. >> >> Signed-off-by: Kevin Cernekee >> Reviewed-by: Andrew Lunn >> Signed-off-by: David S. Miller >> Signed-off-by: Greg Kroah-Hartman >> --- >>   net/ipv4/igmp.c |   20 +++++++++++++++++++- >>   1 file changed, 19 insertions(+), 1 deletion(-) >> >> --- a/net/ipv4/igmp.c >> +++ b/net/ipv4/igmp.c >> @@ -89,6 +89,7 @@ >>   #include >>   #include >>   #include >> +#include >>     #include >>   #include >> @@ -321,6 +322,23 @@ igmp_scount(struct ip_mc_list *pmc, int >>       return scount; >>   } >>   +/* source address selection per RFC 3376 section 4.2.13 */ >> +static __be32 igmpv3_get_srcaddr(struct net_device *dev, >> +                 const struct flowi4 *fl4) >> +{ >> +    struct in_device *in_dev = __in_dev_get_rcu(dev); >> + >> +    if (!in_dev) >> +        return htonl(INADDR_ANY); >> + >> +    for_ifa(in_dev) { >> +        if (inet_ifa_match(fl4->saddr, ifa)) >> +            return fl4->saddr; >> +    } endfor_ifa(in_dev); >> + >> +    return htonl(INADDR_ANY); >> +} >> + >>   static struct sk_buff *igmpv3_newpack(struct net_device *dev, >> unsigned int mtu) >>   { >>       struct sk_buff *skb; >> @@ -368,7 +386,7 @@ static struct sk_buff *igmpv3_newpack(st >>       pip->frag_off = htons(IP_DF); >>       pip->ttl      = 1; >>       pip->daddr    = fl4.daddr; >> -    pip->saddr    = fl4.saddr; >> +    pip->saddr    = igmpv3_get_srcaddr(dev, &fl4); >>       pip->protocol = IPPROTO_IGMP; >>       pip->tot_len  = 0;    /* filled in later */ >>       ip_select_ident(net, skb, NULL); >> >> >> > -- Mit freundlichen Grüssen / Regards Sebastian Gottschall / CTO NewMedia-NET GmbH - DD-WRT Firmensitz: Stubenwaldallee 21a, 64625 Bensheim Registergericht: Amtsgericht Darmstadt, HRB 25473 Geschäftsführer: Peter Steinhäuser, Christian Scheele http://www.dd-wrt.com email: s.gottschall@dd-wrt.com Tel.: +496251-582650 / Fax: +496251-5826565