]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When a node first becomes stale, fire off a NS probe anyway.
authorRoy Marples <roy@marples.name>
Fri, 2 May 2014 14:23:41 +0000 (14:23 +0000)
committerRoy Marples <roy@marples.name>
Fri, 2 May 2014 14:23:41 +0000 (14:23 +0000)
This is outside of the RFC, but it seems that some nodes do not
respond with a NA fast enough to avoid log spam.

ipv6nd.c

index 67db4aed0eecf6c05b08b4253fb770b303cc8047..233b3ac491701f4a2e821002b29988c08abbf524 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -1176,21 +1176,19 @@ ipv6nd_proberouter(void *arg)
                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 @@ ipv6nd_cancelproberouter(struct ra *rap)
 {
 
        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 @@ ipv6nd_startproberouter(struct ra *rap)
        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 @@ ipv6nd_startproberouter(struct ra *rap)
        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