From: Mike Manning <hidden> Date: 2016-08-17 10:29:44
If DAD fails with accept_dad set to 2, global addresses and host routes
are incorrectly left in place. Even though disable_ipv6 is set,
contrary to documentation, the addresses are not dynamically deleted
from the interface. It is only on a subsequent link down/up that these
are removed. The fix is not only to set the disable_ipv6 flag, but to
actually disable IPv6 when DAD fails in this case. This results in the
addresses and routes being immediately deleted. The DAD failure
for the LL addr is determined as before via netlink, or by the absence
of the LL addr (which also previously would have had to be checked for
in case of an intervening link down/up).
Previous behavior:
root@vm1:/# sysctl net.ipv6.conf.eth3.accept_dad=2
net.ipv6.conf.eth3.accept_dad = 2
root@vm1:/# ip -6 addr add 2000::10/64 dev eth3
root@vm1:/# ip link set up eth3
root@vm1:/# ip -6 addr show dev eth3
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2000::10/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe43:dd5a/64 scope link tentative dadfailed
valid_lft forever preferred_lft forever
root@vm1:/# ip -6 route show dev eth3
2000::/64 proto kernel metric 256
fe80::/64 proto kernel metric 256
root@vm1:/# ip link set down eth3
root@vm1:/# ip link set up eth3
root@vm1:/# ip -6 addr show dev eth3
root@vm1:/# ip -6 route show dev eth3
root@vm1:/#
New behavior:
root@vm1:/# sysctl net.ipv6.conf.eth3.accept_dad=2
net.ipv6.conf.eth3.accept_dad = 2
root@vm1:/# ip -6 addr add 2000::10/64 dev eth3
root@vm1:/# ip link set up eth3
root@vm1:/# ip -6 addr show dev eth3
root@vm1:/# ip -6 route show dev eth3
root@vm1:/#
Signed-off-by: Mike Manning <redacted>
---
net/ipv6/addrconf.c | 7 +++++++
1 file changed, 7 insertions(+)
From: kbuild test robot <hidden> Date: 2016-08-17 14:02:59
Hi Mike,
[auto build test WARNING on net/master]
[also build test WARNING on v4.8-rc2 next-20160817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mike-Manning/net-ipv6-Remove-addresses-for-failures-with-strict-DAD/20160817-183122
config: x86_64-randconfig-s4-08172039 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
quoted
net/ipv6/addrconf.c:138:13: warning: 'dev_disable_change' used but never defined
From: kbuild test robot <hidden> Date: 2016-08-17 15:08:45
Hi Mike,
[auto build test ERROR on net/master]
[also build test ERROR on v4.8-rc2 next-20160817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mike-Manning/net-ipv6-Remove-addresses-for-failures-with-strict-DAD/20160817-183122
config: x86_64-randconfig-s4-08172039 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
net/built-in.o: In function `addrconf_dad_failure':
quoted
(.text+0x1241dc): undefined reference to `dev_disable_change'
You can't take rtnl_lock at that point but must postpone the actions and
do that in addrconf_dad_work.
Probably the whole ... else if (idev->cnf.accept_dad > 1 && ...) needs
to move there.
Bye,
Hannes
You can't take rtnl_lock at that point but must postpone the actions and
do that in addrconf_dad_work.
Probably the whole ... else if (idev->cnf.accept_dad > 1 && ...) needs
to move there.
Bye,
Hannes
Thanks for the prompt review, I will look into making these changes.
Also these changes caused a build error due to conditional compilation
without CONFIG_SYSCTL, which is resolved by replacing the call to
dev_disable_change(idev) by directly calling addrconf_ifdown(idev->dev,
0) instead.
I would appreciate any further comments if the suggested change in
behavior is not acceptable.
What you describe in the changelog what is happening right now looks
like a bug to me thus your patch made sense to me.
Bye,
Hannes
You can't take rtnl_lock at that point but must postpone the actions and
do that in addrconf_dad_work.
Probably the whole ... else if (idev->cnf.accept_dad > 1 && ...) needs
to move there.
Bye,
Hannes
Thanks for the prompt review, I will look into making these changes.
Also these changes caused a build error due to conditional compilation without CONFIG_SYSCTL, which is resolved by replacing the call to dev_disable_change(idev) by directly calling addrconf_ifdown(idev->dev, 0) instead.
I would appreciate any further comments if the suggested change in behavior is not acceptable.
Thanks
Mike