diff options
| author | Roy Marples <roy@marples.name> | 2020-04-29 15:31:49 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-04-29 15:31:49 +0100 |
| commit | ab2506ce66c6ac7bdc5a2b3f1c9bf3470583daa7 (patch) | |
| tree | 41ff0d72c4015cef0b0bfb954572116a13089481 /src | |
| parent | 73d2624f5740d8d219f6bf09fb881a684b7e0944 (diff) | |
| download | dhcpcd-ab2506ce66c6ac7bdc5a2b3f1c9bf3470583daa7.tar.xz | |
Linux: Only set positive reachable timers
Diffstat (limited to 'src')
| -rw-r--r-- | src/if-linux.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/if-linux.c b/src/if-linux.c index c2e7b9a7..cc59e572 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -2007,18 +2007,25 @@ if_applyra(const struct ra *rap) 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; - - 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->hoplimit != 0) { + snprintf(path, sizeof(path), "%s/%s/hop_limit", p_conf, ifname); + if (if_writepathuint(ctx, path, rap->hoplimit) == -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; + } + + 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; } |
