From patchwork Thu Sep 10 00:41:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Haley X-Patchwork-Id: 33236 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 84E52B707B for ; Thu, 10 Sep 2009 10:42:16 +1000 (EST) Received: by ozlabs.org (Postfix) id 7300FDDD0B; Thu, 10 Sep 2009 10:42:16 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 16A39DDD04 for ; Thu, 10 Sep 2009 10:42:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753462AbZIJAmH (ORCPT ); Wed, 9 Sep 2009 20:42:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752873AbZIJAmG (ORCPT ); Wed, 9 Sep 2009 20:42:06 -0400 Received: from g5t0007.atlanta.hp.com ([15.192.0.44]:3128 "EHLO g5t0007.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752863AbZIJAmG (ORCPT ); Wed, 9 Sep 2009 20:42:06 -0400 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g5t0007.atlanta.hp.com (Postfix) with ESMTP id D572214306; Thu, 10 Sep 2009 00:42:07 +0000 (UTC) Received: from [16.1.1.100] (squirrel.fc.hp.com [15.11.146.57]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 4CA3E30316; Thu, 10 Sep 2009 00:41:34 +0000 (UTC) Message-ID: <4AA84B3C.4000401@hp.com> Date: Wed, 09 Sep 2009 20:41:32 -0400 From: Brian Haley Organization: Open Source and Linux Organization User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Jens Rosenboom CC: david Miller , "netdev@vger.kernel.org" , YOSHIFUJI Hideaki Subject: Re: [PATCH] ipv6: Add IFA_F_DADFAILED flag References: <4AA1C0FF.4030109@hp.com> <1252418247.5827.8.camel@fnki-nb00130> <4AA675D4.8030406@hp.com> <1252424623.5827.14.camel@fnki-nb00130> In-Reply-To: <1252424623.5827.14.camel@fnki-nb00130> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Jens Rosenboom wrote: > 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. Ok, how does this look? I changed it to set the tentative flag as it did before, plus clear the dad_failed flag if the device got restarted, triggering DAD to happen again for any tentative address, that was an oversight on my part. I'd still like to know if using this last ifa_flag is going to be an issue, I actually finished a similar patch that uses a new IFA_ADDRFLAGS structure to pass in/out this additional info. -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 --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..c9b3690 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1371,12 +1371,14 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add /* Gets referenced address, destroys ifaddr */ -static void addrconf_dad_stop(struct inet6_ifaddr *ifp) +static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed) { if (ifp->flags&IFA_F_PERMANENT) { spin_lock_bh(&ifp->lock); addrconf_del_timer(ifp); ifp->flags |= IFA_F_TENTATIVE; + if (dad_failed) + ifp->flags |= IFA_F_DADFAILED; spin_unlock_bh(&ifp->lock); in6_ifa_put(ifp); #ifdef CONFIG_IPV6_PRIVACY @@ -1422,7 +1424,7 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp) } } - addrconf_dad_stop(ifp); + addrconf_dad_stop(ifp, 1); } /* Join to solicited addr multicast group. */ @@ -2778,7 +2780,7 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) idev->cnf.accept_dad < 1 || !(ifp->flags&IFA_F_TENTATIVE) || ifp->flags & IFA_F_NODAD) { - ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC); + ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC|IFA_F_DADFAILED); spin_unlock_bh(&ifp->lock); read_unlock_bh(&idev->lock); @@ -2795,7 +2797,7 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) * - otherwise, kill it. */ in6_ifa_hold(ifp); - addrconf_dad_stop(ifp); + addrconf_dad_stop(ifp, 0); return; } @@ -2829,7 +2831,7 @@ static void addrconf_dad_timer(unsigned long data) * DAD was successful */ - ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC); + ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC|IFA_F_DADFAILED); spin_unlock_bh(&ifp->lock); read_unlock_bh(&idev->lock);