From patchwork Tue Dec 8 19:20:46 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Bohac X-Patchwork-Id: 40668 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.176.167]) by ozlabs.org (Postfix) with ESMTP id C7B1AB7B5F for ; Wed, 9 Dec 2009 06:20:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965824AbZLHTUq (ORCPT ); Tue, 8 Dec 2009 14:20:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965822AbZLHTUp (ORCPT ); Tue, 8 Dec 2009 14:20:45 -0500 Received: from cantor.suse.de ([195.135.220.2]:48828 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965820AbZLHTUo (ORCPT ); Tue, 8 Dec 2009 14:20:44 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id DB24393717; Tue, 8 Dec 2009 20:20:50 +0100 (CET) Date: Tue, 8 Dec 2009 20:20:46 +0100 From: Jiri Bohac To: netdev@vger.kernel.org Cc: Hideaki YOSHIFUJI Subject: ipv6: why disable ipv6 on last address removal? Message-ID: <20091208192046.GA5649@midget.suse.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: Thanks, --- 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; } }