public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Lorenzo Colitti <lorenzo@google.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH] ipv6: slightly simplify keeping IPv6 addresses on link down
Date: Wed, 1 Dec 2010 12:22:53 -0800	[thread overview]
Message-ID: <20101201122253.2a8be2e0@nehalam> (raw)
In-Reply-To: <AAs7234jas72lda05laWgh1LziatUa+qSHd+6Jj+k_eO=@mail.gmail.com>

On Wed, 01 Dec 2010 11:38:58 -0800
Lorenzo Colitti <lorenzo@google.com> wrote:

> ipv6: slightly simplify keeping IPv6 addresses on link down
> 
> When link goes down, all statically-configured (i.e.,
> permanent and not link-local) IPv6 addresses are kept on
> the interface. Instead of moving addresses to a temporary
> keep list and then splicing that back on to the interface
> address list, use list_for_each_entry_safe and delete the
> ones we don't want.
> 
> Tested by configuring two static addresses on an interface
> and verifying that pings from the addresses keep working
> when bringing link down and up again and when disabling and
> re-enabling IPv6 on the interface.
> 
> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 6dfd5c5..23cc8e1 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -2663,7 +2663,8 @@ static int addrconf_ifdown(struct net_device *dev, int how)
>  {
>  	struct net *net = dev_net(dev);
>  	struct inet6_dev *idev;
> -	struct inet6_ifaddr *ifa, *ifn;
> +	struct inet6_ifaddr *ifa;
> +	LIST_HEAD(keep_list);
>  	int state;

Your patch is backwards? The existing code is:

static int addrconf_ifdown(struct net_device *dev, int how)
{
	struct net *net = dev_net(dev);
	struct inet6_dev *idev;
	struct inet6_ifaddr *ifa;
	LIST_HEAD(keep_list);
	int state;

	ASSERT_RTNL();

Also, the addrconf_ifdown can race with other updates to idev->addr_list
from addrconf timers etc.  Therefore even list_for_each_entry_safe is not safe.

  reply	other threads:[~2010-12-01 20:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-26 18:06 [PATCH] ipv6: slightly simplify keeping IPv6 addresses on link down Lorenzo Colitti
2010-12-01 19:01 ` David Miller
2010-12-01 19:38   ` Lorenzo Colitti
2010-12-01 20:22     ` Stephen Hemminger [this message]
2010-12-01 20:52       ` Lorenzo Colitti
2010-12-01 21:04         ` Stephen Hemminger
2010-12-10 20:43           ` David Miller
2010-12-10 23:00             ` Lorenzo Colitti
2010-12-01 20:54       ` Lorenzo Colitti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101201122253.2a8be2e0@nehalam \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=lorenzo@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox