diff mbox

ipv6: Add IFA_F_DADFAILED flag

Message ID 4AA1C0FF.4030109@hp.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Brian Haley Sept. 5, 2009, 1:38 a.m. UTC
[Note: if this is accepted I'll send out a patch for iproute,
 if you'd prefer to not use the last ifa_flag I'll send a
 much larger patch that does this differently :) ]


Add IFA_F_DADFAILED flag to denote an IPv6 address that has
failed Duplicate Address Detection, that way tools like
/sbin/ip can be more informative.

3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 2001:db8::1/64 scope global tentative dadfailed 
       valid_lft forever preferred_lft forever

Signed-off-by: Brian Haley <brian.haley@hp.com>
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jens Rosenboom Sept. 8, 2009, 1:57 p.m. UTC | #1
On Fri, 2009-09-04 at 21:38 -0400, Brian Haley wrote:
> [Note: if this is accepted I'll send out a patch for iproute,
>  if you'd prefer to not use the last ifa_flag I'll send a
>  much larger patch that does this differently :) ]
> 
> 
> Add IFA_F_DADFAILED flag to denote an IPv6 address that has
> failed Duplicate Address Detection, that way tools like
> /sbin/ip can be more informative.
> 
> 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
>     inet6 2001:db8::1/64 scope global tentative dadfailed 
>        valid_lft forever preferred_lft forever
> 
> Signed-off-by: Brian Haley <brian.haley@hp.com>
> ---
> 
> diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
> index a60c821..fd97404 100644
> --- a/include/linux/if_addr.h
> +++ b/include/linux/if_addr.h
> @@ -41,6 +41,7 @@ enum
>  
>  #define	IFA_F_NODAD		0x02
>  #define IFA_F_OPTIMISTIC	0x04
> +#define IFA_F_DADFAILED		0x08
>  #define	IFA_F_HOMEADDRESS	0x10
>  #define IFA_F_DEPRECATED	0x20
>  #define IFA_F_TENTATIVE		0x40
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 43b3c9f..6532966 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1376,7 +1376,7 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp)
>  	if (ifp->flags&IFA_F_PERMANENT) {
>  		spin_lock_bh(&ifp->lock);
>  		addrconf_del_timer(ifp);
> -		ifp->flags |= IFA_F_TENTATIVE;
> +		ifp->flags |= IFA_F_DADFAILED;

I think you still have to set IFA_F_TENTATIVE here, too, otherwise
ipv6_dev_get_saddr() will use this address. 		

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brian Haley Sept. 8, 2009, 3:18 p.m. UTC | #2
Jens Rosenboom wrote:
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -1376,7 +1376,7 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp)
>>  	if (ifp->flags&IFA_F_PERMANENT) {
>>  		spin_lock_bh(&ifp->lock);
>>  		addrconf_del_timer(ifp);
>> -		ifp->flags |= IFA_F_TENTATIVE;
>> +		ifp->flags |= IFA_F_DADFAILED;
> 
> I think you still have to set IFA_F_TENTATIVE here, too, otherwise
> ipv6_dev_get_saddr() will use this address. 		

The tentative bit is still set from when this address was added back
in ipv6_add_addr() from what I can tell, re-setting it here is actually
unnecessary.  At least /sbin/ip was still showing it set during my
testing.

-Brian

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jens Rosenboom Sept. 8, 2009, 3:43 p.m. UTC | #3
On Tue, 2009-09-08 at 11:18 -0400, Brian Haley wrote:
> Jens Rosenboom wrote:
> >> --- a/net/ipv6/addrconf.c
> >> +++ b/net/ipv6/addrconf.c
> >> @@ -1376,7 +1376,7 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp)
> >>  	if (ifp->flags&IFA_F_PERMANENT) {
> >>  		spin_lock_bh(&ifp->lock);
> >>  		addrconf_del_timer(ifp);
> >> -		ifp->flags |= IFA_F_TENTATIVE;
> >> +		ifp->flags |= IFA_F_DADFAILED;
> > 
> > I think you still have to set IFA_F_TENTATIVE here, too, otherwise
> > ipv6_dev_get_saddr() will use this address. 		
> 
> The tentative bit is still set from when this address was added back
> in ipv6_add_addr() from what I can tell, re-setting it here is actually
> unnecessary.  At least /sbin/ip was still showing it set during my
> testing.

There is the possibility of a race when the dad_timer expires at the
same time the NA triggering DAD failure is received. There isn't a big
chance to see that during real world testing, though.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 11, 2009, 7:38 p.m. UTC | #4
From: Brian Haley <brian.haley@hp.com>
Date: Fri, 04 Sep 2009 21:38:07 -0400

> [Note: if this is accepted I'll send out a patch for iproute,
>  if you'd prefer to not use the last ifa_flag I'll send a
>  much larger patch that does this differently :) ]
> 
> 
> Add IFA_F_DADFAILED flag to denote an IPv6 address that has
> failed Duplicate Address Detection, that way tools like
> /sbin/ip can be more informative.
> 
> 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
>     inet6 2001:db8::1/64 scope global tentative dadfailed 
>        valid_lft forever preferred_lft forever
> 
> Signed-off-by: Brian Haley <brian.haley@hp.com>

I applied the most recent iteration of this patch using
the above commit message, thanks Brian.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index a60c821..fd97404 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -41,6 +41,7 @@  enum
 
 #define	IFA_F_NODAD		0x02
 #define IFA_F_OPTIMISTIC	0x04
+#define IFA_F_DADFAILED		0x08
 #define	IFA_F_HOMEADDRESS	0x10
 #define IFA_F_DEPRECATED	0x20
 #define IFA_F_TENTATIVE		0x40
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 43b3c9f..6532966 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1376,7 +1376,7 @@  static void addrconf_dad_stop(struct inet6_ifaddr *ifp)
 	if (ifp->flags&IFA_F_PERMANENT) {
 		spin_lock_bh(&ifp->lock);
 		addrconf_del_timer(ifp);
-		ifp->flags |= IFA_F_TENTATIVE;
+		ifp->flags |= IFA_F_DADFAILED;
 		spin_unlock_bh(&ifp->lock);
 		in6_ifa_put(ifp);
 #ifdef CONFIG_IPV6_PRIVACY