]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure that the IPv6 link-local address always uses the secret key at startup.
authorRoy Marples <roy@marples.name>
Mon, 5 Sep 2016 15:57:30 +0000 (15:57 +0000)
committerRoy Marples <roy@marples.name>
Mon, 5 Sep 2016 15:57:30 +0000 (15:57 +0000)
ipv6.c

diff --git a/ipv6.c b/ipv6.c
index 93ce3dd71711d9062d25171b1246e6f3d7033743..0df156ca9fff6813e9cd1494dc4d6b08b2f173c4 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -339,6 +339,11 @@ ipv6_makestableprivate(struct in6_addr *addr,
        uint32_t dad;
        int r;
 
+       if (ifp->ctx->secret_len == 0) {
+               if (ipv6_readsecret(ifp->ctx) == -1)
+                       return -1;
+       }
+
        dad = (uint32_t)*dad_counter;
 
        /* For our implementation, we shall set the hardware address
@@ -367,10 +372,6 @@ ipv6_makeaddr(struct in6_addr *addr, struct interface *ifp,
        }
 
        if (ifp->options->options & DHCPCD_SLAACPRIVATE) {
-               if (ifp->ctx->secret_len == 0) {
-                       if (ipv6_readsecret(ifp->ctx) == -1)
-                               return -1;
-               }
                dad = 0;
                if (ipv6_makestableprivate(addr,
                    prefix, prefix_len, ifp, &dad) == -1)