changeset 5178:fbe055b8e53d draft

Linux: Only set positive reachable timers
author Roy Marples <roy@marples.name>
date Wed, 29 Apr 2020 15:31:49 +0100
parents 1d16a9434290
children e241904845af
files src/if-linux.c
diffstat 1 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-linux.c	Wed Apr 29 14:55:23 2020 +0100
+++ b/src/if-linux.c	Wed Apr 29 15:31:49 2020 +0100
@@ -2007,18 +2007,25 @@
 	struct dhcpcd_ctx *ctx = rap->iface->ctx;
 	int error = 0;
 
-	snprintf(path, sizeof(path), "%s/%s/hop_limit", p_conf, ifname);
-	if (if_writepathuint(ctx, path, rap->hoplimit) == -1)
-		error = -1;
+	if (rap->hoplimit != 0) {
+		snprintf(path, sizeof(path), "%s/%s/hop_limit", p_conf, ifname);
+		if (if_writepathuint(ctx, path, rap->hoplimit) == -1)
+			error = -1;
+	}
 
-	snprintf(path, sizeof(path), "%s/%s/retrans_time_ms", p_neigh, ifname);
-	if (if_writepathuint(ctx, path, rap->retrans) == -1)
-		error = -1;
+	if (rap->retrans != 0) {
+		snprintf(path, sizeof(path), "%s/%s/retrans_time_ms",
+		    p_neigh, ifname);
+		if (if_writepathuint(ctx, path, rap->retrans) == -1)
+			error = -1;
+	}
 
-	snprintf(path, sizeof(path), "%s/%s/base_reachable_time_ms",
-	    p_neigh, ifname);
-	if (if_writepathuint(ctx, path, rap->reachable) == -1)
-		error = -1;
+	if (rap->reachable != 0) {
+		snprintf(path, sizeof(path), "%s/%s/base_reachable_time_ms",
+		    p_neigh, ifname);
+		if (if_writepathuint(ctx, path, rap->reachable) == -1)
+			error = -1;
+	}
 
 	return error;
 }