]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Linux: fix RA time unit confusion
authorAnders Kaseorg <andersk@mit.edu>
Wed, 1 Jan 2020 19:42:47 +0000 (11:42 -0800)
committerRoy Marples <roy@marples.name>
Wed, 1 Jan 2020 22:49:29 +0000 (22:49 +0000)
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>
src/if-linux.c
src/ipv6nd.c

index ccfad8de6ebd22b0681648102a17f8ec383a7eaf..6719e48771fdf1dd24e6146a7715889aa0f71f3d 100644 (file)
@@ -1898,22 +1898,14 @@ if_applyra(const struct ra *rap)
                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;
 }
 
index 14a357f74de7a9338c1d94f6fafd4fb9d4011502..798f23b7449e9809bb05e110d075b5d5bbbbf8e7 100644 (file)
@@ -622,7 +622,7 @@ ipv6nd_applyra(struct dhcpcd_ctx *ctx, struct interface *ifp)
                return;
 
        state->retrans = rap->retrans;
-       if (if_applyra(rap) == -1)
+       if (if_applyra(rap) == -1 && errno != ENOENT)
                logerr(__func__);
 }