From patchwork Mon Sep 27 17:04:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glenn Wurster X-Patchwork-Id: 65885 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 267EEB70CD for ; Tue, 28 Sep 2010 03:05:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758997Ab0I0RFI (ORCPT ); Mon, 27 Sep 2010 13:05:08 -0400 Received: from shakespeare.ccsl.carleton.ca ([134.117.225.11]:32771 "EHLO shakespeare.ccsl.carleton.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756459Ab0I0RFH (ORCPT ); Mon, 27 Sep 2010 13:05:07 -0400 Received: from adams.ccsl.carleton.ca ([2002:8675:e101:0:209:6bff:fe52:8800]) by shakespeare.ccsl.carleton.ca with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P0H7u-0006lQ-90; Mon, 27 Sep 2010 13:04:30 -0400 Received: from gwurster by adams.ccsl.carleton.ca with local (Exim 4.69) (envelope-from ) id 1P0H7u-0001rT-1M; Mon, 27 Sep 2010 13:04:30 -0400 Date: Mon, 27 Sep 2010 13:04:30 -0400 From: Glenn Wurster To: "David S. Miller" , Alexey Kuznetsov , "Pekka Savola (ipv6)" , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , Stephen Hemminger , Eric Dumazet , Herbert Xu , "Eric W. Biederman" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH linux-2.6 v2] IPv6: Create temporary address if none exists. Message-ID: <20100927170430.GA7106@adams.ccsl.carleton.ca> MIME-Version: 1.0 Content-Disposition: inline X-TUID: 74e835a4da6b3e7d User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/ipv6/addrconf.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index ab70a3f..cfee6ae 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2022,10 +2022,11 @@ ok: ipv6_ifa_notify(0, ift); } - if (create && in6_dev->cnf.use_tempaddr > 0) { + if ((create || list_empty(&in6_dev->tempaddr_list)) && in6_dev->cnf.use_tempaddr > 0) { /* * When a new public address is created as described in [ADDRCONF], - * also create a new temporary address. + * also create a new temporary address. Also create a temporary + * address if it's enabled but no temporary address currently exists. */ read_unlock_bh(&in6_dev->lock); ipv6_create_tempaddr(ifp, NULL);