changeset 4759:2e62e5b3a0db draft

inet6: Fix a potential crash learning addresses Interface maybe active but without options. In this case, check the global state of IPv6.
author Roy Marples <roy@marples.name>
date Mon, 14 Oct 2019 16:01:00 +0100
parents 750d4c1a26cb
children df9aadb7dd13
files src/ipv6.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv6.c	Fri Oct 11 11:37:10 2019 +0100
+++ b/src/ipv6.c	Mon Oct 14 16:01:00 2019 +0100
@@ -1253,7 +1253,9 @@
 	 * 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);