@@ -186,7 +186,8 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
186
186
187
187
static void addrconf_dad_start (struct inet6_ifaddr * ifp );
188
188
static 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 );
190
191
static void addrconf_dad_run (struct inet6_dev * idev );
191
192
static void addrconf_rs_timer (struct timer_list * t );
192
193
static void __ipv6_ifa_notify (int event , struct inet6_ifaddr * ifa );
@@ -3838,12 +3839,17 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp)
3838
3839
idev -> cnf .accept_dad < 1 ) ||
3839
3840
!(ifp -> flags & IFA_F_TENTATIVE ) ||
3840
3841
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;
3841
3847
bump_id = ifp -> flags & IFA_F_TENTATIVE ;
3842
3848
ifp -> flags &= ~(IFA_F_TENTATIVE |IFA_F_OPTIMISTIC |IFA_F_DADFAILED );
3843
3849
spin_unlock (& ifp -> lock );
3844
3850
read_unlock_bh (& idev -> lock );
3845
3851
3846
- addrconf_dad_completed (ifp , bump_id );
3852
+ addrconf_dad_completed (ifp , bump_id , send_na );
3847
3853
return ;
3848
3854
}
3849
3855
@@ -3972,16 +3978,21 @@ static void addrconf_dad_work(struct work_struct *w)
3972
3978
}
3973
3979
3974
3980
if (ifp -> dad_probes == 0 ) {
3981
+ bool send_na = false;
3982
+
3975
3983
/*
3976
3984
* DAD was successful
3977
3985
*/
3978
3986
3987
+ if (ifp -> flags & IFA_F_TENTATIVE &&
3988
+ !(ifp -> flags & IFA_F_OPTIMISTIC ))
3989
+ send_na = true;
3979
3990
bump_id = ifp -> flags & IFA_F_TENTATIVE ;
3980
3991
ifp -> flags &= ~(IFA_F_TENTATIVE |IFA_F_OPTIMISTIC |IFA_F_DADFAILED );
3981
3992
spin_unlock (& ifp -> lock );
3982
3993
write_unlock_bh (& idev -> lock );
3983
3994
3984
- addrconf_dad_completed (ifp , bump_id );
3995
+ addrconf_dad_completed (ifp , bump_id , send_na );
3985
3996
3986
3997
goto out ;
3987
3998
}
@@ -4019,7 +4030,8 @@ static bool ipv6_lonely_lladdr(struct inet6_ifaddr *ifp)
4019
4030
return true;
4020
4031
}
4021
4032
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 )
4023
4035
{
4024
4036
struct net_device * dev = ifp -> idev -> dev ;
4025
4037
struct in6_addr lladdr ;
@@ -4051,6 +4063,16 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id)
4051
4063
if (send_mld )
4052
4064
ipv6_mc_dad_complete (ifp -> idev );
4053
4065
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
+
4054
4076
if (send_rs ) {
4055
4077
/*
4056
4078
* If a host as already performed a random delay
0 commit comments