Module Name: src Committed By: ozaki-r Date: Tue Jul 1 07:51:29 UTC 2014
Modified Files: src/sys/netinet6: in6.c nd6_nbr.c Log Message: 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. Discussed in http://mail-index.netbsd.org/tech-kern/2014/06/25/msg017278.html To generate a diff of this commit: cvs rdiff -u -r1.172 -r1.173 src/sys/netinet6/in6.c cvs rdiff -u -r1.99 -r1.100 src/sys/netinet6/nd6_nbr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/in6.c diff -u src/sys/netinet6/in6.c:1.172 src/sys/netinet6/in6.c:1.173 --- src/sys/netinet6/in6.c:1.172 Tue Jul 1 05:49:19 2014 +++ src/sys/netinet6/in6.c Tue Jul 1 07:51:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.172 2014/07/01 05:49:19 rtr Exp $ */ +/* $NetBSD: in6.c,v 1.173 2014/07/01 07:51:29 ozaki-r Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.172 2014/07/01 05:49:19 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.173 2014/07/01 07:51:29 ozaki-r Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -1331,7 +1331,8 @@ in6_update_ifa1(struct ifnet *ifp, struc 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; @@ -2155,15 +2156,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); } } Index: src/sys/netinet6/nd6_nbr.c diff -u src/sys/netinet6/nd6_nbr.c:1.99 src/sys/netinet6/nd6_nbr.c:1.100 --- src/sys/netinet6/nd6_nbr.c:1.99 Mon Jan 13 18:23:36 2014 +++ src/sys/netinet6/nd6_nbr.c Tue Jul 1 07:51:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.99 2014/01/13 18:23:36 roy Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.100 2014/07/01 07:51:29 ozaki-r Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.99 2014/01/13 18:23:36 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.100 2014/07/01 07:51:29 ozaki-r Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -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