All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: netdev@vger.kernel.org
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Subject: ipv6: why disable ipv6 on last address removal?
Date: Tue, 8 Dec 2009 20:20:46 +0100	[thread overview]
Message-ID: <20091208192046.GA5649@midget.suse.cz> (raw)

Hi,

I came across a strange behaviour:

When the last IPv6 address of an interface is removed (using e.g.
"ip -6 addr flush ethX"), inet6_addr_del() calls addrconf_ifdown(... , how=1).

This completely removes IPv6 from the interface. (The same thing
is done e.g. on NETDEV_UNREGISTER). An ugly side effect of this
is that it is no longer possible to set the interface IPv6
settings using sysctl. The only way to make the sysctl settings
accessible again seems to be taking the interface down and up.

This is a nightmare for management scripts.

Most other actions, such as NETDEV_DOWN, call
addrconf_ifdown(..., how=0), which keeps the sysctl settings
available.

Is there any reason why inet6_addr_del needs to sets how=1 and
disable IPv6 even more than "ifconfig down" does?


I quickly tested this patch and it did not seem to break
anything:

--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2185,7 +2185,7 @@ static int inet6_addr_del(struct net *net, int ifindex, struct in6_addr *pfx,
 			   disable IPv6 on this interface.
 			 */
 			if (idev->addr_list == NULL)
-				addrconf_ifdown(idev->dev, 1);
+				addrconf_ifdown(idev->dev, 0);
 			return 0;
 		}
 	}

Thanks,

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


             reply	other threads:[~2009-12-08 19:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 19:20 Jiri Bohac [this message]
2009-12-08 20:56 ` ipv6: why disable ipv6 on last address removal? David Miller
2009-12-09  7:18   ` Jiri Bohac
2009-12-09  7:39   ` YOSHIFUJI Hideaki
2010-01-05  6:44     ` David Miller
2010-02-16 15:28       ` Jiri Bohac
2011-01-23  9:47         ` Stephen Hemminger

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=20091208192046.GA5649@midget.suse.cz \
    --to=jbohac@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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.