netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: avoid dad-failures for addresses with NODAD
@ 2017-05-13  0:03 Mahesh Bandewar
  2017-05-15 11:56 ` David Ahern
  2017-05-15 18:26 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Mahesh Bandewar @ 2017-05-13  0:03 UTC (permalink / raw)
  To: Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, David Miller
  Cc: Eric Dumazet, Mahesh Bandewar, Mahesh Bandewar

From: Mahesh Bandewar <maheshb@google.com>

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 process
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 DADFAILED
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 <maheshb@google.com>
---
 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 b09ac38d8dc4..53f2dc092023 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1022,7 +1022,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
 	INIT_HLIST_NODE(&ifa->addr_lst);
 	ifa->scope = scope;
 	ifa->prefix_len = pfxlen;
-	ifa->flags = flags | IFA_F_TENTATIVE;
+	ifa->flags = flags;
+	/* No need to add the TENTATIVE flag for addresses with NODAD */
+	if (!(flags & IFA_F_NODAD))
+		ifa->flags |= IFA_F_TENTATIVE;
 	ifa->valid_lft = valid_lft;
 	ifa->prefered_lft = prefered_lft;
 	ifa->cstamp = ifa->tstamp = jiffies;
-- 
2.13.0.rc2.291.g57267f2277-goog

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: avoid dad-failures for addresses with NODAD
  2017-05-13  0:03 [PATCH net] ipv6: avoid dad-failures for addresses with NODAD Mahesh Bandewar
@ 2017-05-15 11:56 ` David Ahern
  2017-05-15 18:26 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Ahern @ 2017-05-15 11:56 UTC (permalink / raw)
  To: Mahesh Bandewar, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, netdev, David Miller
  Cc: Eric Dumazet, Mahesh Bandewar

On 5/12/17 6:03 PM, Mahesh Bandewar wrote:
> From: Mahesh Bandewar <maheshb@google.com>
> 
> 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 process
> 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 DADFAILED
> 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 <maheshb@google.com>
> ---
>  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 b09ac38d8dc4..53f2dc092023 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1022,7 +1022,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
>  	INIT_HLIST_NODE(&ifa->addr_lst);
>  	ifa->scope = scope;
>  	ifa->prefix_len = pfxlen;
> -	ifa->flags = flags | IFA_F_TENTATIVE;
> +	ifa->flags = flags;
> +	/* No need to add the TENTATIVE flag for addresses with NODAD */
> +	if (!(flags & IFA_F_NODAD))
> +		ifa->flags |= IFA_F_TENTATIVE;
>  	ifa->valid_lft = valid_lft;
>  	ifa->prefered_lft = prefered_lft;
>  	ifa->cstamp = ifa->tstamp = jiffies;
> 

LGTM.

Acked-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: avoid dad-failures for addresses with NODAD
  2017-05-13  0:03 [PATCH net] ipv6: avoid dad-failures for addresses with NODAD Mahesh Bandewar
  2017-05-15 11:56 ` David Ahern
@ 2017-05-15 18:26 ` David Miller
  2017-05-15 18:32   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2017-05-15 18:26 UTC (permalink / raw)
  To: mahesh; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, edumazet, maheshb

From: Mahesh Bandewar <mahesh@bandewar.net>
Date: Fri, 12 May 2017 17:03:39 -0700

> From: Mahesh Bandewar <maheshb@google.com>
> 
> 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 process
> 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 DADFAILED
> 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 <maheshb@google.com>

This doesn't apply cleanly to the net tree, please respin.

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: avoid dad-failures for addresses with NODAD
  2017-05-15 18:26 ` David Miller
@ 2017-05-15 18:32   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-05-15 18:32 UTC (permalink / raw)
  To: mahesh; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, edumazet, maheshb

From: David Miller <davem@davemloft.net>
Date: Mon, 15 May 2017 14:26:55 -0400 (EDT)

> From: Mahesh Bandewar <mahesh@bandewar.net>
> Date: Fri, 12 May 2017 17:03:39 -0700
> 
>> From: Mahesh Bandewar <maheshb@google.com>
>> 
>> 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 process
>> 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 DADFAILED
>> 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 <maheshb@google.com>
> 
> This doesn't apply cleanly to the net tree, please respin.

Ignore this, I was trying to apply the wrong patch.

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-15 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-13  0:03 [PATCH net] ipv6: avoid dad-failures for addresses with NODAD Mahesh Bandewar
2017-05-15 11:56 ` David Ahern
2017-05-15 18:26 ` David Miller
2017-05-15 18:32   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).