@@ -186,7 +186,8 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
186186
187187static void addrconf_dad_start (struct inet6_ifaddr * ifp );
188188static void addrconf_dad_work (struct work_struct * w );
189- static void addrconf_dad_completed (struct inet6_ifaddr * ifp , bool bump_id );
189+ static void addrconf_dad_completed (struct inet6_ifaddr * ifp , bool bump_id ,
190+ bool send_na );
190191static void addrconf_dad_run (struct inet6_dev * idev );
191192static void addrconf_rs_timer (struct timer_list * t );
192193static void __ipv6_ifa_notify (int event , struct inet6_ifaddr * ifa );
@@ -3838,12 +3839,17 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp)
38383839 idev -> cnf .accept_dad < 1 ) ||
38393840 !(ifp -> flags & IFA_F_TENTATIVE ) ||
38403841 ifp -> flags & IFA_F_NODAD ) {
3842+ bool send_na = false;
3843+
3844+ if (ifp -> flags & IFA_F_TENTATIVE &&
3845+ !(ifp -> flags & IFA_F_OPTIMISTIC ))
3846+ send_na = true;
38413847 bump_id = ifp -> flags & IFA_F_TENTATIVE ;
38423848 ifp -> flags &= ~(IFA_F_TENTATIVE |IFA_F_OPTIMISTIC |IFA_F_DADFAILED );
38433849 spin_unlock (& ifp -> lock );
38443850 read_unlock_bh (& idev -> lock );
38453851
3846- addrconf_dad_completed (ifp , bump_id );
3852+ addrconf_dad_completed (ifp , bump_id , send_na );
38473853 return ;
38483854 }
38493855
@@ -3972,16 +3978,21 @@ static void addrconf_dad_work(struct work_struct *w)
39723978 }
39733979
39743980 if (ifp -> dad_probes == 0 ) {
3981+ bool send_na = false;
3982+
39753983 /*
39763984 * DAD was successful
39773985 */
39783986
3987+ if (ifp -> flags & IFA_F_TENTATIVE &&
3988+ !(ifp -> flags & IFA_F_OPTIMISTIC ))
3989+ send_na = true;
39793990 bump_id = ifp -> flags & IFA_F_TENTATIVE ;
39803991 ifp -> flags &= ~(IFA_F_TENTATIVE |IFA_F_OPTIMISTIC |IFA_F_DADFAILED );
39813992 spin_unlock (& ifp -> lock );
39823993 write_unlock_bh (& idev -> lock );
39833994
3984- addrconf_dad_completed (ifp , bump_id );
3995+ addrconf_dad_completed (ifp , bump_id , send_na );
39853996
39863997 goto out ;
39873998 }
@@ -4019,7 +4030,8 @@ static bool ipv6_lonely_lladdr(struct inet6_ifaddr *ifp)
40194030 return true;
40204031}
40214032
4022- static void addrconf_dad_completed (struct inet6_ifaddr * ifp , bool bump_id )
4033+ static void addrconf_dad_completed (struct inet6_ifaddr * ifp , bool bump_id ,
4034+ bool send_na )
40234035{
40244036 struct net_device * dev = ifp -> idev -> dev ;
40254037 struct in6_addr lladdr ;
@@ -4051,6 +4063,16 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id)
40514063 if (send_mld )
40524064 ipv6_mc_dad_complete (ifp -> idev );
40534065
4066+ /* send unsolicited NA if enabled */
4067+ if (send_na &&
4068+ (ifp -> idev -> cnf .ndisc_notify ||
4069+ dev_net (dev )-> ipv6 .devconf_all -> ndisc_notify )) {
4070+ ndisc_send_na (dev , & in6addr_linklocal_allnodes , & ifp -> addr ,
4071+ /*router=*/ !!ifp -> idev -> cnf .forwarding ,
4072+ /*solicited=*/ false, /*override=*/ true,
4073+ /*inc_opt=*/ true);
4074+ }
4075+
40544076 if (send_rs ) {
40554077 /*
40564078 * If a host as already performed a random delay
0 commit comments