netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Last Ipv6 address removal causes "addrconf_sysctl_unregister", which inihibits from changing disable_ipv6 setting
@ 2010-07-26 14:03 Mahesh Kelkar
  2010-07-26 20:17 ` Brian Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Mahesh Kelkar @ 2010-07-26 14:03 UTC (permalink / raw)
  To: Brian Haley; +Cc: netdev, David Miller

Odd behavior associated with the patch:
**Last address removal causes "addrconf_sysctl_unregister", which
inihibits from changing disable_ipv6 setting
(connected issue: With disable_ipv6 set to 1 on an interface, ff00:/8
and fe80::/64 are still added on device UP)

Current sysctl config:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Steps:
- Remove last IPv6 address assigned to the "eth0" interface
- inet6_addr_del => addrconf_ifdown(idev->dev, 1) => does the device
sysctl unregister
******Not sure why the addrconf_sysctl_unregister is necessary on last
address removal*******
- Now, "sysctl -a" does not show "net.ipv6.conf.eth0.disable_ipv6"

Problem:
- If you WANT to assign IPv6 address to eth0,
-> Do it once, which fails due to "disable_ipv6" check in
addrconf_add_dev OR ipv6_add_addr
-> But, this process does "addrconf_sysctl_register" (addrconf_add_dev
=> ipv6_find_idev => ipv6_add_dev)
-> set net.ipv6.conf.eth0.disable_ipv6=0 and then successfully assign
ipv6-address to the eth0
(Another alternative is to change all or default to 1; but I wanted to
disable ipv6 by default)

===============
Probable Solution:
===============
@@ -1948,7 +1959,7 @@ static int inet6_addr_del(int ifindex, s
 			   disable IPv6 on this interface.
 			 */
 			if (idev->addr_list == NULL)
-				addrconf_ifdown(idev->dev, 1);
+				addrconf_ifdown(idev->dev, 0);
 			return 0;
 		}
 	}
I have tested the above solution and it seems to work fine - so far.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Last Ipv6 address removal causes "addrconf_sysctl_unregister", which  inihibits from changing disable_ipv6 setting
  2010-07-26 14:03 Last Ipv6 address removal causes "addrconf_sysctl_unregister", which inihibits from changing disable_ipv6 setting Mahesh Kelkar
@ 2010-07-26 20:17 ` Brian Haley
  2010-07-26 20:37   ` Mahesh Kelkar
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Haley @ 2010-07-26 20:17 UTC (permalink / raw)
  To: Mahesh Kelkar; +Cc: netdev, David Miller

On 07/26/2010 10:03 AM, Mahesh Kelkar wrote:
> Odd behavior associated with the patch:
> **Last address removal causes "addrconf_sysctl_unregister", which
> inihibits from changing disable_ipv6 setting
> (connected issue: With disable_ipv6 set to 1 on an interface, ff00:/8
> and fe80::/64 are still added on device UP)

This behavior doesn't seem specific to the patch that was accepted last
week to fix the disable_ipv6 behavior (64e724f6) as all of the sysctl
values are gone for eth0.

> Current sysctl config:
> net.ipv6.conf.all.disable_ipv6 = 1
> net.ipv6.conf.default.disable_ipv6 = 1
> 
> Steps:
> - Remove last IPv6 address assigned to the "eth0" interface
> - inet6_addr_del => addrconf_ifdown(idev->dev, 1) => does the device
> sysctl unregister
> ******Not sure why the addrconf_sysctl_unregister is necessary on last
> address removal*******
> - Now, "sysctl -a" does not show "net.ipv6.conf.eth0.disable_ipv6"

Do they get restored if you bring the link down and back up?

> Problem:
> - If you WANT to assign IPv6 address to eth0,
> -> Do it once, which fails due to "disable_ipv6" check in
> addrconf_add_dev OR ipv6_add_addr
> -> But, this process does "addrconf_sysctl_register" (addrconf_add_dev
> => ipv6_find_idev => ipv6_add_dev)
> -> set net.ipv6.conf.eth0.disable_ipv6=0 and then successfully assign
> ipv6-address to the eth0
> (Another alternative is to change all or default to 1; but I wanted to
> disable ipv6 by default)
> 
> ===============
> Probable Solution:
> ===============
> @@ -1948,7 +1959,7 @@ static int inet6_addr_del(int ifindex, s
>  			   disable IPv6 on this interface.
>  			 */
>  			if (idev->addr_list == NULL)
> -				addrconf_ifdown(idev->dev, 1);
> +				addrconf_ifdown(idev->dev, 0);
>  			return 0;
>  		}
>  	}
> I have tested the above solution and it seems to work fine - so far.

This code has been this way forever in 2.6 (< 2005), changing it could break
existing users.  I'm not sure why it was decided to do it this way as it
was before my time.

Also, the full comment here is:

 /* If the last address is deleted administratively,
    disable IPv6 on this interface.
  */

Which says that you're removing all the IPv6 addresses by hand using
/sbin/ip, so you're forcing the removal.  If you want to disable IPv6
on it and remove all the addresses, why don't you just set disable_ipv6=1?

-Brian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Last Ipv6 address removal causes "addrconf_sysctl_unregister", which inihibits from changing disable_ipv6 setting
  2010-07-26 20:17 ` Brian Haley
@ 2010-07-26 20:37   ` Mahesh Kelkar
  0 siblings, 0 replies; 3+ messages in thread
From: Mahesh Kelkar @ 2010-07-26 20:37 UTC (permalink / raw)
  To: Brian Haley; +Cc: netdev, David Miller

Thanks. Please see comments inline [mahesh]

On Mon, Jul 26, 2010 at 4:17 PM, Brian Haley <brian.haley@hp.com> wrote:
> On 07/26/2010 10:03 AM, Mahesh Kelkar wrote:
>> Odd behavior associated with the patch:
>> **Last address removal causes "addrconf_sysctl_unregister", which
>> inihibits from changing disable_ipv6 setting
>> (connected issue: With disable_ipv6 set to 1 on an interface, ff00:/8
>> and fe80::/64 are still added on device UP)
>
> This behavior doesn't seem specific to the patch that was accepted last
> week to fix the disable_ipv6 behavior (64e724f6) as all of the sysctl
> values are gone for eth0.
>

[mahesh] Your are right. The behavior is not specific to the patch.
Actually I meant to say that the behavior can be observed with the
disable_ipv6 in general.

>> Current sysctl config:
>> net.ipv6.conf.all.disable_ipv6 = 1
>> net.ipv6.conf.default.disable_ipv6 = 1
>>
>> Steps:
>> - Remove last IPv6 address assigned to the "eth0" interface
>> - inet6_addr_del => addrconf_ifdown(idev->dev, 1) => does the device
>> sysctl unregister
>> ******Not sure why the addrconf_sysctl_unregister is necessary on last
>> address removal*******
>> - Now, "sysctl -a" does not show "net.ipv6.conf.eth0.disable_ipv6"
>
> Do they get restored if you bring the link down and back up?
>

[mahesh] Yes. It does get restored on link down and back up.

>> Problem:
>> - If you WANT to assign IPv6 address to eth0,
>> -> Do it once, which fails due to "disable_ipv6" check in
>> addrconf_add_dev OR ipv6_add_addr
>> -> But, this process does "addrconf_sysctl_register" (addrconf_add_dev
>> => ipv6_find_idev => ipv6_add_dev)
>> -> set net.ipv6.conf.eth0.disable_ipv6=0 and then successfully assign
>> ipv6-address to the eth0
>> (Another alternative is to change all or default to 1; but I wanted to
>> disable ipv6 by default)
>>
>> ===============
>> Probable Solution:
>> ===============
>> @@ -1948,7 +1959,7 @@ static int inet6_addr_del(int ifindex, s
>>                          disable IPv6 on this interface.
>>                        */
>>                       if (idev->addr_list == NULL)
>> -                             addrconf_ifdown(idev->dev, 1);
>> +                             addrconf_ifdown(idev->dev, 0);
>>                       return 0;
>>               }
>>       }
>> I have tested the above solution and it seems to work fine - so far.
>
> This code has been this way forever in 2.6 (< 2005), changing it could break
> existing users.  I'm not sure why it was decided to do it this way as it
> was before my time.
>

[mahesh]  Can anyone on netdev list sheds light on this?

> Also, the full comment here is:
>
>  /* If the last address is deleted administratively,
>    disable IPv6 on this interface.
>  */
>
> Which says that you're removing all the IPv6 addresses by hand using
> /sbin/ip, so you're forcing the removal.  If you want to disable IPv6
> on it and remove all the addresses, why don't you just set disable_ipv6=1?
>

[mahesh] I did not add the comment.

[mahesh] But, you are right. One of the alternative is to disable_ipv6
instead of removing last IP address.

[mahesh] But, if you or somebody else happen to touch this code in
future, please see if you could avoid
addrconf_sysctl_register/unregister.

> -Brian
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-26 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-26 14:03 Last Ipv6 address removal causes "addrconf_sysctl_unregister", which inihibits from changing disable_ipv6 setting Mahesh Kelkar
2010-07-26 20:17 ` Brian Haley
2010-07-26 20:37   ` Mahesh Kelkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).