changeset 2459:4d3db760a69a draft

When a node first becomes stale, fire off a NS probe anyway. This is outside of the RFC, but it seems that some nodes do not respond with a NA fast enough to avoid log spam.
author Roy Marples <roy@marples.name>
date Fri, 02 May 2014 14:23:41 +0000
parents 4050e5af02d9
children eb924f20114f
files ipv6nd.c
diffstat 1 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ipv6nd.c	Fri May 02 12:31:21 2014 +0000
+++ b/ipv6nd.c	Fri May 02 14:23:41 2014 +0000
@@ -1176,21 +1176,19 @@
 		return;
 	}
 
-	ms_to_tv(&tv, rap->retrans ? rap->retrans :  RETRANS_TIMER);
-	eloop_timeout_add_tv(rap->iface->ctx->eloop, &tv,
-	    ++rap->nsprobes < MAX_UNICAST_SOLICIT ?
-	    ipv6nd_proberouter : ipv6nd_unreachable,
-	    rap);
-}
-
-static void
-ipv6nd_stalerouter(void *arg)
-{
-	struct ra *rap = arg;
-
-	rap->nsprobes = 0;
-	eloop_timeout_add_sec(rap->iface->ctx->eloop, DELAY_FIRST_PROBE_TIME,
-	    ipv6nd_proberouter, rap);
+	if (rap->nsprobes++ == 0)
+		eloop_timeout_add_sec(rap->iface->ctx->eloop,
+		    DELAY_FIRST_PROBE_TIME,
+		    ipv6nd_proberouter, rap);
+	else {
+		/* MAX_UNICAST_PROBES applies to this retrans loop,
+		 * so take one away for the above DELAY probe */
+		ms_to_tv(&tv, rap->retrans ? rap->retrans :  RETRANS_TIMER);
+		eloop_timeout_add_tv(rap->iface->ctx->eloop, &tv,
+		    rap->nsprobes <= MAX_UNICAST_SOLICIT ?
+		    ipv6nd_proberouter : ipv6nd_unreachable,
+		    rap);
+	}
 }
 
 static void
@@ -1198,7 +1196,6 @@
 {
 
 	eloop_timeout_delete(rap->iface->ctx->eloop, ipv6nd_proberouter, rap);
-	eloop_timeout_delete(rap->iface->ctx->eloop, ipv6nd_stalerouter, rap);
 	eloop_timeout_delete(rap->iface->ctx->eloop, ipv6nd_unreachable, rap);
 }
 
@@ -1209,6 +1206,7 @@
 	struct timeval tv, rtv;
 
 	ipv6nd_cancelproberouter(rap);
+	rap->nsprobes = 0;
 
 	ms_to_tv(&tv, rap->reachable ? rap->reachable : REACHABLE_TIME);
 	ms_to_tv(&rtv, MIN_RANDOM_FACTOR);
@@ -1217,7 +1215,7 @@
 	rtv.tv_usec = arc4random() % (MAX_RANDOM_FACTOR_U -MIN_RANDOM_FACTOR_U);
 	timeradd(&tv, &rtv, &tv);
 	eloop_timeout_add_tv(rap->iface->ctx->eloop,
-	    &tv, ipv6nd_stalerouter, rap);
+	    &tv, ipv6nd_proberouter, rap);
 }
 
 void