Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4917423ybi; Tue, 30 Jul 2019 10:23:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUP1peyOQYUXPMGv3Xuf6LhigmrxeY1gBJnZmNrAOwebLnXxi92P30gK1t/mYTq/YV3iNM X-Received: by 2002:a65:6104:: with SMTP id z4mr72016467pgu.27.1564507416843; Tue, 30 Jul 2019 10:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564507416; cv=none; d=google.com; s=arc-20160816; b=daQnZseJK9PHu2JeZM7T/fE5R3ZFrOoZ2b+FwCRAoZ1u9vCG0fW93rO2ten+6zJp+I 5ZHkIBIs1suHc1GRldVZI4AB4KB/N1IV2bLTtAF2/zBhhd1UBWzRFZdxpmRyUX0uyeb2 mfSGbfD/exykqQonE2ezbJtOlH17ddCtmGyJHz0FMEU/HochyfSA/A9xCWvDQGtm7qPh N/BvdF/iLhndPRInt4pPKVP/XmpvAn4uEKUpLJAUFI6KxUWQnwzCG4PdfeZnqoDZBz3v 6KxLYMNUioUFwx++T7OO40rJSTDR95db+eWtll8jJUhXD0ZJhboRGyUrN+JVeg9XKDXc LmVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=6RTHpENjgGcT8n7j+cscZh1Hx+zz2xzTQGyqiFTLqBA=; b=rpjUWgjVQdWoSPC8TYmmmb6ggiWLlKNu94vqqTYZ+dJp5RMwBs+057gzw7hxHoqBQS tikES6F8faF/Flb+Z2NwO91ljnCMn8HyeHay11So/YMfO5iWT07LIuguxtG5nT64DN2S 9zM5z4IZxvhW+tZqAsV8kUdmEN1Pect3SNRtldyo4q922OVL35Sn9RVKhKMJoIV1UjDS 5fiKw2aV8Ux/Hfbd89Xle68RlJnt8y+gsMY6vY28CnPuicFnUOARtpdv1aEw8WJ0ms1i zL4lAj3FElsH8uphCTom58lVlncDSXIjVXFto1/x7q5NE208UEvAW4BWsfTkRSDvdp2L TIJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YJkMeQcW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si28308732plb.147.2019.07.30.10.23.21; Tue, 30 Jul 2019 10:23:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YJkMeQcW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731132AbfG3NpP (ORCPT + 99 others); Tue, 30 Jul 2019 09:45:15 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:36277 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfG3NpP (ORCPT ); Tue, 30 Jul 2019 09:45:15 -0400 Received: by mail-io1-f66.google.com with SMTP id o9so24546748iom.3; Tue, 30 Jul 2019 06:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6RTHpENjgGcT8n7j+cscZh1Hx+zz2xzTQGyqiFTLqBA=; b=YJkMeQcWNgcV5b9gw9EbJVWAWxthAnkH+/mH/F/ILz8lIDE8pGtYLGtN4F2haS2hsF y9dQUWDEl6U3dxV3RZ/Qp+Vuu1jGBYJ8vdli9ZFb2Ewx1waN0hUQj539dZLGlS8L+ng6 zRIh0h+ieTLzGrd0U63IZ634sXeIndQbwedCTAAdZ7YXdOc9q4lGSkRJ27tIQxMm33Qr AiZRlMhCLtEE2+UHyOydLWLC4B1Yha9ETZiWXDky9syIL57MwY/LcO5nXMBAa17RYlbh cDrmsZR2kpI4RCedyW9RQiowz3FUnX6RAPFbK0xpRl1kdn+Gzgrng82tzSYAC2Snlat/ DiUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6RTHpENjgGcT8n7j+cscZh1Hx+zz2xzTQGyqiFTLqBA=; b=ITT02ikf1l6aKz4Yvb7gFzzieqtM8E1eVnJdNlEVrvdv3n6W+8bPYPlHzvlGvqKpQ9 bmgC8FQgwuWANmffEybLn7RPnT7/BD90n9xymhJRE1DIeaxdrg5MkXbzawkNUs/TMqcH IKHQS6X3gHTEvGVhX44pLG2xHQ4r0nCz71o8k956E1FKPfqSdu+xhJnp04KmTkThcabe /dfAdlBZJdKQaUlE+vZ1EQ3B1z8AZ47NQPkQZrYEWE9UkLcCblsOc9Lip4FjWNc65hKT G7A82vISX/Ae21LvN6By89TLjfGtjQBhok1+Vw8FK4rBIYJdQ+oB786++Hc8fBY3El7U 0zww== X-Gm-Message-State: APjAAAWqpxwL47Es4j1ObB9LlcQ+J6liKDyqafrnuYMOSb1Dvkxt/og6 L0BV+fpQ4fFMZfxqLeBuvSEPrwouERs= X-Received: by 2002:a02:1c0a:: with SMTP id c10mr123387725jac.69.1564494314225; Tue, 30 Jul 2019 06:45:14 -0700 (PDT) Received: from ?IPv6:2601:282:800:fd80:48fd:47f6:b7d0:19dc? ([2601:282:800:fd80:48fd:47f6:b7d0:19dc]) by smtp.googlemail.com with ESMTPSA id n7sm50370331ioo.79.2019.07.30.06.45.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jul 2019 06:45:13 -0700 (PDT) Subject: Re: [PATCH net v2] net: ipv6: Fix a bug in ndisc_send_ns when netdev only has a global address To: Su Yanjun , davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1564454115-66184-1-git-send-email-suyj.fnst@cn.fujitsu.com> From: David Ahern Message-ID: Date: Tue, 30 Jul 2019 07:45:08 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1564454115-66184-1-git-send-email-suyj.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/29/19 8:35 PM, Su Yanjun wrote: > diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c > index 083cc1c..156c027 100644 > --- a/net/ipv6/ndisc.c > +++ b/net/ipv6/ndisc.c > @@ -603,11 +603,14 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit, > int inc_opt = dev->addr_len; > int optlen = 0; > struct nd_msg *msg; > + u32 banned_flags = IFA_F_TENTATIVE | IFA_F_OPTIMISTIC; > > if (!saddr) { banned_flags should be declared here, under !saddr since that is the scope of its use. > - if (ipv6_get_lladdr(dev, &addr_buf, > - (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC))) > - return; > + if (ipv6_get_lladdr(dev, &addr_buf, banned_flags)) { > + /* try global address */ > + if (ipv6_get_addr(dev, &addr_buf, banned_flags)) > + return; > + } > saddr = &addr_buf; > } > >