linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if last ipv6 address is removed
@ 2015-06-18  9:29 Mazhar Rana
  2015-06-18  9:29 ` [PATCH ipv6 1/1] ipv6: addrconf: do addrconf_ifdown when " Mazhar Rana
  2015-06-18 11:23 ` [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if " Hannes Frederic Sowa
  0 siblings, 2 replies; 4+ messages in thread
From: Mazhar Rana @ 2015-06-18  9:29 UTC (permalink / raw)
  To: netdev
  Cc: Mazhar Rana, linux-kernel, davem, kuznet, jmorris, yoshfuji,
	kaber, hannes, sanket.saha, mazhar.rana

Hi,

After 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
("ipv6: don't disable interface if last ipv6 address is removed")'
it is not clearing ipv6 interface configurations(routes, neighbours,
etc) when last ipv6 address of interface is removed.

This is now creating functionality issue with below deployment.

On ubuntu 14.04 (upgraded with linux kernel 3.19)
eth1 GW1: 2604:2000:7000:2::102
eth0 GW2: 2001:df7:6000:101::1b:102

HostA: 3804:3000:1406:2::102 (reachable via GW1 and GW2 both)

In this deployment, HostA is reachable via eth0 and eth1. I prefer
that all traffic for HostA should go via GW1 which is available on 
link eth1. 

$ ip -6 ro s
2001:df7:6000:101::/64 dev eth0  proto kernel  metric 256 
2604:2000:7000:2::/64 dev eth1  proto kernel  metric 256 
3804:3000:1406:2::/64 via 2604:2000:7000:2::102 dev eth1  metric 1024 
fe80::/64 dev eth0  proto kernel  metric 256 
fe80::/64 dev eth1  proto kernel  metric 256 
default via 2001:df7:6000:101::1b:102 dev eth0  proto static  metric 1 

On failure of GW1 I removed all ipv6 address of eth1 so all traffic
should go through default gateway 'GW2'.

$ sudo ip -6 addr flush dev eth1
$ ip -6 ro s
2001:df7:6000:101::/64 dev eth0  proto kernel  metric 256 
3804:3000:1406:2::/64 via 2604:2000:7000:2::102 dev eth1  metric 1024 
fe80::/64 dev eth0  proto kernel  metric 256 
fe80::/64 dev eth0.100  proto kernel  metric 256 
default via 2001:df7:6000:101::1b:102 dev eth0  proto static  metric 1

But here, route for HostA is not deleted, so traffic for HostA is
still trying to go through GW1 which is not reachable anymore.

If 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
("ipv6: don't disable interface if last ipv6 address is removed")'
is taken only for problem mention on changlog of that commit then 
here I have alternate proposal which will overcome both issue.

Do you see any side effect of this proposal?

Mazhar Rana (1):
  ipv6: addrconf: do addrconf_ifdown when last ipv6 address is removed

 net/ipv6/addrconf.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
1.9.1


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

* [PATCH ipv6 1/1] ipv6: addrconf: do addrconf_ifdown when last ipv6 address is removed
  2015-06-18  9:29 [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if last ipv6 address is removed Mazhar Rana
@ 2015-06-18  9:29 ` Mazhar Rana
  2015-06-18 11:23 ` [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if " Hannes Frederic Sowa
  1 sibling, 0 replies; 4+ messages in thread
From: Mazhar Rana @ 2015-06-18  9:29 UTC (permalink / raw)
  To: netdev
  Cc: Mazhar Rana, linux-kernel, davem, kuznet, jmorris, yoshfuji,
	kaber, hannes, sanket.saha, mazhar.rana

After 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
("ipv6: don't disable interface if last ipv6 address is removed")'
it is not clearing ipv6 interface configurations(routes, neighbours,
etc) when last ipv6 address of interface is removed.

This patch will call addrconf_ifdown when last ipv6 address of
interface is removed to clear ipv6 interface configurations. This will
not delete /proc/sys/net/ipv6/conf/<interface> directory.

Signed-off-by: Mazhar Rana <mazhar.rana@cyberoam.com>
Acked-by: Sanket Shah <sanket.shah@cyberoam.com>
---
 net/ipv6/addrconf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 37b70e8..230452c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2678,6 +2678,8 @@ static int inet6_addr_del(struct net *net, int ifindex, u32 ifa_flags,
 				ipv6_mc_config(net->ipv6.mc_autojoin_sk,
 					       false, pfx, dev->ifindex);
 			}
+			if (list_empty(&idev->addr_list))
+				addrconf_ifdown(idev->dev, 0);
 			return 0;
 		}
 	}
-- 
1.9.1


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

* Re: [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if last ipv6 address is removed
  2015-06-18  9:29 [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if last ipv6 address is removed Mazhar Rana
  2015-06-18  9:29 ` [PATCH ipv6 1/1] ipv6: addrconf: do addrconf_ifdown when " Mazhar Rana
@ 2015-06-18 11:23 ` Hannes Frederic Sowa
  2015-06-22  4:37   ` GMAIL
  1 sibling, 1 reply; 4+ messages in thread
From: Hannes Frederic Sowa @ 2015-06-18 11:23 UTC (permalink / raw)
  To: Mazhar Rana, netdev
  Cc: linux-kernel, davem, kuznet, jmorris, yoshfuji, kaber,
	sanket.saha, mazhar.rana

On Thu, 2015-06-18 at 14:59 +0530, Mazhar Rana wrote:
> Hi,
> 
> After 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
> ("ipv6: don't disable interface if last ipv6 address is removed")'
> it is not clearing ipv6 interface configurations(routes, neighbours,
> etc) when last ipv6 address of interface is removed.
> 
> This is now creating functionality issue with below deployment.
> 
> On ubuntu 14.04 (upgraded with linux kernel 3.19)
> eth1 GW1: 2604:2000:7000:2::102
> eth0 GW2: 2001:df7:6000:101::1b:102
> 
> HostA: 3804:3000:1406:2::102 (reachable via GW1 and GW2 both)
> 
> In this deployment, HostA is reachable via eth0 and eth1. I prefer
> that all traffic for HostA should go via GW1 which is available on 
> link eth1. 
> 
> $ ip -6 ro s
> 2001:df7:6000:101::/64 dev eth0  proto kernel  metric 256 
> 2604:2000:7000:2::/64 dev eth1  proto kernel  metric 256 
> 3804:3000:1406:2::/64 via 2604:2000:7000:2::102 dev eth1  metric 1024 
> fe80::/64 dev eth0  proto kernel  metric 256 
> fe80::/64 dev eth1  proto kernel  metric 256 
> default via 2001:df7:6000:101::1b:102 dev eth0  proto static  metric 1 
> 
> On failure of GW1 I removed all ipv6 address of eth1 so all traffic
> should go through default gateway 'GW2'.
> 
> $ sudo ip -6 addr flush dev eth1
> $ ip -6 ro s
> 2001:df7:6000:101::/64 dev eth0  proto kernel  metric 256 
> 3804:3000:1406:2::/64 via 2604:2000:7000:2::102 dev eth1  metric 1024 
> fe80::/64 dev eth0  proto kernel  metric 256 
> fe80::/64 dev eth0.100  proto kernel  metric 256 
> default via 2001:df7:6000:101::1b:102 dev eth0  proto static  metric 1
> 
> But here, route for HostA is not deleted, so traffic for HostA is
> still trying to go through GW1 which is not reachable anymore.
> 
> If 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
> ("ipv6: don't disable interface if last ipv6 address is removed")'
> is taken only for problem mention on changlog of that commit then 
> here I have alternate proposal which will overcome both issue.
> 
> Do you see any side effect of this proposal?

In theory IPv6 mandates that on-link information (which subnet is available on
which link) and address specific connected routes should not depend on each
other. That said, your initial assumption that clearing addresses from an
interface to shut it down for IPv6 operation is wrong.

I guess the check was there to make sure each link has an LL address.

As we changed backwards compatibility here I am a bit ambivalent.

Another glitch I noticed with your patch: We don't set disable_ipv6 bit on
addrconf_ifdown with how==0, so we cannot easily bring the interface up without
disturbing IPv4 operations, could you check, that the disable_ipv6 switch works
to at least bring the ipv6 part of the interface up again?

Bye,
Hannes


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

* Re: [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if last ipv6 address is removed
  2015-06-18 11:23 ` [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if " Hannes Frederic Sowa
@ 2015-06-22  4:37   ` GMAIL
  0 siblings, 0 replies; 4+ messages in thread
From: GMAIL @ 2015-06-22  4:37 UTC (permalink / raw)
  To: Hannes Frederic Sowa, netdev
  Cc: linux-kernel, davem, kuznet, jmorris, yoshfuji, kaber,
	Sanket Shah, mazhar.rana

On Thursday 18 June 2015 04:53 PM, Hannes Frederic Sowa wrote:
> On Thu, 2015-06-18 at 14:59 +0530, Mazhar Rana wrote:
>> Hi,
>>
>> After 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
>> ("ipv6: don't disable interface if last ipv6 address is removed")'
>> it is not clearing ipv6 interface configurations(routes, neighbours,
>> etc) when last ipv6 address of interface is removed.
>>
>> This is now creating functionality issue with below deployment.
>>
>> On ubuntu 14.04 (upgraded with linux kernel 3.19)
>> eth1 GW1: 2604:2000:7000:2::102
>> eth0 GW2: 2001:df7:6000:101::1b:102
>>
>> HostA: 3804:3000:1406:2::102 (reachable via GW1 and GW2 both)
>>
>> In this deployment, HostA is reachable via eth0 and eth1. I prefer
>> that all traffic for HostA should go via GW1 which is available on
>> link eth1.
>>
>> $ ip -6 ro s
>> 2001:df7:6000:101::/64 dev eth0  proto kernel  metric 256
>> 2604:2000:7000:2::/64 dev eth1  proto kernel  metric 256
>> 3804:3000:1406:2::/64 via 2604:2000:7000:2::102 dev eth1  metric 1024
>> fe80::/64 dev eth0  proto kernel  metric 256
>> fe80::/64 dev eth1  proto kernel  metric 256
>> default via 2001:df7:6000:101::1b:102 dev eth0  proto static  metric 1
>>
>> On failure of GW1 I removed all ipv6 address of eth1 so all traffic
>> should go through default gateway 'GW2'.
>>
>> $ sudo ip -6 addr flush dev eth1
>> $ ip -6 ro s
>> 2001:df7:6000:101::/64 dev eth0  proto kernel  metric 256
>> 3804:3000:1406:2::/64 via 2604:2000:7000:2::102 dev eth1  metric 1024
>> fe80::/64 dev eth0  proto kernel  metric 256
>> fe80::/64 dev eth0.100  proto kernel  metric 256
>> default via 2001:df7:6000:101::1b:102 dev eth0  proto static  metric 1
>>
>> But here, route for HostA is not deleted, so traffic for HostA is
>> still trying to go through GW1 which is not reachable anymore.
>>
>> If 'commit 876fd05ddbae03166e7037fca957b55bb3be6594
>> ("ipv6: don't disable interface if last ipv6 address is removed")'
>> is taken only for problem mention on changlog of that commit then
>> here I have alternate proposal which will overcome both issue.
>>
>> Do you see any side effect of this proposal?
> In theory IPv6 mandates that on-link information (which subnet is available on
> which link) and address specific connected routes should not depend on each
> other. That said, your initial assumption that clearing addresses from an
> interface to shut it down for IPv6 operation is wrong.
>
> I guess the check was there to make sure each link has an LL address.
>
> As we changed backwards compatibility here I am a bit ambivalent.
>
> Another glitch I noticed with your patch: We don't set disable_ipv6 bit on
> addrconf_ifdown with how==0, so we cannot easily bring the interface up without
> disturbing IPv4 operations, could you check, that the disable_ipv6 switch works
> to at least bring the ipv6 part of the interface up again?
>
> Bye,
> Hannes
>
Hi Hannes,

Thanks for quick review and reply.

I agree with you. With my patch we can not bring the interface up
without disturbing IPv4 operations. I am working on it to fix it, will
update you once it is done.

Here I want to share behaviour observed in above deployment:

After flushing ipv6 addresses from interface eth1, it is sending
traffic for HostA via GW1 until GW1's neighbour entry become failed.
Once neighbour entry got failed, default route is selected for all
traffic including traffic for HostA. I have not tested behaviour with
interface based routes yet.

Regards,
Mazhar Rana

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2015-06-22  4:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18  9:29 [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if last ipv6 address is removed Mazhar Rana
2015-06-18  9:29 ` [PATCH ipv6 1/1] ipv6: addrconf: do addrconf_ifdown when " Mazhar Rana
2015-06-18 11:23 ` [PATCH ipv6 0/1] ipv6: addrconf: routes are not deleted if " Hannes Frederic Sowa
2015-06-22  4:37   ` GMAIL

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).