Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Stop using callout randomly
details: https://anonhg.NetBSD.org/src/rev/8662c4ce1552
branches: trunk
changeset: 330249:8662c4ce1552
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Jul 01 07:51:29 2014 +0000
description:
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
diffstat:
sys/netinet6/in6.c | 15 +++++++++------
sys/netinet6/nd6_nbr.c | 6 ++++--
2 files changed, 13 insertions(+), 8 deletions(-)
diffs (76 lines):
diff -r aa0b62c32342 -r 8662c4ce1552 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Tue Jul 01 05:49:18 2014 +0000
+++ b/sys/netinet6/in6.c Tue Jul 01 07:51:29 2014 +0000
@@ -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 @@
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 @@
}
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 -r aa0b62c32342 -r 8662c4ce1552 sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c Tue Jul 01 05:49:18 2014 +0000
+++ b/sys/netinet6/nd6_nbr.c Tue Jul 01 07:51:29 2014 +0000
@@ -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 @@
/*
* 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
Home |
Main Index |
Thread Index |
Old Index