From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam03on0102.outbound.protection.outlook.com ([104.47.42.102]:30227 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966795AbeCSQML (ORCPT ); Mon, 19 Mar 2018 12:12:11 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Mahesh Bandewar , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 023/102] ipv6: avoid dad-failures for addresses with NODAD Date: Mon, 19 Mar 2018 16:11:57 +0000 Message-ID: <20180319161117.17833-23-alexander.levin@microsoft.com> References: <20180319161117.17833-1-alexander.levin@microsoft.com> In-Reply-To: <20180319161117.17833-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Mahesh Bandewar [ Upstream commit 66eb9f86e50547ec2a8ff7a75997066a74ef584b ] Every address gets added with TENTATIVE flag even for the addresses with IFA_F_NODAD flag and dad-work is scheduled for them. During this DAD proces= s we realize it's an address with NODAD and complete the process without sending any probe. However the TENTATIVE flags stays on the address for sometime enough to cause misinterpretation when we receive a NS= . While processing NS, if the address has TENTATIVE flag, we mark it DADFAILE= D and endup with an address that was originally configured as NODAD with DADFAILED. We can't avoid scheduling dad_work for addresses with NODAD but we can avoid adding TENTATIVE flag to avoid this racy situation. Signed-off-by: Mahesh Bandewar Acked-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/addrconf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 7a5967bc0f38..acdee14c9b03 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -863,7 +863,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6= _addr *addr, INIT_HLIST_NODE(&ifa->addr_lst); ifa->scope =3D scope; ifa->prefix_len =3D pfxlen; - ifa->flags =3D flags | IFA_F_TENTATIVE; + ifa->flags =3D flags; + /* No need to add the TENTATIVE flag for addresses with NODAD */ + if (!(flags & IFA_F_NODAD)) + ifa->flags |=3D IFA_F_TENTATIVE; ifa->valid_lft =3D valid_lft; ifa->prefered_lft =3D prefered_lft; ifa->cstamp =3D ifa->tstamp =3D jiffies; --=20 2.14.1