From patchwork Wed Sep 29 14:43:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Haley X-Patchwork-Id: 66072 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 29D75B7116 for ; Thu, 30 Sep 2010 00:44:10 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752866Ab0I2Ona (ORCPT ); Wed, 29 Sep 2010 10:43:30 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:29141 "EHLO g4t0015.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752747Ab0I2On3 (ORCPT ); Wed, 29 Sep 2010 10:43:29 -0400 Received: from g4t0009.houston.hp.com (g4t0009.houston.hp.com [16.234.32.26]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 5984988D3; Wed, 29 Sep 2010 14:43:23 +0000 (UTC) Received: from [16.1.1.102] (squirrel.fc.hp.com [15.11.146.57]) by g4t0009.houston.hp.com (Postfix) with ESMTP id AB97CC08C; Wed, 29 Sep 2010 14:43:18 +0000 (UTC) Message-ID: <4CA35084.8010503@hp.com> Date: Wed, 29 Sep 2010 10:43:16 -0400 From: Brian Haley Organization: Open Source and Linux Organization User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Lightning/1.0b1 Thunderbird/3.0.8 MIME-Version: 1.0 To: David Miller CC: gwurster@scs.carleton.ca, kuznet@ms2.inr.ac.ru, pekkas@netcore.fi, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, shemminger@vyatta.com, eric.dumazet@gmail.com, herbert@gondor.apana.org.au, ebiederm@xmission.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH linux-2.6 v2] IPv6: Create temporary address if none exists. References: <20100927170430.GA7106@adams.ccsl.carleton.ca> <20100928.222510.71109554.davem@davemloft.net> In-Reply-To: <20100928.222510.71109554.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 09/29/2010 01:25 AM, David Miller wrote: > From: Glenn Wurster > Date: Mon, 27 Sep 2010 13:04:30 -0400 > >> If privacy extentions are enabled, but no current temporary address exists, >> then create one when we get a router advertisement. >> >> Version 2, now with 100% fewer line wraps. Thanks to David Miller for >> pointing out the line wrapping issue. >> >> Signed-off-by: Glenn Wurster > > The existing code is correct from what I can tell. > > Variable "create" is true when "ifp == NULL" and "valid_lft != 0" > > And RFC 3041 explicitly states in section 3.3: > > When a new public address is created as described in [ADDRCONF] > (because the prefix advertised does not match the prefix of any > address already assigned to the interface, and Valid Lifetime > in the option is not zero), also create a new temporary address. > > Your patch is going to cause us to create a temporary address even > when valid_lft is zero, which the RFC says we should not do. > > That goes against what the RFC tells us to do, so I can only conclude > that your patch is not correct. I think this patch might actually be OK, I had to look at this more than once to figure out the problem Glenn was trying to fix. Maybe he can confirm. From what I have found, this is fixing the case where we've changed use_tempaddr to 1 on an interface that already has a "stable" IPv6 prefix. In that case you'll never add a temporary address: # ip -6 a s dev eth6 10: eth6: mtu 1500 qlen 1000 inet6 2620:0:a09:e000:21f:29ff:fe59:faca/64 scope global dynamic valid_lft 2591820sec preferred_lft 604620sec inet6 fe80::21f:29ff:fe59:faca/64 scope link valid_lft forever preferred_lft forever 07:47:52.119051 IP6 fe80::205:9aff:fe3a:1871 > ip6-allnodes: ICMP6, router advertisement # ip -6 a s dev eth6 10: eth6: mtu 1500 qlen 1000 inet6 2620:0:a09:e000:21f:29ff:fe59:faca/64 scope global dynamic valid_lft 2591996sec preferred_lft 604796sec inet6 fe80::21f:29ff:fe59:faca/64 scope link valid_lft forever preferred_lft forever No temp address :( Since we're in the "if (ifp)" block, we can assume that at some point in time we did get a valid advertisement to add this address, whether is was right now or an hour ago doesn't matter. Of course the RFCs don't cover this case, they assume privacy settings were enabled at boot time, if there's ever an update to 4941/3041 that should be clarified. Maybe the below (untested) patch is better? Glenn, can you test this? -Brian --- If privacy extensions are enabled, but no current temporary address exists, then create one when we get a router advertisement with a valid lifetime. Signed-off-by: Brian Haley -- 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/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 8c88340..fb238d6 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1925,7 +1925,8 @@ ok: update_lft = create = 1; ifp->cstamp = jiffies; addrconf_dad_start(ifp, RTF_ADDRCONF|RTF_PREFIX_RT); - } + } else if (list_empty(&in6_dev->tempaddr_list) && valid_lft) + create = 1; /* use_tempaddr could have changed */ if (ifp) { int flags;