Wed Oct 16 17:41:40 2019 UTC ()
Pull up the following revisions, requested by roy in ticket #340:

	external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.32
	external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.29
	external/bsd/dhcpcd/dist/src/dhcpcd.c           up to 1.28
	external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.6
	src/doc/3RDPARTY				(manually edited)

Import dhcpcd-8.1.1 with the following changes:

 * IPv6: Fix a potential crash when learning interface addresses.
 * DHCP: Fix fallout from dhcpcd-8.1.0 for checksum calculation.


(martin)
diff -r1.1640.2.4 -r1.1640.2.5 src/doc/3RDPARTY
diff -r1.1.1.25.2.2 -r1.1.1.25.2.3 src/external/bsd/dhcpcd/dist/src/defs.h
diff -r1.23.2.2 -r1.23.2.3 src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -r1.23.2.2 -r1.23.2.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -r1.3.2.2 -r1.3.2.3 src/external/bsd/dhcpcd/dist/src/ipv6.c

cvs diff -r1.1640.2.4 -r1.1640.2.5 src/doc/3RDPARTY (expand / switch to unified diff)

--- src/doc/3RDPARTY 2019/10/12 14:44:31 1.1640.2.4
+++ src/doc/3RDPARTY 2019/10/16 17:41:40 1.1640.2.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: 3RDPARTY,v 1.1640.2.4 2019/10/12 14:44:31 martin Exp $ 1# $NetBSD: 3RDPARTY,v 1.1640.2.5 2019/10/16 17:41:40 martin Exp $
2# 2#
3# This file contains a list of the software that has been integrated into 3# This file contains a list of the software that has been integrated into
4# NetBSD where we are not the primary maintainer. 4# NetBSD where we are not the primary maintainer.
5# 5#
6# When you make changes to this software, be sure to discuss it with the 6# When you make changes to this software, be sure to discuss it with the
7# maintainer and contribute your patches. Divergence from the official 7# maintainer and contribute your patches. Divergence from the official
8# sources is not desirable, and should be avoided as much as possible. 8# sources is not desirable, and should be avoided as much as possible.
9# 9#
10# When importing, please deal with the RCS IDs in this way: 10# When importing, please deal with the RCS IDs in this way:
11# 1. Preserve the RCS IDs in the files by removing the $ signs from 11# 1. Preserve the RCS IDs in the files by removing the $ signs from
12# the IDs before you do the import. 12# the IDs before you do the import.
13# 2. After the import, add NetBSD RCS IDs to all of the files. 13# 2. After the import, add NetBSD RCS IDs to all of the files.
14# 14#
@@ -331,32 +331,32 @@ Archive Site: ftp://ftp.isc.org/isc/dhcp @@ -331,32 +331,32 @@ Archive Site: ftp://ftp.isc.org/isc/dhcp
331Home Page: http://www.isc.org/software/dhcp/ 331Home Page: http://www.isc.org/software/dhcp/
332Date: 2019-01-09 332Date: 2019-01-09
333Mailing List: dhcp-server@isc.org 333Mailing List: dhcp-server@isc.org
334Mailing List: dhcp-client@isc.org 334Mailing List: dhcp-client@isc.org
335Mailing List: dhcp-announce@isc.org 335Mailing List: dhcp-announce@isc.org
336Mailing List: dhcp-bugs@isc.org 336Mailing List: dhcp-bugs@isc.org
337Responsible: mellon 337Responsible: mellon
338License: MPL 338License: MPL
339Location: external/mpl/dhcp 339Location: external/mpl/dhcp
340Notes: 340Notes:
341Use the dhcp2netbsd script. 341Use the dhcp2netbsd script.
342 342
343Package: dhcpcd 343Package: dhcpcd
344Version: 8.1.0 344Version: 8.1.1
345Current Vers: 8.1.0 345Current Vers: 8.1.1
346Maintainer: roy 346Maintainer: roy
347Archive Site: ftp://roy.marples.name/pub/dhcpcd/ 347Archive Site: ftp://roy.marples.name/pub/dhcpcd/
348Home Page: http://roy.marples.name/projects/dhcpcd/ 348Home Page: http://roy.marples.name/projects/dhcpcd/
349Date: 2019-10-12 349Date: 2019-10-16
350Mailing List: dhcpcd-discuss@marples.name 350Mailing List: dhcpcd-discuss@marples.name
351License: BSD (2-clause) 351License: BSD (2-clause)
352Location: external/bsd/dhcpcd/dist 352Location: external/bsd/dhcpcd/dist
353Notes: 353Notes:
354Please submit all changes to the author. 354Please submit all changes to the author.
355 355
356Package: drm 356Package: drm
357Version: Linux 3.15 357Version: Linux 3.15
358Current Vers: ? 358Current Vers: ?
359Maintainer: Intel, AMD, Linux kernel developers 359Maintainer: Intel, AMD, Linux kernel developers
360Archive Site: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 360Archive Site: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
361Home Page: http://dri.freedesktop.org/ 361Home Page: http://dri.freedesktop.org/
362Mailing List: dri-devel@lists.freedesktop.org 362Mailing List: dri-devel@lists.freedesktop.org

cvs diff -r1.1.1.25.2.2 -r1.1.1.25.2.3 src/external/bsd/dhcpcd/dist/src/defs.h (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/defs.h 2019/10/12 14:44:32 1.1.1.25.2.2
+++ src/external/bsd/dhcpcd/dist/src/defs.h 2019/10/16 17:41:40 1.1.1.25.2.3
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28#ifndef CONFIG_H 28#ifndef CONFIG_H
29#define CONFIG_H 29#define CONFIG_H
30 30
31#define PACKAGE "dhcpcd" 31#define PACKAGE "dhcpcd"
32#define VERSION "8.1.0" 32#define VERSION "8.1.1"
33 33
34#ifndef CONFIG 34#ifndef CONFIG
35# define CONFIG SYSCONFDIR "/" PACKAGE ".conf" 35# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
36#endif 36#endif
37#ifndef SCRIPT 37#ifndef SCRIPT
38# define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks" 38# define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks"
39#endif 39#endif
40#ifndef DEVDIR 40#ifndef DEVDIR
41# define DEVDIR LIBDIR "/" PACKAGE "/dev" 41# define DEVDIR LIBDIR "/" PACKAGE "/dev"
42#endif 42#endif
43#ifndef DUID 43#ifndef DUID
44# define DUID DBDIR "/duid" 44# define DUID DBDIR "/duid"
45#endif 45#endif

cvs diff -r1.23.2.2 -r1.23.2.3 src/external/bsd/dhcpcd/dist/src/dhcp.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/dhcp.c 2019/10/12 14:44:32 1.23.2.2
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c 2019/10/16 17:41:40 1.23.2.3
@@ -154,28 +154,26 @@ dhcp_printoptions(const struct dhcpcd_ct @@ -154,28 +154,26 @@ dhcp_printoptions(const struct dhcpcd_ct
154 if (opt->option == opt2->option) 154 if (opt->option == opt2->option)
155 break; 155 break;
156 if (j == opts_len) { 156 if (j == opts_len) {
157 cols = printf("%03d %s", opt->option, opt->var); 157 cols = printf("%03d %s", opt->option, opt->var);
158 dhcp_print_option_encoding(opt, cols); 158 dhcp_print_option_encoding(opt, cols);
159 } 159 }
160 } 160 }
161 for (i = 0, opt = opts; i < opts_len; i++, opt++) { 161 for (i = 0, opt = opts; i < opts_len; i++, opt++) {
162 cols = printf("%03d %s", opt->option, opt->var); 162 cols = printf("%03d %s", opt->option, opt->var);
163 dhcp_print_option_encoding(opt, cols); 163 dhcp_print_option_encoding(opt, cols);
164 } 164 }
165} 165}
166 166
167#define get_option_raw(ctx, bootp, bootp_len, opt) \ 
168 get_option((ctx), (bootp), (bootp_len), NULL) 
169static const uint8_t * 167static const uint8_t *
170get_option(struct dhcpcd_ctx *ctx, 168get_option(struct dhcpcd_ctx *ctx,
171 const struct bootp *bootp, size_t bootp_len, 169 const struct bootp *bootp, size_t bootp_len,
172 unsigned int opt, size_t *opt_len) 170 unsigned int opt, size_t *opt_len)
173{ 171{
174 const uint8_t *p, *e; 172 const uint8_t *p, *e;
175 uint8_t l, o, ol, overl, *bp; 173 uint8_t l, o, ol, overl, *bp;
176 const uint8_t *op; 174 const uint8_t *op;
177 size_t bl; 175 size_t bl;
178 176
179 /* Check we have the magic cookie */ 177 /* Check we have the magic cookie */
180 if (!IS_DHCP(bootp)) { 178 if (!IS_DHCP(bootp)) {
181 errno = ENOTSUP; 179 errno = ENOTSUP;
@@ -3265,91 +3263,113 @@ get_udp_data(void *packet, size_t *len) @@ -3265,91 +3263,113 @@ get_udp_data(void *packet, size_t *len)
3265 size_t ip_hl = (size_t)ip->ip_hl * 4; 3263 size_t ip_hl = (size_t)ip->ip_hl * 4;
3266 char *p = packet; 3264 char *p = packet;
3267 3265
3268 p += ip_hl + sizeof(struct udphdr); 3266 p += ip_hl + sizeof(struct udphdr);
3269 *len = (size_t)ntohs(ip->ip_len) - sizeof(struct udphdr) - ip_hl; 3267 *len = (size_t)ntohs(ip->ip_len) - sizeof(struct udphdr) - ip_hl;
3270 return p; 3268 return p;
3271} 3269}
3272 3270
3273static bool 3271static bool
3274is_packet_udp_bootp(void *packet, size_t plen) 3272is_packet_udp_bootp(void *packet, size_t plen)
3275{ 3273{
3276 struct ip *ip = packet; 3274 struct ip *ip = packet;
3277 size_t ip_hlen; 3275 size_t ip_hlen;
3278 struct udphdr *udp; 3276 struct udphdr udp;
3279 3277
3280 if (sizeof(*ip) > plen) 3278 if (plen < sizeof(*ip))
3281 return false; 3279 return false;
3282 3280
3283 if (ip->ip_v != IPVERSION || ip->ip_p != IPPROTO_UDP) 3281 if (ip->ip_v != IPVERSION || ip->ip_p != IPPROTO_UDP)
3284 return false; 3282 return false;
3285 3283
3286 /* Sanity. */ 3284 /* Sanity. */
3287 if (ntohs(ip->ip_len) != plen) 3285 if (ntohs(ip->ip_len) > plen)
3288 return false; 3286 return false;
3289 3287
3290 ip_hlen = (size_t)ip->ip_hl * 4; 3288 ip_hlen = (size_t)ip->ip_hl * 4;
 3289 if (ip_hlen < sizeof(*ip))
 3290 return false;
 3291
3291 /* Check we have a UDP header and BOOTP. */ 3292 /* Check we have a UDP header and BOOTP. */
3292 if (ip_hlen + sizeof(*udp) + offsetof(struct bootp, vend) > plen) 3293 if (ip_hlen + sizeof(udp) + offsetof(struct bootp, vend) > plen)
 3294 return false;
 3295
 3296 /* Sanity. */
 3297 memcpy(&udp, (char *)ip + ip_hlen, sizeof(udp));
 3298 if (ntohs(udp.uh_ulen) < sizeof(udp))
 3299 return false;
 3300 if (ip_hlen + ntohs(udp.uh_ulen) > plen)
3293 return false; 3301 return false;
3294 3302
3295 /* Check it's to and from the right ports. */ 3303 /* Check it's to and from the right ports. */
3296 udp = (struct udphdr *)(void *)((char *)ip + ip_hlen); 3304 if (udp.uh_dport != htons(BOOTPC) || udp.uh_sport != htons(BOOTPS))
3297 if (udp->uh_dport != htons(BOOTPC) || udp->uh_sport != htons(BOOTPS)) 
3298 return false; 3305 return false;
3299 3306
3300 return true; 3307 return true;
3301} 3308}
3302 3309
3303/* Lengths have already been checked. */ 3310/* Lengths have already been checked. */
3304static bool 3311static bool
3305checksums_valid(void *packet, 3312checksums_valid(void *packet,
3306 struct in_addr *from, unsigned int flags) 3313 struct in_addr *from, unsigned int flags)
3307{ 3314{
3308 struct ip *ip = packet; 3315 struct ip *ip = packet;
3309 struct ip pseudo_ip = { 3316 union pip {
3310 .ip_p = IPPROTO_UDP, 3317 struct ip ip;
3311 .ip_src = ip->ip_src, 3318 uint16_t w[sizeof(struct ip)];
3312 .ip_dst = ip->ip_dst 3319 } pip = {
 3320 .ip.ip_p = IPPROTO_UDP,
 3321 .ip.ip_src = ip->ip_src,
 3322 .ip.ip_dst = ip->ip_dst,
3313 }; 3323 };
3314 size_t ip_hlen; 3324 size_t ip_hlen;
3315 uint16_t udp_len, uh_sum; 3325 struct udphdr udp;
3316 struct udphdr *udp; 3326 char *udpp, *uh_sump;
3317 uint32_t csum; 3327 uint32_t csum;
3318 3328
3319 if (from != NULL) 3329 if (from != NULL)
3320 from->s_addr = ip->ip_src.s_addr; 3330 from->s_addr = ip->ip_src.s_addr;
3321 3331
3322 ip_hlen = (size_t)ip->ip_hl * 4; 3332 ip_hlen = (size_t)ip->ip_hl * 4;
3323 if (in_cksum(ip, ip_hlen, NULL) != 0) 3333 if (in_cksum(ip, ip_hlen, NULL) != 0)
3324 return false; 3334 return false;
3325 3335
3326 if (flags & BPF_PARTIALCSUM) 3336 if (flags & BPF_PARTIALCSUM)
3327 return 0; 3337 return true;
3328 3338
3329 udp = (struct udphdr *)(void *)((char *)ip + ip_hlen); 3339 udpp = (char *)ip + ip_hlen;
3330 if (udp->uh_sum == 0) 3340 memcpy(&udp, udpp, sizeof(udp));
3331 return 0; 3341 if (udp.uh_sum == 0)
 3342 return true;
3332 3343
3333 /* UDP checksum is based on a pseudo IP header alongside 3344 /* UDP checksum is based on a pseudo IP header alongside
3334 * the UDP header and payload. */ 3345 * the UDP header and payload. */
3335 udp_len = ntohs(udp->uh_ulen); 3346 pip.ip.ip_len = udp.uh_ulen;
3336 uh_sum = udp->uh_sum; 
3337 udp->uh_sum = 0; 
3338 pseudo_ip.ip_len = udp->uh_ulen; 
3339 csum = 0; 3347 csum = 0;
3340 in_cksum(&pseudo_ip, sizeof(pseudo_ip), &csum); 3348
3341 csum = in_cksum(udp, udp_len, &csum); 3349 /* Need to zero the UDP sum in the packet for the checksum to work. */
3342 return csum == uh_sum; 3350 uh_sump = udpp + offsetof(struct udphdr, uh_sum);
 3351 memset(uh_sump, 0, sizeof(udp.uh_sum));
 3352
 3353 /* Checksum psuedo header and then UDP + payload. */
 3354 in_cksum(pip.w, sizeof(pip.w), &csum);
 3355 csum = in_cksum(udpp, ntohs(udp.uh_ulen), &csum);
 3356
 3357#if 0 /* Not needed, just here for completeness. */
 3358 /* Put the checksum back. */
 3359 memcpy(uh_sump, &udp.uh_sum, sizeof(udp.uh_sum));
 3360#endif
 3361
 3362 return csum == udp.uh_sum;
3343} 3363}
3344 3364
3345static void 3365static void
3346dhcp_handlebootp(struct interface *ifp, struct bootp *bootp, size_t len, 3366dhcp_handlebootp(struct interface *ifp, struct bootp *bootp, size_t len,
3347 struct in_addr *from) 3367 struct in_addr *from)
3348{ 3368{
3349 size_t v; 3369 size_t v;
3350 3370
3351 if (len < offsetof(struct bootp, vend)) { 3371 if (len < offsetof(struct bootp, vend)) {
3352 logerrx("%s: truncated packet (%zu) from %s", 3372 logerrx("%s: truncated packet (%zu) from %s",
3353 ifp->name, len, inet_ntoa(*from)); 3373 ifp->name, len, inet_ntoa(*from));
3354 return; 3374 return;
3355 } 3375 }

cvs diff -r1.23.2.2 -r1.23.2.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c 2019/10/12 14:44:32 1.23.2.2
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c 2019/10/16 17:41:40 1.23.2.3
@@ -1974,32 +1974,30 @@ printpidfile: @@ -1974,32 +1974,30 @@ printpidfile:
1974 } 1974 }
1975#else 1975#else
1976 if (control_start(&ctx, 1976 if (control_start(&ctx,
1977 ctx.options & DHCPCD_MASTER ? NULL : argv[optind]) == -1) 1977 ctx.options & DHCPCD_MASTER ? NULL : argv[optind]) == -1)
1978 { 1978 {
1979 logerr("%s: control_start", __func__); 1979 logerr("%s: control_start", __func__);
1980 goto exit_failure; 1980 goto exit_failure;
1981 } 1981 }
1982#endif 1982#endif
1983 1983
1984 logdebugx(PACKAGE "-" VERSION " starting"); 1984 logdebugx(PACKAGE "-" VERSION " starting");
1985 ctx.options |= DHCPCD_STARTED; 1985 ctx.options |= DHCPCD_STARTED;
1986 1986
1987#ifdef HAVE_SETPROCTITLE 
1988 setproctitle("%s%s%s", 1987 setproctitle("%s%s%s",
1989 ctx.options & DHCPCD_MASTER ? "[master]" : argv[optind], 1988 ctx.options & DHCPCD_MASTER ? "[master]" : argv[optind],
1990 ctx.options & DHCPCD_IPV4 ? " [ip4]" : "", 1989 ctx.options & DHCPCD_IPV4 ? " [ip4]" : "",
1991 ctx.options & DHCPCD_IPV6 ? " [ip6]" : ""); 1990 ctx.options & DHCPCD_IPV6 ? " [ip6]" : "");
1992#endif 
1993 1991
1994 if (if_opensockets(&ctx) == -1) { 1992 if (if_opensockets(&ctx) == -1) {
1995 logerr("%s: if_opensockets", __func__); 1993 logerr("%s: if_opensockets", __func__);
1996 goto exit_failure; 1994 goto exit_failure;
1997 } 1995 }
1998#ifndef SMALL 1996#ifndef SMALL
1999 dhcpcd_setlinkrcvbuf(&ctx); 1997 dhcpcd_setlinkrcvbuf(&ctx);
2000#endif 1998#endif
2001 1999
2002 /* When running dhcpcd against a single interface, we need to retain 2000 /* When running dhcpcd against a single interface, we need to retain
2003 * the old behaviour of waiting for an IP address */ 2001 * the old behaviour of waiting for an IP address */
2004 if (ctx.ifc == 1 && !(ctx.options & DHCPCD_BACKGROUND)) 2002 if (ctx.ifc == 1 && !(ctx.options & DHCPCD_BACKGROUND))
2005 ctx.options |= DHCPCD_WAITIP; 2003 ctx.options |= DHCPCD_WAITIP;
@@ -2145,19 +2143,22 @@ exit1: @@ -2145,19 +2143,22 @@ exit1:
2145 } 2143 }
2146 if_closesockets(&ctx); 2144 if_closesockets(&ctx);
2147 free_globals(&ctx); 2145 free_globals(&ctx);
2148#ifdef INET6 2146#ifdef INET6
2149 ipv6_ctxfree(&ctx); 2147 ipv6_ctxfree(&ctx);
2150#endif 2148#endif
2151 dev_stop(&ctx); 2149 dev_stop(&ctx);
2152 eloop_free(ctx.eloop); 2150 eloop_free(ctx.eloop);
2153 2151
2154 if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED)) 2152 if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED))
2155 loginfox(PACKAGE " exited"); 2153 loginfox(PACKAGE " exited");
2156 logclose(); 2154 logclose();
2157 free(ctx.logfile); 2155 free(ctx.logfile);
 2156#ifdef SETPROCTITLE_H
 2157 setproctitle_free();
 2158#endif
2158#ifdef USE_SIGNALS 2159#ifdef USE_SIGNALS
2159 if (ctx.options & DHCPCD_FORKED) 2160 if (ctx.options & DHCPCD_FORKED)
2160 _exit(i); /* so atexit won't remove our pidfile */ 2161 _exit(i); /* so atexit won't remove our pidfile */
2161#endif 2162#endif
2162 return i; 2163 return i;
2163} 2164}

cvs diff -r1.3.2.2 -r1.3.2.3 src/external/bsd/dhcpcd/dist/src/ipv6.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/ipv6.c 2019/10/12 14:44:32 1.3.2.2
+++ src/external/bsd/dhcpcd/dist/src/ipv6.c 2019/10/16 17:41:40 1.3.2.3
@@ -1243,27 +1243,29 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx, @@ -1243,27 +1243,29 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
1243#endif 1243#endif
1244 1244
1245out: 1245out:
1246 /* Done with the ia now, so free it. */ 1246 /* Done with the ia now, so free it. */
1247 if (cmd == RTM_DELADDR) 1247 if (cmd == RTM_DELADDR)
1248 ipv6_freeaddr(ia); 1248 ipv6_freeaddr(ia);
1249 else if (!(ia->addr_flags & IN6_IFF_NOTUSEABLE)) 1249 else if (!(ia->addr_flags & IN6_IFF_NOTUSEABLE))
1250 ia->flags |= IPV6_AF_DADCOMPLETED; 1250 ia->flags |= IPV6_AF_DADCOMPLETED;
1251 1251
1252 /* If we've not already called rt_build via the IPv6ND 1252 /* If we've not already called rt_build via the IPv6ND
1253 * or DHCP6 handlers and the existance of any useable 1253 * or DHCP6 handlers and the existance of any useable
1254 * global address on the interface has changed, 1254 * global address on the interface has changed,
1255 * call rt_build to add/remove the default route. */ 1255 * call rt_build to add/remove the default route. */
1256 if (ifp->active && ifp->options->options & DHCPCD_IPV6 && 1256 if (ifp->active &&
 1257 ((ifp->options != NULL && ifp->options->options & DHCPCD_IPV6) ||
 1258 (ifp->options == NULL && ctx->options & DHCPCD_IPV6)) &&
1257 !(ctx->options & DHCPCD_RTBUILD) && 1259 !(ctx->options & DHCPCD_RTBUILD) &&
1258 (ipv6_anyglobal(ifp) != NULL) != anyglobal) 1260 (ipv6_anyglobal(ifp) != NULL) != anyglobal)
1259 rt_build(ctx, AF_INET6); 1261 rt_build(ctx, AF_INET6);
1260} 1262}
1261 1263
1262int 1264int
1263ipv6_hasaddr(const struct interface *ifp) 1265ipv6_hasaddr(const struct interface *ifp)
1264{ 1266{
1265 1267
1266 if (ipv6nd_iffindaddr(ifp, NULL, 0) != NULL) 1268 if (ipv6nd_iffindaddr(ifp, NULL, 0) != NULL)
1267 return 1; 1269 return 1;
1268#ifdef DHCP6 1270#ifdef DHCP6
1269 if (dhcp6_iffindaddr(ifp, NULL, 0) != NULL) 1271 if (dhcp6_iffindaddr(ifp, NULL, 0) != NULL)