changeset 5180:0e4f56cb4c03 draft

inet6: Expire ND on the second, not after it Otherwise the timing is slightly confused.
author Roy Marples <roy@marples.name>
date Wed, 29 Apr 2020 15:06:04 +0000
parents e241904845af
children 6788ac9191a7
files src/ipv6nd.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv6nd.c	Wed Apr 29 15:32:15 2020 +0100
+++ b/src/ipv6nd.c	Wed Apr 29 15:06:04 2020 +0000
@@ -647,7 +647,7 @@
 	};
 
 	TAILQ_FOREACH(rap, ifp->ctx->ra_routers, next) {
-		if (rap->iface == ifp && rap->lifetime != 0)
+		if (rap->iface == ifp && !rap->expired)
 			break;
 	}
 
@@ -1707,7 +1707,7 @@
 		if (rap->lifetime) {
 			elapsed = (uint32_t)eloop_timespec_diff(&now,
 			    &rap->acquired, NULL);
-			if (elapsed > rap->lifetime || rap->doexpire) {
+			if (elapsed >= rap->lifetime || rap->doexpire) {
 				if (!rap->expired) {
 					logwarnx("%s: %s: router expired",
 					    ifp->name, rap->sfrom);
@@ -1736,7 +1736,7 @@
 			}
 			elapsed = (uint32_t)eloop_timespec_diff(&now,
 			    &ia->acquired, NULL);
-			if (elapsed > ia->prefix_vltime || rap->doexpire) {
+			if (elapsed >= ia->prefix_vltime || rap->doexpire) {
 				if (ia->flags & IPV6_AF_ADDED) {
 					logwarnx("%s: expired %s %s",
 					    ia->iface->name,
@@ -1817,7 +1817,7 @@
 			}
 
 			ltime = ntohl(ltime);
-			if (elapsed > ltime) {
+			if (elapsed >= ltime) {
 				expired = true;
 				continue;
 			}