[IPV6]: Run DAD when the link becomes ready.

If the link was not available when the interface was created,
run DAD for pending tentative addresses when the link becomes ready.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

+23
+23
net/ipv6/addrconf.c
··· 137 137 static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags); 138 138 static void addrconf_dad_timer(unsigned long data); 139 139 static void addrconf_dad_completed(struct inet6_ifaddr *ifp); 140 + static void addrconf_dad_run(struct inet6_dev *idev); 140 141 static void addrconf_rs_timer(unsigned long data); 141 142 static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); 142 143 static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); ··· 419 418 if ((idev = ipv6_add_dev(dev)) == NULL) 420 419 return NULL; 421 420 } 421 + 422 422 if (dev->flags&IFF_UP) 423 423 ipv6_mc_up(idev); 424 424 return idev; ··· 2142 2140 { 2143 2141 struct net_device *dev = (struct net_device *) data; 2144 2142 struct inet6_dev *idev = __in6_dev_get(dev); 2143 + int run_pending = 0; 2145 2144 2146 2145 switch(event) { 2147 2146 case NETDEV_UP: ··· 2175 2172 "link becomes ready\n", 2176 2173 dev->name); 2177 2174 2175 + run_pending = 1; 2178 2176 } 2179 2177 2180 2178 switch(dev->type) { ··· 2194 2190 break; 2195 2191 }; 2196 2192 if (idev) { 2193 + if (run_pending) 2194 + addrconf_dad_run(idev); 2195 + 2197 2196 /* If the MTU changed during the interface down, when the 2198 2197 interface up, the changed MTU must be reflected in the 2199 2198 idev as well as routers. ··· 2551 2544 addrconf_mod_timer(ifp, AC_RS, ifp->idev->cnf.rtr_solicit_interval); 2552 2545 spin_unlock_bh(&ifp->lock); 2553 2546 } 2547 + } 2548 + 2549 + static void addrconf_dad_run(struct inet6_dev *idev) { 2550 + struct inet6_ifaddr *ifp; 2551 + 2552 + read_lock_bh(&idev->lock); 2553 + for (ifp = idev->addr_list; ifp; ifp = ifp->if_next) { 2554 + spin_lock_bh(&ifp->lock); 2555 + if (!(ifp->flags & IFA_F_TENTATIVE)) { 2556 + spin_unlock_bh(&ifp->lock); 2557 + continue; 2558 + } 2559 + spin_unlock_bh(&ifp->lock); 2560 + addrconf_dad_kick(ifp); 2561 + } 2562 + read_unlock_bh(&idev->lock); 2554 2563 } 2555 2564 2556 2565 #ifdef CONFIG_PROC_FS