changeset 4913:2a2b2920bc58 draft

Linux: fix RA time unit confusion The RA times are provided in milliseconds, but commit 569051c8aa8fc297eb8edb7bd228e0fd353d30c1 (dhcpcd-8.1.3~18) ?Linux: prefer ms RA times? incorrectly scaled them by an extra factor of 1000 before writing them to retrans_time_ms and base_reachable_time_ms. Instead, write the values in milliseconds directly to the *_ms files. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
author Anders Kaseorg <andersk@mit.edu>
date Wed, 01 Jan 2020 11:42:47 -0800
parents 647f69cff6bb
children c7d67a898092
files src/if-linux.c src/ipv6nd.c
diffstat 2 files changed, 6 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-linux.c	Fri Dec 20 22:12:04 2019 +0000
+++ b/src/if-linux.c	Wed Jan 01 11:42:47 2020 -0800
@@ -1898,22 +1898,14 @@
 		error = -1;
 
 	snprintf(path, sizeof(path), "%s/%s/retrans_time_ms", p_neigh, ifname);
-	if (if_writepathuint(path, rap->retrans * 1000) == -1) {
-		snprintf(path, sizeof(path), "%s/%s/retrans_time",
-		    p_neigh, ifname);
-		/* Jiffies */
-		if (if_writepathuint(path, rap->retrans * 100) == -1)
-			error = -1;
-	}
+	if (if_writepathuint(path, rap->retrans) == -1)
+		error = -1;
 
 	snprintf(path, sizeof(path), "%s/%s/base_reachable_time_ms",
 	    p_neigh, ifname);
-	if (if_writepathuint(path, rap->reachable * 1000) == -1) {
-		snprintf(path, sizeof(path), "%s/%s/base_reachable_time",
-		    p_neigh, ifname);
-		if (if_writepathuint(path, rap->reachable) == -1)
-			error = -1;
-	}
+	if (if_writepathuint(path, rap->reachable) == -1)
+		error = -1;
+
 	return error;
 }
 
--- a/src/ipv6nd.c	Fri Dec 20 22:12:04 2019 +0000
+++ b/src/ipv6nd.c	Wed Jan 01 11:42:47 2020 -0800
@@ -622,7 +622,7 @@
 		return;
 
 	state->retrans = rap->retrans;
-	if (if_applyra(rap) == -1)
+	if (if_applyra(rap) == -1 && errno != ENOENT)
 		logerr(__func__);
 }