]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
inet6: Fix a potential crash learning addresses
authorRoy Marples <roy@marples.name>
Mon, 14 Oct 2019 15:01:00 +0000 (16:01 +0100)
committerRoy Marples <roy@marples.name>
Mon, 14 Oct 2019 15:01:00 +0000 (16:01 +0100)
Interface maybe active but without options.
In this case, check the global state of IPv6.

src/ipv6.c

index 99f6a8a423256b44c55e7633b738fcc354e781ed..8a77a40127d02884dae69f5cceaf4ae1b81a13a6 100644 (file)
@@ -1253,7 +1253,9 @@ out:
         * or DHCP6 handlers and the existance of any useable
         * global address on the interface has changed,
         * call rt_build to add/remove the default route. */
-       if (ifp->active && ifp->options->options & DHCPCD_IPV6 &&
+       if (ifp->active &&
+           ((ifp->options != NULL && ifp->options->options & DHCPCD_IPV6) ||
+            (ifp->options == NULL && ctx->options & DHCPCD_IPV6)) &&
            !(ctx->options & DHCPCD_RTBUILD) &&
            (ipv6_anyglobal(ifp) != NULL) != anyglobal)
                rt_build(ctx, AF_INET6);