All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Lorenzo Colitti <lorenzo@google.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] ipv6: addrconf: clear IPv6 addresses and routes when losing link
Date: Mon, 25 Oct 2010 21:38:41 -0700	[thread overview]
Message-ID: <20101025213841.635b9a15@nehalam> (raw)
In-Reply-To: <AANLkTikC4pv8aOODM2pOg2bKQGL69wivcUU3f9ZziPhe@mail.gmail.com>

On Mon, 25 Oct 2010 19:08:27 -0700
Lorenzo Colitti <lorenzo@google.com> wrote:

> When roaming between different networks (e.g., changing wireless
> SSIDs, or plugging in to different wired networks), IPv6 addresses and
> routes are not cleared. If the two networks have different IPv6
> subnets assigned, the host maintains both the old and new IPv6
> addresses and gateways, but only the new ones works. If the host
> chooses the wrong source address or gateway, or if the new network
> does not have IPv6 but the old one did, IPv6 connections time out,
> leading to long delays when trying to connect to IPv6 hosts.
> 
> Fix this by ensuring that autoconfigured IPv6 addresses and routes are
> purged when link is lost, not only when the interface goes down.
> 
> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
> 
> --- a/net/ipv6/addrconf.c	2010-10-20 13:30:22.000000000 -0700
> +++ b/net/ipv6/addrconf.c	2010-10-25 13:55:15.000000000 -0700
> @@ -2524,6 +2524,14 @@
>  		} else {
>  			if (!addrconf_qdisc_ok(dev)) {
>  				/* device is still not ready. */
> +				if (idev && (idev->if_flags & IF_READY)) {
> +					/* Link lost. Clear addresses and
> +					   routes, the device might come back
> +					   on a link where they are no longer
> +					   valid. */
> +					addrconf_ifdown(dev, 0);
> +					idev->if_flags &= ~IF_READY;
> +				}
>  				break;
>  			}

This is incorrect. When link is lost, routes and address should not be
flushed. They should be marked as tentative and then go through DAD again
on the new network.

If you do it this way, you break routing protocols when link is brought
down and back up.

  reply	other threads:[~2010-10-26  4:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26  2:08 [PATCH] ipv6: addrconf: clear IPv6 addresses and routes when losing link Lorenzo Colitti
2010-10-26  4:38 ` Stephen Hemminger [this message]
2010-10-26  5:44   ` Lorenzo Colitti
2010-10-26 15:28     ` Stephen Hemminger
2010-10-26 17:11       ` Lorenzo Colitti
2010-11-02  2:54       ` Dan Williams
2010-11-05  6:40         ` Lorenzo Colitti
2010-10-26 16:58     ` Brian Haley
2010-10-26 17:09       ` Lorenzo Colitti
2010-10-26 17:10       ` David Miller
2010-10-26 17:13         ` Lorenzo Colitti
2010-10-26 17:21           ` David Miller
2010-10-26 17:37             ` Lorenzo Colitti
2010-10-26 17:47               ` David Miller
2010-10-26 17:50                 ` Lorenzo Colitti
2010-10-26 17:55                   ` David Miller
2010-10-26 18:02                     ` Lorenzo Colitti
2010-10-26 18:21                       ` David Miller
2010-11-02  2:50                       ` Dan Williams
2010-10-26 18:17                 ` Lorenzo Colitti
2010-10-26 18:23                   ` David Miller
2010-10-26 22:53                     ` Lorenzo Colitti
2010-10-27 15:51                       ` David Miller
2010-10-27 16:01                         ` Lorenzo Colitti
2010-10-27 16:05                           ` David Miller
2010-10-27  2:31 ` Brian Haley
2010-10-27  8:35   ` Maciej Żenczykowski
2010-10-27 16:03     ` Lorenzo Colitti
2010-10-27 20:39       ` Maciej Żenczykowski
2010-10-28 22:23         ` Lorenzo Colitti
2010-10-28 22:41           ` Lorenzo Colitti
2010-10-28 22:50           ` Maciej Żenczykowski

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=20101025213841.635b9a15@nehalam \
    --to=shemminger@vyatta.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.