linux/net/ipv6
Benjamin Thery e3ec6cfc26 ipv6: fix run pending DAD when interface becomes ready
With some net devices types, an IPv6 address configured while the
interface was down can stay 'tentative' forever, even after the interface
is set up. In some case, pending IPv6 DADs are not executed when the
device becomes ready.

I observed this while doing some tests with kvm. If I assign an IPv6 
address to my interface eth0 (kvm driver rtl8139) when it is still down
then the address is flagged tentative (IFA_F_TENTATIVE). Then, I set
eth0 up, and to my surprise, the address stays 'tentative', no DAD is
executed and the address can't be pinged.

I also observed the same behaviour, without kvm, with virtual interfaces
types macvlan and veth.

Some easy steps to reproduce the issue with macvlan:

1. ip link add link eth0 type macvlan
2. ip -6 addr add 2003::ab32/64 dev macvlan0
3. ip addr show dev macvlan0
   ... 
   inet6 2003::ab32/64 scope global tentative
   ...
4. ip link set macvlan0 up
5. ip addr show dev macvlan0
   ...
   inet6 2003::ab32/64 scope global tentative
   ...
   Address is still tentative

I think there's a bug in net/ipv6/addrconf.c, addrconf_notify():
addrconf_dad_run() is not always run when the interface is flagged IF_READY.
Currently it is only run when receiving NETDEV_CHANGE event. Looks like
some (virtual) devices doesn't send this event when becoming up.

For both NETDEV_UP and NETDEV_CHANGE events, when the interface becomes
ready, run_pending should be set to 1. Patch below.

'run_pending = 1' could be moved below the if/else block but it makes 
the code less readable.

Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-05 01:43:57 -08:00
..
netfilter netfilter: xtables: provide invoked family value to extensions 2008-10-08 11:35:20 +02:00
addrconf_core.c
addrconf.c ipv6: fix run pending DAD when interface becomes ready 2008-11-05 01:43:57 -08:00
addrlabel.c
af_inet6.c netns: mib6 section fixlet 2008-10-13 18:54:07 -07:00
ah6.c
anycast.c
datagram.c
esp6.c
exthdrs_core.c
exthdrs.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
fib6_rules.c
icmp.c ipv6: added net argument to ICMP6MSGIN_INC_STATS_BH 2008-10-08 11:15:46 -07:00
inet6_connection_sock.c
inet6_hashtables.c
ip6_fib.c
ip6_flowlabel.c
ip6_input.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
ip6_output.c ipv6: added net argument to ICMP6MSGOUT_INC_STATS_BH 2008-10-08 11:15:05 -07:00
ip6_tunnel.c net: Use hton[sl]() instead of __constant_hton[sl]() where applicable 2008-09-20 22:20:49 -07:00
ip6mr.c ipv6: added net argument to IP6_INC_STATS_BH 2008-10-08 11:09:27 -07:00
ipcomp6.c
ipv6_sockglue.c
Kconfig
Makefile
mcast.c ipv6: added net argument to ICMP6MSGOUT_INC_STATS_BH 2008-10-08 11:15:05 -07:00
mip6.c
ndisc.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-10-16 11:26:26 -07:00
netfilter.c netns: correct mib stats in ip6_route_me_harder() 2008-10-14 22:55:21 -07:00
proc.c ipv6: making ip and icmp statistics per/namespace 2008-10-08 11:16:45 -07:00
protocol.c
raw.c netns: add net parameter to IP6_INC_STATS 2008-10-08 10:54:51 -07:00
reassembly.c ipv6: added net argument to IP6_ADD_STATS_BH 2008-10-08 11:13:31 -07:00
route.c netns: add net parameter to IP6_INC_STATS 2008-10-08 10:54:51 -07:00
sit.c
syncookies.c tcp: Fix IPv6 fallout from 'Port redirection support for TCP' 2008-10-19 23:35:58 -07:00
sysctl_net_ipv6.c ipv6: sysctl fixes 2008-08-25 15:18:15 -07:00
tcp_ipv6.c tcp: Fix IPv6 fallout from 'Port redirection support for TCP' 2008-10-19 23:35:58 -07:00
tunnel6.c
udp_impl.h
udp.c udp: Fix the SNMP counter of UDP_MIB_INERRORS 2008-11-02 23:52:46 -08:00
udplite.c netns: make uplitev6 mib per/namespace 2008-10-07 14:50:06 -07:00
xfrm6_input.c
xfrm6_mode_beet.c
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c
xfrm6_output.c
xfrm6_policy.c
xfrm6_state.c xfrm: Have af-specific init_tempsel() initialize family field of temporary selector 2008-11-04 14:49:19 -08:00
xfrm6_tunnel.c