commit e6b500d56c4ffed25a49c49612039969a9a1f8f4 Author: Ryota Ozaki Date: Mon Jun 30 13:04:10 2014 +0900 Stop using callout randomly nd6_dad_start uses callout when xtick > 0 while doesn't when xtick == 0. So if we pass a random value ranging from 0 to N, nd6_dad_start uses callout randomly. This behavior makes debugging difficult. diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 9397bfe..2302274 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1333,7 +1333,8 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra, mindelay; } } - nd6_dad_start(&ia->ia_ifa, dad_delay); + /* +1 ensures callout is always used */ + nd6_dad_start(&ia->ia_ifa, dad_delay + 1); } return error; @@ -2157,15 +2158,17 @@ in6_if_link_up(struct ifnet *ifp) } if (ia->ia6_flags & IN6_IFF_TENTATIVE) { + int delay; /* * The TENTATIVE flag was likely set by hand * beforehand, implicitly indicating the need for DAD. * We may be able to skip the random delay in this * case, but we impose delays just in case. */ - nd6_dad_start(ifa, - cprng_fast32() % - (MAX_RTR_SOLICITATION_DELAY * hz)); + delay = cprng_fast32() % + (MAX_RTR_SOLICITATION_DELAY * hz); + /* +1 ensures callout is always used */ + nd6_dad_start(ifa, delay + 1); } } diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index f00b218..0b7a086 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1097,6 +1097,8 @@ nd6_newaddrmsg(struct ifaddr *ifa) /* * Start Duplicate Address Detection (DAD) for specified interface address. * + * Note that callout is used when xtick > 0 and not when xtick == 0. + * * xtick: minimum delay ticks for IFF_UP event */ void