Module Name:    src
Committed By:   roy
Date:           Fri Jul 29 10:07:58 UTC 2016

Modified Files:
        src/external/bsd/dhcpcd/dist: arp.c defs.h dhcp-common.c dhcp.c dhcp6.c
            dhcp6.h dhcpcd-run-hooks.8.in dhcpcd.8.in dhcpcd.c dhcpcd.conf.5.in
            dhcpcd.h duid.c if-bsd.c if-options.c if-options.h if.c if.h ipv4.c
            ipv4.h ipv4ll.c ipv6.c ipv6.h ipv6nd.c ipv6nd.h
        src/external/bsd/dhcpcd/dist/dhcpcd-hooks: 20-resolv.conf

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/arp.c
cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/defs.h \
    src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/dhcpcd/dist/dhcp-common.c \
    src/external/bsd/dhcpcd/dist/dhcpcd.h src/external/bsd/dhcpcd/dist/ipv4.h
cvs rdiff -u -r1.43 -r1.44 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/dhcpcd/dist/dhcp6.c \
    src/external/bsd/dhcpcd/dist/if.c
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/dhcp6.h \
    src/external/bsd/dhcpcd/dist/ipv6nd.h
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
cvs rdiff -u -r1.48 -r1.49 src/external/bsd/dhcpcd/dist/dhcpcd.8.in
cvs rdiff -u -r1.35 -r1.36 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/duid.c
cvs rdiff -u -r1.31 -r1.32 src/external/bsd/dhcpcd/dist/if-bsd.c
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/dhcpcd/dist/if-options.c
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/if-options.h \
    src/external/bsd/dhcpcd/dist/ipv6.c src/external/bsd/dhcpcd/dist/ipv6.h
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/if.h \
    src/external/bsd/dhcpcd/dist/ipv4ll.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/ipv4.c
cvs rdiff -u -r1.30 -r1.31 src/external/bsd/dhcpcd/dist/ipv6nd.c
cvs rdiff -u -r1.9 -r1.10 \
    src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/arp.c
diff -u src/external/bsd/dhcpcd/dist/arp.c:1.20 src/external/bsd/dhcpcd/dist/arp.c:1.21
--- src/external/bsd/dhcpcd/dist/arp.c:1.20	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/arp.c	Fri Jul 29 10:07:57 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: arp.c,v 1.20 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: arp.c,v 1.21 2016/07/29 10:07:57 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -122,32 +122,19 @@ arp_report_conflicted(const struct arp_s
 }
 
 static void
-arp_packet(void *arg)
+arp_packet(struct interface *ifp, uint8_t *data, size_t len)
 {
-	struct interface *ifp = arg;
 	const struct interface *ifn;
-	uint8_t buf[ARP_LEN];
 	struct arphdr ar;
 	struct arp_msg arm;
-	ssize_t bytes;
-	struct iarp_state *state;
+	const struct iarp_state *state;
 	struct arp_state *astate, *astaten;
-	unsigned char *hw_s, *hw_t;
-	int flags;
+	uint8_t *hw_s, *hw_t;
 
-	state = ARP_STATE(ifp);
-	flags = 0;
-	bytes = if_readraw(ifp, state->fd, buf, sizeof(buf), &flags);
-	if (bytes == -1) {
-		logger(ifp->ctx, LOG_ERR,
-		    "%s: arp if_readrawpacket: %m", ifp->name);
-		arp_close(ifp);
-		return;
-	}
 	/* We must have a full ARP header */
-	if ((size_t)bytes < sizeof(ar))
+	if (len < sizeof(ar))
 		return;
-	memcpy(&ar, buf, sizeof(ar));
+	memcpy(&ar, data, sizeof(ar));
 	/* Families must match */
 	if (ar.ar_hrd != htons(ifp->family))
 		return;
@@ -165,10 +152,10 @@ arp_packet(void *arg)
 		return;
 
 	/* Get pointers to the hardware addreses */
-	hw_s = buf + sizeof(ar);
+	hw_s = data + sizeof(ar);
 	hw_t = hw_s + ar.ar_hln + ar.ar_pln;
 	/* Ensure we got all the data */
-	if ((hw_t + ar.ar_hln + ar.ar_pln) - buf > bytes)
+	if ((size_t)((hw_t + ar.ar_hln + ar.ar_pln) - data) > len)
 		return;
 	/* Ignore messages from ourself */
 	TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) {
@@ -190,12 +177,39 @@ arp_packet(void *arg)
 	memcpy(&arm.tip.s_addr, hw_t + ar.ar_hln, ar.ar_pln);
 
 	/* Run the conflicts */
+	state = ARP_CSTATE(ifp);
 	TAILQ_FOREACH_SAFE(astate, &state->arp_states, next, astaten) {
 		if (astate->conflicted_cb)
 			astate->conflicted_cb(astate, &arm);
 	}
 }
 
+static void
+arp_read(void *arg)
+{
+	struct interface *ifp = arg;
+	const struct iarp_state *state;
+	uint8_t buf[ARP_LEN];
+	int flags;
+	ssize_t bytes;
+
+	/* Some RAW mechanisms are generic file descriptors, not sockets.
+	 * This means we have no kernel call to just get one packet,
+	 * so we have to process the entire buffer. */
+	state = ARP_CSTATE(ifp);
+	flags = 0;
+	while (!(flags & RAW_EOF)) {
+		bytes = if_readraw(ifp, state->fd, buf, sizeof(buf), &flags);
+		if (bytes == -1) {
+			logger(ifp->ctx, LOG_ERR,
+			    "%s: arp if_readrawpacket: %m", ifp->name);
+			arp_close(ifp);
+			return;
+		}
+		arp_packet(ifp, buf, (size_t)bytes);
+	}
+}
+
 int
 arp_open(struct interface *ifp)
 {
@@ -209,7 +223,7 @@ arp_open(struct interface *ifp)
 			    __func__, ifp->name);
 			return -1;
 		}
-		eloop_event_add(ifp->ctx->eloop, state->fd, arp_packet, ifp);
+		eloop_event_add(ifp->ctx->eloop, state->fd, arp_read, ifp);
 	}
 	return state->fd;
 }

Index: src/external/bsd/dhcpcd/dist/defs.h
diff -u src/external/bsd/dhcpcd/dist/defs.h:1.28 src/external/bsd/dhcpcd/dist/defs.h:1.29
--- src/external/bsd/dhcpcd/dist/defs.h:1.28	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/defs.h	Fri Jul 29 10:07:57 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.28 2016/06/17 19:42:31 roy Exp $ */
+/* $NetBSD: defs.h,v 1.29 2016/07/29 10:07:57 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.11.1"
+#define VERSION			"6.11.2"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"
Index: src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.28 src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.29
--- src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.28	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in	Fri Jul 29 10:07:57 2016
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.conf.5.in,v 1.28 2016/06/17 19:42:31 roy Exp $
+.\"     $NetBSD: dhcpcd.conf.5.in,v 1.29 2016/07/29 10:07:57 roy Exp $
 .\" Copyright (c) 2006-2016 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 14, 2016
+.Dd June 27, 2016
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -407,7 +407,7 @@ Set this option so to make
 .Nm dhcpcd
 always fork on an RA.
 .It Ic ipv6ra_own
-Disables kernel IPv6 Router Advertisment processing so dhcpcd can manage
+Disables kernel IPv6 Router Advertisement processing so dhcpcd can manage
 addresses and routes.
 .It Ic ipv6ra_own_default
 Each time dhcpcd receives an IPv6 Router Adveristment, dhcpcd will manage
@@ -415,7 +415,7 @@ the default route only.
 This allows dhcpcd to prefer an interface for outbound traffic based on metric
 and/or user selection rather than the kernel.
 .It Ic ipv6rs
-Enables IPv6 Router Advertisment solicitation.
+Enables IPv6 Router Advertisement solicitation.
 This is on by default, but is documented here in the case where it is disabled
 globally but needs to be enabled for one interface.
 .It Ic leasetime Ar seconds
@@ -570,8 +570,8 @@ A setting of 0 seconds causes
 to skip the REBOOT phase and go straight into DISCOVER.
 This is desirable for mobile users because if you change from network A to
 network B and they use the same subnet and the address from network A isn't
-in use on network B, then the DHCP server will remain silent even if authorative
-which means
+in use on network B, then the DHCP server will remain silent even if
+authoritative which means
 .Nm dhcpcd
 will timeout before moving back to the DISCOVER phase.
 .It Ic release
@@ -604,7 +604,7 @@ If you set
 .Nm dhcpcd
 will continue auto-configuation as normal.
 .Pp
-Here is an example which configures two static addresss, an IPv4 router, DNS
+Here is an example which configures two static address, an IPv4 router, DNS
 and disables IPv6 auto-configuration.
 You could also use the
 .Ic inform6

Index: src/external/bsd/dhcpcd/dist/dhcp-common.c
diff -u src/external/bsd/dhcpcd/dist/dhcp-common.c:1.18 src/external/bsd/dhcpcd/dist/dhcp-common.c:1.19
--- src/external/bsd/dhcpcd/dist/dhcp-common.c:1.18	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcp-common.c	Fri Jul 29 10:07:57 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp-common.c,v 1.18 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: dhcp-common.c,v 1.19 2016/07/29 10:07:57 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -173,7 +173,7 @@ dhcp_vendor(char *str, size_t len)
 	char *p;
 	int l;
 
-	if (uname(&utn) != 0)
+	if (uname(&utn) == -1)
 		return (ssize_t)snprintf(str, len, "%s-%s",
 		    PACKAGE, VERSION);
 	p = str;
Index: src/external/bsd/dhcpcd/dist/dhcpcd.h
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.h:1.18 src/external/bsd/dhcpcd/dist/dhcpcd.h:1.19
--- src/external/bsd/dhcpcd/dist/dhcpcd.h:1.18	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.h	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: dhcpcd.h,v 1.18 2016/06/17 19:42:31 roy Exp $ */
+/* $NetBSD: dhcpcd.h,v 1.19 2016/07/29 10:07:58 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -77,11 +77,8 @@ struct interface {
 	struct dhcpcd_ctx *ctx;
 	TAILQ_ENTRY(interface) next;
 	char name[IF_NAMESIZE];
-#ifdef __linux__
-	char alias[IF_NAMESIZE];
-#endif
 	unsigned int index;
-	int active;
+	unsigned int active;
 	unsigned int flags;
 	sa_family_t family;
 	unsigned char hwaddr[HWADDR_LEN];
Index: src/external/bsd/dhcpcd/dist/ipv4.h
diff -u src/external/bsd/dhcpcd/dist/ipv4.h:1.18 src/external/bsd/dhcpcd/dist/ipv4.h:1.19
--- src/external/bsd/dhcpcd/dist/ipv4.h:1.18	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/ipv4.h	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ipv4.h,v 1.18 2016/06/17 19:42:32 roy Exp $ */
+/* $NetBSD: ipv4.h,v 1.19 2016/07/29 10:07:58 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -32,16 +32,23 @@
 
 #include "dhcpcd.h"
 
-#ifdef IN_IFF_TENTATIVE
-#define IN_IFF_NOTUSEABLE \
-        (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED | IN_IFF_DETACHED)
-#endif
-
 /* Prefer our macro */
 #ifdef HTONL
 #undef HTONL
 #endif
 
+#ifndef BYTE_ORDER
+#define	BIG_ENDIAN	1234
+#define	LITTLE_ENDIAN	4321
+#if defined(_BIG_ENDIAN)
+#define	BYTE_ORDER	BIG_ENDIAN
+#elif defined(_LITTLE_ENDIAN)
+#define	BYTE_ORDER	LITTLE_ENDIAN
+#else
+#error Endian unknown
+#endif
+#endif
+
 #if BYTE_ORDER == BIG_ENDIAN
 #define HTONL(A) (A)
 #elif BYTE_ORDER == LITTLE_ENDIAN
@@ -50,10 +57,23 @@
     (((uint32_t)(A) & 0x00ff0000) >> 8) | \
     (((uint32_t)(A) & 0x0000ff00) << 8) | \
     (((uint32_t)(A) & 0x000000ff) << 24))
-#else
-#error Endian unknown
 #endif /* BYTE_ORDER */
 
+#ifdef __sun
+   /* Solaris lacks these defines.
+    * While it supports DaD, to seems to only expose IFF_DUPLICATE
+    * so we have no way of knowing if it's tentative or not.
+    * I don't even know if Solaris has any special treatment for tentative. */
+#  define IN_IFF_TENTATIVE	0
+#  define IN_IFF_DUPLICATED	0x02
+#  define IN_IFF_DETACHED	0
+#endif
+
+#ifdef IN_IFF_TENTATIVE
+#define IN_IFF_NOTUSEABLE \
+        (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED | IN_IFF_DETACHED)
+#endif
+
 struct rt {
 	TAILQ_ENTRY(rt) next;
 	struct in_addr dest;
@@ -78,6 +98,9 @@ struct ipv4_addr {
 	struct interface *iface;
 	int addr_flags;
 	char saddr[INET_ADDRSTRLEN + 3];
+#ifdef ALIAS_ADDR
+	char alias[IF_NAMESIZE];
+#endif
 };
 TAILQ_HEAD(ipv4_addrhead, ipv4_addr);
 
@@ -130,10 +153,8 @@ struct ipv4_addr *ipv4_iffindlladdr(stru
 struct ipv4_addr *ipv4_findaddr(struct dhcpcd_ctx *, const struct in_addr *);
 struct ipv4_addr *ipv4_findmaskaddr(struct dhcpcd_ctx *,
     const struct in_addr *);
-int ipv4_srcaddr(const struct rt *, struct in_addr *);
 void ipv4_handleifa(struct dhcpcd_ctx *, int, struct if_head *, const char *,
-    const struct in_addr *, const struct in_addr *, const struct in_addr *,
-    int);
+    const struct in_addr *, const struct in_addr *, const struct in_addr *);
 
 void ipv4_freeroutes(struct rt_head *);
 

Index: src/external/bsd/dhcpcd/dist/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.43 src/external/bsd/dhcpcd/dist/dhcp.c:1.44
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.43	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Fri Jul 29 10:07:57 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.43 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.44 2016/07/29 10:07:57 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -1101,7 +1101,7 @@ make_message(struct bootp **bootpm, cons
 	return (ssize_t)len;
 
 toobig:
-	logger(ifp->ctx, LOG_ERR, "%s: DHCP messge too big", ifp->name);
+	logger(ifp->ctx, LOG_ERR, "%s: DHCP message too big", ifp->name);
 	free(bootp);
 	return -1;
 }
@@ -2728,7 +2728,7 @@ dhcp_handledhcp(struct interface *ifp, s
 		type = 0;
 	else if (ifo->options & DHCPCD_BOOTP) {
 		logger(ifp->ctx, LOG_DEBUG,
-		    "%s: ignoring DHCP reply (excpecting BOOTP)",
+		    "%s: ignoring DHCP reply (expecting BOOTP)",
 		    ifp->name);
 		return;
 	}
@@ -3096,7 +3096,7 @@ valid_udp_packet(uint8_t *data, size_t d
 	}
 
 	bytes = ntohs(p->ip.ip_len);
-	if (data_len < bytes) {
+	if (bytes > data_len) {
 		errno = EINVAL;
 		return -1;
 	}
@@ -3128,27 +3128,15 @@ valid_udp_packet(uint8_t *data, size_t d
 }
 
 static void
-dhcp_handlepacket(void *arg)
+dhcp_handlepacket(struct interface *ifp, uint8_t *data, size_t len, int flags)
 {
-	struct interface *ifp = arg;
-	uint8_t *bootp, buf[MTU_MAX];
-	size_t bytes;
+	uint8_t *bootp;
 	struct in_addr from;
-	int i, flags;
+	int i;
+	size_t udp_len;
 	const struct dhcp_state *state = D_CSTATE(ifp);
 
-	/* Need this API due to BPF */
-	flags = 0;
-	bootp = NULL;
-	bytes = (size_t)if_readraw(ifp, state->raw_fd,buf, sizeof(buf), &flags);
-	if ((ssize_t)bytes == -1) {
-		logger(ifp->ctx, LOG_ERR,
-		    "%s: dhcp if_readrawpacket: %m", ifp->name);
-		dhcp_close(ifp);
-		arp_close(ifp);
-		return;
-	}
-	if (valid_udp_packet(buf, bytes, &from, flags & RAW_PARTIALCSUM) == -1)
+	if (valid_udp_packet(data, len, &from, flags & RAW_PARTIALCSUM) == -1)
 	{
 		logger(ifp->ctx, LOG_ERR, "%s: invalid UDP packet from %s",
 		    ifp->name, inet_ntoa(from));
@@ -3173,6 +3161,7 @@ dhcp_handlepacket(void *arg)
 		    "%s: server %s is not destination",
 		    ifp->name, inet_ntoa(from));
 	}
+
 	/*
 	 * DHCP has a variable option area rather than a fixed vendor area.
 	 * Because DHCP uses the BOOTP protocol it should still send BOOTP
@@ -3180,19 +3169,47 @@ dhcp_handlepacket(void *arg)
 	 * However some servers send a truncated vendor area.
 	 * dhcpcd can work fine without the vendor area being sent.
 	 */
-	bytes = get_udp_data(&bootp, buf);
-	if (bytes < offsetof(struct bootp, vend)) {
+	udp_len = get_udp_data(&bootp, data);
+	/* udp_len must be correct because the values are checked in
+	 * valid_udp_packet(). */
+	if (udp_len < offsetof(struct bootp, vend)) {
 		logger(ifp->ctx, LOG_ERR,
 		    "%s: truncated packet (%zu) from %s",
-		    ifp->name, bytes, inet_ntoa(from));
+		    ifp->name, udp_len, inet_ntoa(from));
 		return;
 	}
-	/* But to make our IS_DHCP macro easy, ensure the vendor
+	/* To make our IS_DHCP macro easy, ensure the vendor
 	 * area has at least 4 octets. */
-	while (bytes < offsetof(struct bootp, vend) + 4)
-		bootp[bytes++] = '\0';
+	while (udp_len < offsetof(struct bootp, vend) + 4)
+		bootp[udp_len++] = '\0';
 
-	dhcp_handledhcp(ifp, (struct bootp *)bootp, bytes, &from);
+	dhcp_handledhcp(ifp, (struct bootp *)bootp, udp_len, &from);
+}
+
+static void
+dhcp_readpacket(void *arg)
+{
+	struct interface *ifp = arg;
+	uint8_t buf[MTU_MAX];
+	ssize_t bytes;
+	int flags;
+	const struct dhcp_state *state = D_CSTATE(ifp);
+
+	/* Some RAW mechanisms are generic file descriptors, not sockets.
+	 * This means we have no kernel call to just get one packet,
+	 * so we have to process the entire buffer. */
+	flags = 0;
+	while (!(flags & RAW_EOF)) {
+		bytes = if_readraw(ifp, state->raw_fd, buf,sizeof(buf), &flags);
+		if (bytes == -1) {
+			logger(ifp->ctx, LOG_ERR,
+			    "%s: dhcp if_readrawpacket: %m", ifp->name);
+			dhcp_close(ifp);
+			arp_close(ifp);
+			return;
+		}
+		dhcp_handlepacket(ifp, buf, (size_t)bytes, flags);
+	}
 }
 
 static void
@@ -3234,7 +3251,7 @@ dhcp_open(struct interface *ifp)
 			return -1;
 		}
 		eloop_event_add(ifp->ctx->eloop,
-		    state->raw_fd, dhcp_handlepacket, ifp);
+		    state->raw_fd, dhcp_readpacket, ifp);
 	}
 	return 0;
 }

Index: src/external/bsd/dhcpcd/dist/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/dhcp6.c:1.22 src/external/bsd/dhcpcd/dist/dhcp6.c:1.23
--- src/external/bsd/dhcpcd/dist/dhcp6.c:1.22	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcp6.c	Fri Jul 29 10:07:57 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp6.c,v 1.22 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: dhcp6.c,v 1.23 2016/07/29 10:07:57 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -591,7 +591,8 @@ dhcp6_makemessage(struct interface *ifp)
 	len += sizeof(*state->send);
 	len += sizeof(*o) + ifp->ctx->duid_len;
 	len += sizeof(*o) + sizeof(uint16_t); /* elapsed */
-	len += sizeof(*o) + dhcp6_makevendor(NULL, ifp);
+	if (!has_option_mask(ifo->nomask6, D6_OPTION_VENDOR_CLASS))
+		len += sizeof(*o) + dhcp6_makevendor(NULL, ifp);
 
 	/* IA */
 	m = NULL;
@@ -740,8 +741,10 @@ dhcp6_makemessage(struct interface *ifp)
 	p = D6_OPTION_DATA(o);
 	memset(p, 0, sizeof(uint16_t));
 
-	o = D6_NEXT_OPTION(o);
-	dhcp6_makevendor(o, ifp);
+	if (!has_option_mask(ifo->nomask6, D6_OPTION_VENDOR_CLASS)) {
+		o = D6_NEXT_OPTION(o);
+		dhcp6_makevendor(o, ifp);
+	}
 
 	if (state->state == DH6S_DISCOVER &&
 	    !(ifp->ctx->options & DHCPCD_TEST) &&
@@ -3467,22 +3470,12 @@ void dhcp6_dropnondelegates(struct inter
 }
 
 void
-dhcp6_handleifa(struct dhcpcd_ctx *ctx, int cmd, const char *ifname,
-    const struct in6_addr *addr, int flags)
+dhcp6_handleifa(int cmd, struct ipv6_addr *ia)
 {
-	struct interface *ifp;
 	struct dhcp6_state *state;
 
-	if (ctx->ifaces == NULL)
-		return;
-
-	TAILQ_FOREACH(ifp, ctx->ifaces, next) {
-		state = D6_STATE(ifp);
-		if (state == NULL || strcmp(ifp->name, ifname))
-			continue;
-		ipv6_handleifa_addrs(cmd, &state->addrs, addr, flags);
-	}
-
+	if ((state = D6_STATE(ia->iface)) != NULL)
+		ipv6_handleifa_addrs(cmd, &state->addrs, ia);
 }
 
 ssize_t
Index: src/external/bsd/dhcpcd/dist/if.c
diff -u src/external/bsd/dhcpcd/dist/if.c:1.22 src/external/bsd/dhcpcd/dist/if.c:1.23
--- src/external/bsd/dhcpcd/dist/if.c:1.22	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/if.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if.c,v 1.22 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: if.c,v 1.23 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -54,6 +54,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <ifaddrs.h>
+#include <inttypes.h>
 #include <fnmatch.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -200,8 +201,6 @@ static void if_learnaddrs(struct dhcpcd_
 #ifdef INET6
 	struct sockaddr_in6 *sin6, *net6;
 #endif
-	int ifa_flags;
-
 
 	for (ifa = ifaddrs; ifa; ifa = ifa->ifa_next) {
 		if (ifa->ifa_addr == NULL)
@@ -217,10 +216,9 @@ static void if_learnaddrs(struct dhcpcd_
 				brd = (void *)ifa->ifa_dstaddr;
 			else
 				brd = (void *)ifa->ifa_broadaddr;
-			ifa_flags = if_addrflags(&addr->sin_addr, ifp);
 			ipv4_handleifa(ctx, RTM_NEWADDR, ifs, ifa->ifa_name,
 				&addr->sin_addr, &net->sin_addr,
-				brd ? &brd->sin_addr : NULL, ifa_flags);
+				brd ? &brd->sin_addr : NULL);
 			break;
 #endif
 #ifdef INET6
@@ -233,13 +231,9 @@ static void if_learnaddrs(struct dhcpcd_
 				sin6->sin6_addr.s6_addr[2] =
 				    sin6->sin6_addr.s6_addr[3] = '\0';
 #endif
-			ifa_flags = if_addrflags6(&sin6->sin6_addr, ifp);
-			if (ifa_flags != -1)
-				ipv6_handleifa(ctx, RTM_NEWADDR, ifs,
-				    ifa->ifa_name,
-				    &sin6->sin6_addr,
-				    ipv6_prefixlen(&net6->sin6_addr),
-				    ifa_flags);
+			ipv6_handleifa(ctx, RTM_NEWADDR, ifs,
+			    ifa->ifa_name, &sin6->sin6_addr,
+			    ipv6_prefixlen(&net6->sin6_addr));
 			break;
 #endif
 		}
@@ -250,13 +244,11 @@ struct if_head *
 if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv)
 {
 	struct ifaddrs *ifaddrs, *ifa;
-	char *p;
-	int i, active;
+	int i;
+	unsigned int active;
 	struct if_head *ifs;
 	struct interface *ifp;
-#ifdef __linux__
-	char ifn[IF_NAMESIZE];
-#endif
+	struct if_spec spec;
 #ifdef AF_LINK
 	const struct sockaddr_dl *sdl;
 #ifdef SIOCGIFPRIORITY
@@ -290,79 +282,62 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 				continue;
 #endif
 		}
+		if (if_nametospec(ifa->ifa_name, &spec) != 0)
+			continue;
 
 		/* It's possible for an interface to have >1 AF_LINK.
 		 * For our purposes, we use the first one. */
 		TAILQ_FOREACH(ifp, ifs, next) {
-			if (strcmp(ifp->name, ifa->ifa_name) == 0)
+			if (strcmp(ifp->name, spec.devname) == 0)
 				break;
 		}
 		if (ifp)
 			continue;
 
-		active = IF_ACTIVE_USER;
 		if (argc > 0) {
 			for (i = 0; i < argc; i++) {
-#ifdef __linux__
-				/* Check the real interface name */
-				strlcpy(ifn, argv[i], sizeof(ifn));
-				p = strchr(ifn, ':');
-				if (p)
-					*p = '\0';
-				if (strcmp(ifn, ifa->ifa_name) == 0)
-					break;
-#else
-				if (strcmp(argv[i], ifa->ifa_name) == 0)
+				if (strcmp(argv[i], spec.devname) == 0)
 					break;
-#endif
 			}
-			if (i == argc) {
-				active = IF_INACTIVE;
-				p =  ifa->ifa_name;
-#ifdef __linux__
-				strlcpy(ifn, ifa->ifa_name, sizeof(ifn));
-#endif
-			} else
-				p = argv[i];
+			active = (i == argc) ? IF_INACTIVE : IF_ACTIVE_USER;
 		} else {
-			p = ifa->ifa_name;
-#ifdef __linux__
-			strlcpy(ifn, ifa->ifa_name, sizeof(ifn));
-#endif
 			/* -1 means we're discovering against a specific
 			 * interface, but we still need the below rules
 			 * to apply. */
-			if (argc == -1 && strcmp(argv[0], ifa->ifa_name) != 0)
+			if (argc == -1 && strcmp(argv[0], spec.devname) != 0)
 				continue;
+			active = ctx->options & DHCPCD_INACTIVE ?
+			    IF_INACTIVE: IF_ACTIVE_USER;
 		}
 
 		for (i = 0; i < ctx->ifdc; i++)
-			if (!fnmatch(ctx->ifdv[i], p, 0))
+			if (!fnmatch(ctx->ifdv[i], spec.devname, 0))
 				break;
 		if (i < ctx->ifdc)
 			active = IF_INACTIVE;
 		for (i = 0; i < ctx->ifac; i++)
-			if (!fnmatch(ctx->ifav[i], p, 0))
+			if (!fnmatch(ctx->ifav[i], spec.devname, 0))
 				break;
 		if (ctx->ifac && i == ctx->ifac)
 			active = IF_INACTIVE;
 
 #ifdef PLUGIN_DEV
 		/* Ensure that the interface name has settled */
-		if (!dev_initialized(ctx, p))
+		if (!dev_initialized(ctx, spec.devname))
 			continue;
 #endif
 
 		/* Don't allow loopback or pointopoint unless explicit */
 		if (ifa->ifa_flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) {
 			if ((argc == 0 || argc == -1) &&
-			    ctx->ifac == 0 && !if_hasconf(ctx, p))
+			    ctx->ifac == 0 && !if_hasconf(ctx, spec.devname))
 				active = IF_INACTIVE;
 		}
 
-		if (if_vimaster(ctx, p) == 1) {
+		if (if_vimaster(ctx, spec.devname) == 1) {
 			logger(ctx, argc ? LOG_ERR : LOG_DEBUG,
-			    "%s: is a Virtual Interface Master, skipping", p);
+			    "%s: is a Virtual Interface Master, skipping",
+			    spec.devname);
 			continue;
 		}
 
@@ -372,14 +347,8 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 			break;
 		}
 		ifp->ctx = ctx;
-#ifdef __linux__
-		strlcpy(ifp->name, ifn, sizeof(ifp->name));
-		strlcpy(ifp->alias, p, sizeof(ifp->alias));
-#else
-		strlcpy(ifp->name, p, sizeof(ifp->name));
-#endif
+		strlcpy(ifp->name, spec.devname, sizeof(ifp->name));
 		ifp->flags = ifa->ifa_flags;
-		ifp->carrier = if_carrier(ifp);
 
 		if (ifa->ifa_addr != NULL) {
 #ifdef AF_LINK
@@ -513,8 +482,9 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 
 		if (!(ctx->options & (DHCPCD_DUMPLEASE | DHCPCD_TEST))) {
 			/* Handle any platform init for the interface */
-			if (active && if_init(ifp) == -1) {
-				logger(ifp->ctx, LOG_ERR, "%s: if_init: %m", p);
+			if (active != IF_INACTIVE && if_init(ifp) == -1) {
+				logger(ifp->ctx, LOG_ERR, "%s: if_init: %m",
+				    ifp->name);
 				if_free(ifp);
 				continue;
 			}
@@ -524,7 +494,7 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 			    if_setmtu(ifp, MTU_MIN) == -1)
 			{
 				logger(ifp->ctx, LOG_ERR,
-				    "%s: if_setmtu: %m", p);
+				    "%s: if_setmtu: %m", ifp->name);
 				if_free(ifp);
 				continue;
 			}
@@ -548,6 +518,10 @@ if_discover(struct dhcpcd_ctx *ctx, int 
 #endif
 
 		ifp->active = active;
+		if (ifp->active)
+			ifp->carrier = if_carrier(ifp);
+		else
+			ifp->carrier = LINK_UNKNOWN;
 		TAILQ_INSERT_TAIL(ifs, ifp, next);
 	}
 
@@ -557,18 +531,62 @@ failed:
 	return ifs;
 }
 
+/* Decode bge0:1 as dev = bge, ppa = 0 and lun = 1 */
+int
+if_nametospec(const char *ifname, struct if_spec *spec)
+{
+	char *ep;
+	int e;
+
+	if (ifname == NULL || *ifname == '\0' ||
+	    strlcpy(spec->ifname, ifname, sizeof(spec->ifname)) >=
+	    sizeof(spec->ifname) ||
+	    strlcpy(spec->drvname, ifname, sizeof(spec->drvname)) >=
+	    sizeof(spec->drvname))
+	{
+		errno = EINVAL;
+		return -1;
+	}
+	ep = strchr(spec->drvname, ':');
+	if (ep) {
+		spec->lun = (int)strtoi(ep + 1, NULL, 10, 0, INT_MAX, &e);
+		if (e != 0) {
+			errno = e;
+			return -1;
+		}
+		*ep-- = '\0';
+	} else {
+		spec->lun = -1;
+		ep = spec->drvname + strlen(spec->drvname) - 1;
+	}
+	strlcpy(spec->devname, spec->drvname, sizeof(spec->devname));
+	while (ep > spec->drvname && isdigit((int)*ep))
+		ep--;
+	if (*ep++ == ':') {
+		errno = EINVAL;
+		return -1;
+	}
+	spec->ppa = (int)strtoi(ep, NULL, 10, 0, INT_MAX, &e);
+	if (e != 0)
+		spec->ppa = -1;
+	*ep = '\0';
+
+	return 0;
+}
+
 static struct interface *
 if_findindexname(struct if_head *ifaces, unsigned int idx, const char *name)
 {
 
 	if (ifaces != NULL) {
+		struct if_spec spec;
 		struct interface *ifp;
 
+		if (name && if_nametospec(name, &spec) == -1)
+			return NULL;
+
 		TAILQ_FOREACH(ifp, ifaces, next) {
-			if ((name && strcmp(ifp->name, name) == 0) ||
-#ifdef __linux__
-			    (name && strcmp(ifp->alias, name) == 0) ||
-#endif
+			if ((name && strcmp(ifp->name, spec.devname) == 0) ||
 			    (!name && ifp->index == idx))
 				return ifp;
 		}

Index: src/external/bsd/dhcpcd/dist/dhcp6.h
diff -u src/external/bsd/dhcpcd/dist/dhcp6.h:1.14 src/external/bsd/dhcpcd/dist/dhcp6.h:1.15
--- src/external/bsd/dhcpcd/dist/dhcp6.h:1.14	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcp6.h	Fri Jul 29 10:07:57 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: dhcp6.h,v 1.14 2016/06/17 19:42:31 roy Exp $ */
+/* $NetBSD: dhcp6.h,v 1.15 2016/07/29 10:07:57 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -246,8 +246,7 @@ void dhcp6_renew(struct interface *);
 ssize_t dhcp6_env(char **, const char *, const struct interface *,
     const struct dhcp6_message *, size_t);
 void dhcp6_free(struct interface *);
-void dhcp6_handleifa(struct dhcpcd_ctx *, int, const char *,
-    const struct in6_addr *addr, int);
+void dhcp6_handleifa(int, struct ipv6_addr *);
 int dhcp6_dadcompleted(const struct interface *);
 void dhcp6_drop(struct interface *, const char *);
 void dhcp6_dropnondelegates(struct interface *ifp);
Index: src/external/bsd/dhcpcd/dist/ipv6nd.h
diff -u src/external/bsd/dhcpcd/dist/ipv6nd.h:1.14 src/external/bsd/dhcpcd/dist/ipv6nd.h:1.15
--- src/external/bsd/dhcpcd/dist/ipv6nd.h:1.14	Sun Apr 10 21:00:53 2016
+++ src/external/bsd/dhcpcd/dist/ipv6nd.h	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ipv6nd.h,v 1.14 2016/04/10 21:00:53 roy Exp $ */
+/* $NetBSD: ipv6nd.h,v 1.15 2016/07/29 10:07:58 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -111,8 +111,7 @@ ssize_t ipv6nd_free(struct interface *);
 void ipv6nd_expirera(void *arg);
 int ipv6nd_hasra(const struct interface *);
 int ipv6nd_hasradhcp(const struct interface *);
-void ipv6nd_handleifa(struct dhcpcd_ctx *, int,
-    const char *, const struct in6_addr *, int);
+void ipv6nd_handleifa(int, struct ipv6_addr *);
 int ipv6nd_dadcompleted(const struct interface *);
 void ipv6nd_expire(struct interface *, uint32_t);
 void ipv6nd_drop(struct interface *);

Index: src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in:1.15 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in:1.16
--- src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in:1.15	Thu Jul  9 10:15:34 2015
+++ src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in	Fri Jul 29 10:07:57 2016
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd-run-hooks.8.in,v 1.15 2015/07/09 10:15:34 roy Exp $
+.\"     $NetBSD: dhcpcd-run-hooks.8.in,v 1.16 2016/07/29 10:07:57 roy Exp $
 .\" Copyright (c) 2006-2015 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 29, 2015
+.Dd June 27, 2016
 .Dt DHCPCD-RUN-HOOKS 8
 .Os
 .Sh NAME
@@ -109,7 +109,7 @@ This should be treated as EXPIRE.
 .It Dv RECONFIGURE
 dhcpcd has been instructed to reconfigure an interface.
 .It Dv ROUTERADVERT
-dhcpcd has received an IPv6 Router Advertisment, or one has expired.
+dhcpcd has received an IPv6 Router Advertisement, or one has expired.
 .It Dv STOP | Dv STOP6
 dhcpcd stopped running on the interface.
 .It Dv STOPPED

Index: src/external/bsd/dhcpcd/dist/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.48 src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.49
--- src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.48	Mon May  9 10:15:59 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.8.in	Fri Jul 29 10:07:57 2016
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.8.in,v 1.48 2016/05/09 10:15:59 roy Exp $
+.\"     $NetBSD: dhcpcd.8.in,v 1.49 2016/07/29 10:07:57 roy Exp $
 .\" Copyright (c) 2006-2016 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 30, 2016
+.Dd July 27, 2016
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -60,6 +60,7 @@
 .Op Fl X , Fl Fl blacklist Ar address Ns Op Ar /cidr
 .Op Fl Z , Fl Fl denyinterfaces Ar pattern
 .Op Fl z , Fl Fl allowinterfaces Ar pattern
+.Op Fl Fl inactive
 .Op interface
 .Op ...
 .Nm
@@ -134,7 +135,7 @@ This feature needs to be enabled in the 
 will start using it.
 .Pp
 .Nm
-is also an implemenation of the DHCPv6 client as specified in
+is also an implementation of the DHCPv6 client as specified in
 .Li RFC 3315 .
 By default,
 .Nm
@@ -188,7 +189,7 @@ Using a single interface also affects th
 and
 .Fl x
 options where the same interface will need to be specified as a lack of an
-interace will imply Master mode which this is not.
+interafce will imply Master mode which this is not.
 To force starting in Master mode with only one interface, the
 .Fl M , Fl Fl master
 option can be used.
@@ -381,7 +382,7 @@ DHCP server.
 .It Fl M , Fl Fl master
 Start
 .Nm
-in master mode even if only one interface specified on the command line.
+in Master mode even if only one interface specified on the command line.
 See the Multiple Interfaces section above.
 .It Fl m , Fl Fl metric Ar metric
 Metrics are used to prefer an interface over another one, lowest wins.
@@ -706,6 +707,13 @@ which is a space or comma separated list
 If the same interface is matched in
 .Fl Z , Fl Fl denyinterfaces
 then it is still denied.
+.It Fl Fl inactive
+Don't start any interfaces other than those specified on the command line.
+This allows
+.Nm
+to be started in Master mode and then wait for subsequent
+.Nm
+commands to start each interface as required.
 .It Fl Fl nodev
 Don't load any
 .Pa /dev
@@ -733,7 +741,7 @@ configuration.
 If restricting
 .Nm
 to a single interface and optionally address family via the command-line
-then all futher calls to
+then all further calls to
 .Nm
 to rebind, reconfigure or exit need to include the same restrictive flags
 so that

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.35 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.36
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.35	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Fri Jul 29 10:07:57 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.35 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.36 2016/07/29 10:07:57 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -400,6 +400,8 @@ stop_interface(struct interface *ifp)
 	/* De-activate the interface */
 	ifp->active = IF_INACTIVE;
 	ifp->options->options &= ~DHCPCD_STOPPING;
+	/* Set the link state to unknown as we're no longer tracking it. */
+	ifp->carrier = LINK_UNKNOWN;
 
 stop:
 	if (!(ctx->options & (DHCPCD_MASTER | DHCPCD_TEST)))
@@ -585,8 +587,11 @@ dhcpcd_selectprofile(struct interface *i
 
 	free_options(ifp->options);
 	ifp->options = ifo;
-	if (profile)
+	if (profile) {
+		add_options(ifp->ctx, ifp->name, ifp->options,
+		    ifp->ctx->argc, ifp->ctx->argv);
 		configure_interface1(ifp);
+	}
 	return 1;
 }
 
@@ -1043,12 +1048,14 @@ dhcpcd_handleinterface(void *arg, int ac
 			continue;
 
 		/* If running off an interface list, check it's in it. */
-		if (ctx->ifc) {
+		if (ctx->ifc || ctx->options & DHCPCD_INACTIVE) {
 			for (i = 0; i < ctx->ifc; i++)
 				if (strcmp(ctx->ifv[i], ifname) == 0)
 					break;
-			if (i >= ctx->ifc)
+			if (i >= ctx->ifc) {
 				ifp->active = IF_INACTIVE;
+				ifp->carrier = LINK_UNKNOWN;
+			}
 		}
 
 		i = 0;
@@ -1860,7 +1867,9 @@ printpidfile:
 	}
 	if (ifp == NULL) {
 		if (ctx.ifc == 0)
-			logger(&ctx, LOG_ERR, "no valid interfaces found");
+			logger(&ctx,
+			    ctx.options & DHCPCD_INACTIVE ? LOG_DEBUG : LOG_ERR,
+			    "no valid interfaces found");
 		else
 			goto exit_failure;
 		if (!(ctx.options & DHCPCD_LINK)) {
@@ -1904,7 +1913,9 @@ printpidfile:
 		    ctx.options & DHCPCD_LINK &&
 		    !(ctx.options & DHCPCD_WAITIP))
 		{
-			logger(&ctx, LOG_WARNING,
+			logger(&ctx,
+			    ctx.options & DHCPCD_INACTIVE ?
+			    LOG_DEBUG : LOG_WARNING,
 			    "no interfaces have a carrier");
 			if (dhcpcd_daemonise(&ctx))
 				goto exit_success;

Index: src/external/bsd/dhcpcd/dist/duid.c
diff -u src/external/bsd/dhcpcd/dist/duid.c:1.12 src/external/bsd/dhcpcd/dist/duid.c:1.13
--- src/external/bsd/dhcpcd/dist/duid.c:1.12	Mon May  9 10:15:59 2016
+++ src/external/bsd/dhcpcd/dist/duid.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: duid.c,v 1.12 2016/05/09 10:15:59 roy Exp $");
+ __RCSID("$NetBSD: duid.c,v 1.13 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -122,7 +122,7 @@ duid_get(uint8_t **d, const struct inter
 	/* No file? OK, lets make one based on our interface */
 	if (ifp->family == ARPHRD_NETROM) {
 		logger(ifp->ctx, LOG_WARNING,
-		    "%s: is a NET/ROM psuedo interface", ifp->name);
+		    "%s: is a NET/ROM pseudo interface", ifp->name);
 		TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) {
 			if (ifp2->family != ARPHRD_NETROM)
 				break;

Index: src/external/bsd/dhcpcd/dist/if-bsd.c
diff -u src/external/bsd/dhcpcd/dist/if-bsd.c:1.31 src/external/bsd/dhcpcd/dist/if-bsd.c:1.32
--- src/external/bsd/dhcpcd/dist/if-bsd.c:1.31	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/if-bsd.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-bsd.c,v 1.31 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: if-bsd.c,v 1.32 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -361,6 +361,93 @@ if_findsa(struct dhcpcd_ctx *ctx, const 
 	errno = ENOENT;
 	return NULL;
 }
+
+static int
+if_rtmsg(unsigned char cmd, const struct interface *ifp,
+    int addrs, int flags,
+#ifdef RTP_CONNECTED
+    int priority,
+#endif
+    const struct sockaddr *dst, const struct sockaddr *mask,
+    const struct sockaddr *gate, const struct sockaddr *src,
+    uint32_t mtu)
+{
+	struct rtm
+	{
+		struct rt_msghdr hdr;
+		char buffer[sizeof(struct sockaddr_storage) * RTAX_MAX];
+	} rtm;
+	char *bp = rtm.buffer;
+	size_t l;
+	struct sockaddr_dl sdl;
+
+	if ((cmd == RTM_ADD || cmd == RTM_DELETE || cmd == RTM_CHANGE) &&
+	    ifp->ctx->options & DHCPCD_DAEMONISE &&
+	    !(ifp->ctx->options & DHCPCD_DAEMONISED))
+		ifp->ctx->options |= DHCPCD_RTM_PPID;
+
+#define ADDSA(sa) do {							      \
+		l = RT_ROUNDUP(((sa)->sa_len));				      \
+		memcpy(bp, (sa), l);					      \
+		bp += l;						      \
+	}  while (0 /* CONSTCOND */)
+
+	memset(&rtm, 0, sizeof(rtm));
+	rtm.hdr.rtm_version = RTM_VERSION;
+	rtm.hdr.rtm_type = cmd;
+#ifdef __OpenBSD__
+	rtm.hdr.rtm_pid = getpid();
+#endif
+	rtm.hdr.rtm_seq = ++ifp->ctx->seq;
+	rtm.hdr.rtm_flags = flags;
+	rtm.hdr.rtm_addrs = RTA_DST | addrs;
+#ifdef RTF_PINNED
+	if (cmd != RTM_ADD)
+		rtm.hdr.rtm_flags |= RTF_PINNED;
+#endif
+#ifdef RTP_CONNECTED
+	rtm.hdr.rtm_priority = priority;
+#endif
+
+	if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
+		rtm.hdr.rtm_flags |= RTF_UP;
+		rtm.hdr.rtm_addrs |= RTA_GATEWAY;
+		if (rtm.hdr.rtm_flags & (RTF_GATEWAY | RTF_REJECT))
+			/* Going via lo0 so remove the interface flags. */
+			rtm.hdr.rtm_addrs &= ~(RTA_IFP | RTA_IFA);
+		if (mtu != 0) {
+			rtm.hdr.rtm_inits |= RTV_MTU;
+			rtm.hdr.rtm_rmx.rmx_mtu = mtu;
+		}
+	}
+
+	ADDSA(dst);
+	if_linkaddr(&sdl, ifp);
+	if (rtm.hdr.rtm_addrs & RTA_GATEWAY) {
+		if (gate == NULL)
+			ADDSA((struct sockaddr *)&sdl);
+		else
+			ADDSA(gate);
+	}
+	if (rtm.hdr.rtm_addrs & RTA_NETMASK)
+		ADDSA(mask);
+
+	if (rtm.hdr.rtm_addrs & RTA_IFP) {
+		rtm.hdr.rtm_index = (unsigned short)ifp->index;
+		ADDSA((struct sockaddr *)&sdl);
+	}
+
+	if (rtm.hdr.rtm_addrs & RTA_IFA)
+		ADDSA(src);
+
+#undef ADDSA
+
+	rtm.hdr.rtm_msglen = (unsigned short)(bp - (char *)&rtm);
+	if (write(ifp->ctx->link_fd, &rtm, rtm.hdr.rtm_msglen) == -1)
+		return -1;
+	ifp->ctx->sseq = ifp->ctx->seq;
+	return 0;
+}
 #endif
 
 #ifdef INET
@@ -529,14 +616,15 @@ if_readraw(struct interface *ifp, int fd
 next:
 		state->buffer_pos += BPF_WORDALIGN(packet.bh_hdrlen +
 		    packet.bh_caplen);
-		if (state->buffer_pos >= state->buffer_len)
+		if (state->buffer_pos >= state->buffer_len) {
 			state->buffer_len = state->buffer_pos = 0;
+			*flags |= RAW_EOF;
+		}
 		if (bytes != -1)
 			return bytes;
 	}
 }
 
-
 int
 if_address(unsigned char cmd, const struct ipv4_addr *ia)
 {
@@ -625,72 +713,55 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct
 int
 if_route(unsigned char cmd, const struct rt *rt)
 {
-	union sockunion {
-		struct sockaddr sa;
-		struct sockaddr_in sin;
-		struct sockaddr_dl sdl;
-	} su;
-	struct rtm
-	{
-		struct rt_msghdr hdr;
-		char buffer[sizeof(su) * RTAX_MAX];
-	} rtm;
-	char *bp = rtm.buffer;
-	size_t l;
-	struct in_addr src_addr;
-
-	if ((cmd == RTM_ADD || cmd == RTM_DELETE || cmd == RTM_CHANGE) &&
-	    rt->iface->ctx->options & DHCPCD_DAEMONISE &&
-	    !(rt->iface->ctx->options & DHCPCD_DAEMONISED))
-		rt->iface->ctx->options |= DHCPCD_RTM_PPID;
-
-#define ADDSU {								      \
-		l = RT_ROUNDUP(su.sa.sa_len);				      \
-		memcpy(bp, &su, l);					      \
-		bp += l;						      \
-	}
-#define ADDADDR(addr) {							      \
-		memset(&su, 0, sizeof(su));				      \
-		su.sin.sin_family = AF_INET;				      \
-		su.sin.sin_len = sizeof(su.sin);			      \
-		(&su.sin)->sin_addr = *(addr);				      \
-		ADDSU;							      \
-	}
-
-	memset(&rtm, 0, sizeof(rtm));
-	rtm.hdr.rtm_version = RTM_VERSION;
-	rtm.hdr.rtm_type = cmd;
-	rtm.hdr.rtm_addrs = RTA_DST;
-	rtm.hdr.rtm_flags = RTF_UP;
-	rtm.hdr.rtm_pid = getpid();
-	rtm.hdr.rtm_seq = ++rt->iface->ctx->seq;
-#ifdef RTF_PINNED
-	if (cmd != RTM_ADD)
-		rtm.hdr.rtm_flags |= RTF_PINNED;
+	struct sockaddr_in dst = {
+		.sin_family = AF_INET,
+		.sin_len = sizeof(dst),
+		.sin_addr = rt->dest
+	};
+	struct sockaddr_in mask = {
+		.sin_family = AF_INET,
+		.sin_len = sizeof(mask),
+		.sin_addr = rt->mask
+	};
+	struct sockaddr_in gate = {
+		.sin_family = AF_INET,
+		.sin_len = sizeof(gate),
+		.sin_addr = rt->gate
+	};
+	struct sockaddr_in src = {
+		.sin_family = AF_INET,
+		.sin_len = sizeof(src),
+		.sin_addr = rt->src
+	};
+	struct sockaddr_in *g;
+	int addrs, flags;
+#ifdef RTP_CONNECTED
+	int priority = 0;
 #endif
 
-	if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
-		int subnet;
+	addrs = 0;
+	flags = 0;
 
-		rtm.hdr.rtm_addrs |= RTA_GATEWAY | RTA_IFA | RTA_IFP;
-		/* Subnet routes are clonning or connected if supported.
+	if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
+		addrs |= RTA_GATEWAY | RTA_IFP;
+		/* Subnet routes are cloning or connected if supported.
 		 * All other routes are static. */
-		subnet = ipv4_srcaddr(rt, &src_addr);
-		if (subnet == 1) {
+		if (rt->gate.s_addr == ntohl(INADDR_ANY)) {
 #ifdef RTF_CLONING
-			rtm.hdr.rtm_flags |= RTF_CLONING;
+			flags |= RTF_CLONING;
 #endif
 #ifdef RTF_CONNECTED
-			rtm.hdr.rtm_flags |= RTF_CONNECTED;
+			flags |= RTF_CONNECTED;
 #endif
 #ifdef RTP_CONNECTED
-			rtm.hdr.rtm_priority = RTP_CONNECTED;
+			priority = RTP_CONNECTED;
 #endif
 		} else
-			rtm.hdr.rtm_flags |= RTF_STATIC;
-		if (subnet == -1) /* unikely */
-			rtm.hdr.rtm_addrs &= ~RTA_IFA;
+			flags |= RTF_STATIC;
+		if (rt->src.s_addr != ntohl(INADDR_ANY))
+			addrs |= RTA_IFA;
 	}
+
 	if (rt->mask.s_addr == htonl(INADDR_BROADCAST) &&
 	    rt->gate.s_addr == htonl(INADDR_ANY))
 	{
@@ -701,76 +772,45 @@ if_route(unsigned char cmd, const struct
 		 * It might be more correct to use RTF_HOST instead of
 		 * RTF_CLONING, and that does work, but some OS generate
 		 * an arp warning diagnostic which we don't want to do. */
-		rtm.hdr.rtm_flags |= RTF_CLONING;
-		rtm.hdr.rtm_addrs |= RTA_NETMASK;
+		flags |= RTF_CLONING;
+		addrs |= RTA_NETMASK;
 #else
-		rtm.hdr.rtm_flags |= RTF_HOST;
+		flags |= RTF_HOST;
 #endif
 	} else if (rt->gate.s_addr == htonl(INADDR_LOOPBACK) &&
 	    rt->mask.s_addr == htonl(INADDR_BROADCAST))
 	{
-		rtm.hdr.rtm_flags |= RTF_HOST | RTF_GATEWAY;
+		flags |= RTF_HOST | RTF_GATEWAY;
 		/* Going via lo0 so remove the interface flags */
-		if (cmd == RTM_ADD)
-			rtm.hdr.rtm_addrs &= ~(RTA_IFA | RTA_IFP);
+		addrs &= ~(RTA_IFA | RTA_IFP);
 	} else {
-		rtm.hdr.rtm_addrs |= RTA_NETMASK;
-		if (rtm.hdr.rtm_flags & RTF_STATIC)
-			rtm.hdr.rtm_flags |= RTF_GATEWAY;
+		addrs |= RTA_NETMASK;
+		if (flags & RTF_STATIC)
+			flags |= RTF_GATEWAY;
 		if (rt->mask.s_addr == htonl(INADDR_BROADCAST))
-			rtm.hdr.rtm_flags |= RTF_HOST;
+			flags |= RTF_HOST;
 	}
-	if ((cmd == RTM_ADD || cmd == RTM_CHANGE) &&
-	    !(rtm.hdr.rtm_flags & RTF_GATEWAY))
-		rtm.hdr.rtm_addrs |= RTA_IFP;
 
-	ADDADDR(&rt->dest);
-	if (rtm.hdr.rtm_addrs & RTA_GATEWAY) {
-		if ((rtm.hdr.rtm_flags & RTF_HOST &&
-		    rt->gate.s_addr == htonl(INADDR_ANY)) ||
+	if ((flags & RTF_HOST && rt->gate.s_addr == htonl(INADDR_ANY)) ||
 #ifdef RTF_CLONING
-		    rtm.hdr.rtm_flags & RTF_CLONING ||
+	   flags & RTF_CLONING ||
 #endif
 #ifdef RTF_CONNECTED
-		    rtm.hdr.rtm_flags & RTF_CONNECTED ||
+	    flags & RTF_CONNECTED ||
 #endif
-		    !(rtm.hdr.rtm_flags & RTF_STATIC))
-		{
-			if_linkaddr(&su.sdl, rt->iface);
-			ADDSU;
-		} else
-			ADDADDR(&rt->gate);
-	}
-
-	if (rtm.hdr.rtm_addrs & RTA_NETMASK)
-		ADDADDR(&rt->mask);
-
-	if ((cmd == RTM_ADD || cmd == RTM_CHANGE) &&
-	    (rtm.hdr.rtm_addrs & (RTA_IFP | RTA_IFA)))
-	{
-		rtm.hdr.rtm_index = (unsigned short)rt->iface->index;
-		if (rtm.hdr.rtm_addrs & RTA_IFP) {
-			if_linkaddr(&su.sdl, rt->iface);
-			ADDSU;
-		}
-
-		if (rtm.hdr.rtm_addrs & RTA_IFA)
-			ADDADDR(&src_addr);
-
-		if (rt->mtu) {
-			rtm.hdr.rtm_inits |= RTV_MTU;
-			rtm.hdr.rtm_rmx.rmx_mtu = rt->mtu;
-		}
-	}
-
-#undef ADDADDR
-#undef ADDSU
-
-	rtm.hdr.rtm_msglen = (unsigned short)(bp - (char *)&rtm);
-	if (write(rt->iface->ctx->link_fd, &rtm, rtm.hdr.rtm_msglen) == -1)
-		return -1;
-	rt->iface->ctx->sseq = rt->iface->ctx->seq;
-	return 0;
+#ifdef RTP_CONNECTED
+	    priority != 0 ||
+#endif
+	    !(flags & RTF_STATIC))
+		g = NULL;
+	else
+		g = &gate;
+	return if_rtmsg(cmd, rt->iface, addrs, flags,
+#ifdef RTP_CONNECTED
+	    priority,
+#endif
+	    (struct sockaddr *)&dst, (struct sockaddr *)&mask,
+	    (struct sockaddr *)g, (struct sockaddr *)&src, rt->mtu);
 }
 
 int
@@ -813,23 +853,22 @@ if_initrt(struct dhcpcd_ctx *ctx)
 }
 
 int
-if_addrflags(const struct in_addr *addr, const struct interface *ifp)
+if_addrflags(const struct ipv4_addr *ia)
 {
 #ifdef SIOCGIFAFLAG_IN
 	struct ifreq ifr;
 	struct sockaddr_in *sin;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
+	strlcpy(ifr.ifr_name, ia->iface->name, sizeof(ifr.ifr_name));
 	sin = (void *)&ifr.ifr_addr;
 	sin->sin_family = AF_INET;
-	sin->sin_addr = *addr;
-	if (ioctl(ifp->ctx->pf_inet_fd, SIOCGIFAFLAG_IN, &ifr) == -1)
+	sin->sin_addr = ia->addr;
+	if (ioctl(ia->iface->ctx->pf_inet_fd, SIOCGIFAFLAG_IN, &ifr) == -1)
 		return -1;
 	return ifr.ifr_addrflags;
 #else
-	UNUSED(addr);
-	UNUSED(ifp);
+	UNUSED(ia);
 	return 0;
 #endif
 }
@@ -1022,114 +1061,63 @@ if_copyrt6(struct dhcpcd_ctx *ctx, struc
 int
 if_route6(unsigned char cmd, const struct rt6 *rt)
 {
-	union sockunion {
-		struct sockaddr sa;
-		struct sockaddr_in6 sin;
-		struct sockaddr_dl sdl;
-	} su;
-	struct rtm
-	{
-		struct rt_msghdr hdr;
-		char buffer[sizeof(su) * RTAX_MAX];
-	} rtm;
-	char *bp = rtm.buffer;
-	size_t l;
-
-	if ((cmd == RTM_ADD || cmd == RTM_DELETE || cmd == RTM_CHANGE) &&
-	    rt->iface->ctx->options & DHCPCD_DAEMONISE &&
-	    !(rt->iface->ctx->options & DHCPCD_DAEMONISED))
-		rt->iface->ctx->options |= DHCPCD_RTM_PPID;
-
-#define ADDSU {								      \
-		l = RT_ROUNDUP(su.sa.sa_len);				      \
-		memcpy(bp, &su, l);					      \
-		bp += l;						      \
-	}
-#define ADDADDRS(addr, scope) {						      \
-		memset(&su, 0, sizeof(su));				      \
-		su.sin.sin6_family = AF_INET6;				      \
-		su.sin.sin6_len = sizeof(su.sin);			      \
-		(&su.sin)->sin6_addr = *addr;				      \
-		if (scope)						      \
-			ifa_scope(&su.sin, scope);			      \
-		ADDSU;							      \
-	}
-#define ADDADDR(addr) ADDADDRS(addr, 0)
+	struct sockaddr_in6 dst = {
+		.sin6_family = AF_INET6,
+		.sin6_len = sizeof(dst),
+		.sin6_addr = rt->dest
+	};
+	struct sockaddr_in6 mask = {
+		.sin6_family = AF_INET6,
+		.sin6_len = sizeof(mask),
+		.sin6_addr = rt->mask
+	};
+	struct sockaddr_in6 gate = {
+		.sin6_family = AF_INET6,
+		.sin6_len = sizeof(gate),
+		.sin6_addr = rt->gate
+	};
+	struct sockaddr_in6 src = {
+		.sin6_family = AF_INET6,
+		.sin6_len = sizeof(src),
+		.sin6_addr = rt->src
+	};
+	struct sockaddr_in6 *g;
+	int addrs, flags;
+#ifdef RTP_CONNECTED
+	int priority = 0;
+#endif
 
-	memset(&rtm, 0, sizeof(rtm));
-	rtm.hdr.rtm_version = RTM_VERSION;
-	rtm.hdr.rtm_type = cmd;
-	rtm.hdr.rtm_flags = RTF_UP | (int)rt->flags;
-	rtm.hdr.rtm_pid = getpid();
-	rtm.hdr.rtm_seq = ++rt->iface->ctx->seq;
+	addrs = RTA_NETMASK;
+	flags = 0;
 #ifdef RTF_PINNED
-	if (rtm.hdr.rtm_type != RTM_ADD)
-		rtm.hdr.rtm_flags |= RTF_PINNED;
+	if (cmd != RTM_ADD)
+		flags |= RTF_PINNED;
 #endif
-	rtm.hdr.rtm_addrs = RTA_DST | RTA_NETMASK;
-	/* None interface subnet routes are static. */
+
 	if (IN6_IS_ADDR_UNSPECIFIED(&rt->gate)) {
 #ifdef RTF_CLONING
-		rtm.hdr.rtm_flags |= RTF_CLONING;
+		flags |= RTF_CLONING;
 #endif
 #ifdef RTF_CONNECTED
-		rtm.hdr.rtm_flags |= RTF_CONNECTED;
+		flags |= RTF_CONNECTED;
 #endif
 #ifdef RTP_CONNECTED
-		rtm.hdr.rtm_priority = RTP_CONNECTED;
+		priority = RTP_CONNECTED;
 #endif
 	} else
-		rtm.hdr.rtm_flags |= RTF_GATEWAY | RTF_STATIC;
-
-	if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
-		rtm.hdr.rtm_addrs |= RTA_GATEWAY;
-		if (!(rtm.hdr.rtm_flags & RTF_REJECT))
-			rtm.hdr.rtm_addrs |= RTA_IFP | RTA_IFA;
-	}
-
-	ADDADDR(&rt->dest);
-	if (rtm.hdr.rtm_addrs & RTA_GATEWAY) {
-		if (IN6_IS_ADDR_UNSPECIFIED(&rt->gate)) {
-			if_linkaddr(&su.sdl, rt->iface);
-			ADDSU;
-		} else {
-			ADDADDRS(&rt->gate, rt->iface->index);
-		}
-	}
-
-	if (rtm.hdr.rtm_addrs & RTA_NETMASK)
-		ADDADDR(&rt->mask);
-
-	if (rtm.hdr.rtm_addrs & (RTA_IFP | RTA_IFA)) {
-		rtm.hdr.rtm_index = (unsigned short)rt->iface->index;
-		if (rtm.hdr.rtm_addrs & RTA_IFP) {
-			if_linkaddr(&su.sdl, rt->iface);
-			ADDSU;
-		}
-
-		if (rtm.hdr.rtm_addrs & RTA_IFA) {
-			const struct ipv6_addr *lla;
-
-			lla = ipv6_linklocal(UNCONST(rt->iface));
-			if (lla == NULL) /* unlikely */
-					return -1;
-			ADDADDRS(&lla->addr, rt->iface->index);
-		}
+		flags |= RTF_GATEWAY | RTF_STATIC;
 
-		if (rt->mtu) {
-			rtm.hdr.rtm_inits |= RTV_MTU;
-			rtm.hdr.rtm_rmx.rmx_mtu = rt->mtu;
-		}
-	}
-
-#undef ADDADDR
-#undef ADDSU
+	if (IN6_IS_ADDR_UNSPECIFIED(&rt->gate))
+		g = NULL;
+	else
+		g = &gate;
 
-	rtm.hdr.rtm_msglen = (unsigned short)(bp - (char *)&rtm);
-	if (write(rt->iface->ctx->link_fd, &rtm, rtm.hdr.rtm_msglen) == -1)
-		return -1;
-	rt->iface->ctx->sseq = rt->iface->ctx->seq;
-	return 0;
+	return if_rtmsg(cmd, rt->iface, addrs, flags,
+#ifdef RTP_CONNECTED
+	    priority,
+#endif
+	    (struct sockaddr *)&dst, (struct sockaddr *)&mask,
+	    (struct sockaddr *)g, (struct sockaddr *)&src, rt->mtu);
 }
 
 int
@@ -1172,18 +1160,18 @@ if_initrt6(struct dhcpcd_ctx *ctx)
 }
 
 int
-if_addrflags6(const struct in6_addr *addr, const struct interface *ifp)
+if_addrflags6(const struct ipv6_addr *ia)
 {
 	int flags;
 	struct in6_ifreq ifr6;
 	struct priv *priv;
 
 	memset(&ifr6, 0, sizeof(ifr6));
-	strlcpy(ifr6.ifr_name, ifp->name, sizeof(ifr6.ifr_name));
+	strlcpy(ifr6.ifr_name, ia->iface->name, sizeof(ifr6.ifr_name));
 	ifr6.ifr_addr.sin6_family = AF_INET6;
-	ifr6.ifr_addr.sin6_addr = *addr;
-	ifa_scope(&ifr6.ifr_addr, ifp->index);
-	priv = (struct priv *)ifp->ctx->priv;
+	ifr6.ifr_addr.sin6_addr = ia->addr;
+	ifa_scope(&ifr6.ifr_addr, ia->iface->index);
+	priv = (struct priv *)ia->iface->ctx->priv;
 	if (ioctl(priv->pf_inet6_fd, SIOCGIFAFLAG_IN6, &ifr6) != -1)
 		flags = ifr6.ifr_ifru.ifru_flags6;
 	else
@@ -1382,7 +1370,6 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 	{
 		const struct sockaddr_in *sin;
 		struct in_addr addr, mask, bcast;
-		int flags;
 
 		sin = (const void *)rti_info[RTAX_IFA];
 		addr.s_addr = sin != NULL && sin->sin_family == AF_INET ?
@@ -1393,13 +1380,8 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 		sin = (const void *)rti_info[RTAX_BRD];
 		bcast.s_addr = sin != NULL && sin->sin_family == AF_INET ?
 		    sin->sin_addr.s_addr : INADDR_ANY;
-		if (ifam->ifam_type == RTM_NEWADDR) {
-			if ((flags = if_addrflags(&addr, ifp)) == -1)
-				break;
-		} else
-			flags = 0;
 		ipv4_handleifa(ctx, ifam->ifam_type, NULL, ifp->name,
-		    &addr, &mask, &bcast, flags);
+		    &addr, &mask, &bcast);
 		break;
 	}
 #endif
@@ -1408,7 +1390,6 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 	{
 		struct in6_addr addr6, mask6;
 		const struct sockaddr_in6 *sin6;
-		int flags;
 
 		sin6 = (const void *)rti_info[RTAX_IFA];
 		addr6 = sin6->sin6_addr;
@@ -1416,13 +1397,8 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 		sin6 = (const void *)rti_info[RTAX_NETMASK];
 		mask6 = sin6->sin6_addr;
 		DESCOPE(&mask6);
-		if (ifam->ifam_type == RTM_NEWADDR) {
-			if ((flags = if_addrflags6(&addr6, ifp)) == -1)
-				break;
-		} else
-			flags = 0;
 		ipv6_handleifa(ctx, ifam->ifam_type, NULL,
-		    ifp->name, &addr6, ipv6_prefixlen(&mask6), flags);
+		    ifp->name, &addr6, ipv6_prefixlen(&mask6));
 		break;
 	}
 #endif

Index: src/external/bsd/dhcpcd/dist/if-options.c
diff -u src/external/bsd/dhcpcd/dist/if-options.c:1.34 src/external/bsd/dhcpcd/dist/if-options.c:1.35
--- src/external/bsd/dhcpcd/dist/if-options.c:1.34	Fri Jun 17 19:42:31 2016
+++ src/external/bsd/dhcpcd/dist/if-options.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.34 2016/06/17 19:42:31 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.35 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -104,6 +104,7 @@
 #define O_NODELAY		O_BASE + 44
 #define O_INFORM6		O_BASE + 45
 #define O_LASTLEASE_EXTEND	O_BASE + 46
+#define O_INACTIVE		O_BASE + 47
 
 const struct option cf_options[] = {
 	{"background",      no_argument,       NULL, 'b'},
@@ -203,6 +204,7 @@ const struct option cf_options[] = {
 	{"nodelay",         no_argument,       NULL, O_NODELAY},
 	{"noup",            no_argument,       NULL, O_NOUP},
 	{"lastleaseextend", no_argument,       NULL, O_LASTLEASE_EXTEND},
+	{"inactive",        no_argument,       NULL, O_INACTIVE},
 	{NULL,              0,                 NULL, '\0'}
 };
 
@@ -1179,8 +1181,8 @@ parse_option(struct dhcpcd_ctx *ctx, con
 			}
 			nconf = realloc(ifo->config, sizeof(char *) * (dl + 2));
 			if (nconf == NULL) {
-				free(p);
 				logger(ctx, LOG_ERR, "%s: %m", __func__);
+				free(p);
 				return -1;
 			}
 			ifo->config = nconf;
@@ -2136,6 +2138,9 @@ err_sla:
 	case O_LASTLEASE_EXTEND:
 		ifo->options |= DHCPCD_LASTLEASE | DHCPCD_LASTLEASE_EXTEND;
 		break;
+	case O_INACTIVE:
+		ifo->options |= DHCPCD_INACTIVE;
+		break;
 	default:
 		return 0;
 	}
@@ -2343,19 +2348,25 @@ read_config(struct dhcpcd_ctx *ctx,
 		buf = malloc(buflen);
 		if (buf == NULL) {
 			logger(ctx, LOG_ERR, "%s: %m", __func__);
+			free_options(ifo);
 			return NULL;
 		}
 		ldop = edop = NULL;
 		for (e = dhcpcd_embedded_conf; *e; e++) {
 			ol = strlen(*e) + 1;
 			if (ol > buflen) {
+				char *nbuf;
+
 				buflen = ol;
-				buf = realloc(buf, buflen);
-				if (buf == NULL) {
-					logger(ctx, LOG_ERR, "%s: %m", __func__);
+				nbuf = realloc(buf, buflen);
+				if (nbuf == NULL) {
+					logger(ctx, LOG_ERR,
+					    "%s: %m", __func__);
 					free(buf);
+					free_options(ifo);
 					return NULL;
 				}
+				buf = nbuf;
 			}
 			memcpy(buf, *e, ol);
 			line = buf;

Index: src/external/bsd/dhcpcd/dist/if-options.h
diff -u src/external/bsd/dhcpcd/dist/if-options.h:1.19 src/external/bsd/dhcpcd/dist/if-options.h:1.20
--- src/external/bsd/dhcpcd/dist/if-options.h:1.19	Mon May  9 10:15:59 2016
+++ src/external/bsd/dhcpcd/dist/if-options.h	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: if-options.h,v 1.19 2016/05/09 10:15:59 roy Exp $ */
+/* $NetBSD: if-options.h,v 1.20 2016/07/29 10:07:58 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -117,6 +117,7 @@
 #define DHCPCD_INITIAL_DELAY		(1ULL << 58)
 #define DHCPCD_PRINT_PIDFILE		(1ULL << 59)
 #define DHCPCD_ONESHOT			(1ULL << 60)
+#define DHCPCD_INACTIVE			(1ULL << 61)
 
 #define DHCPCD_NODROP	(DHCPCD_EXITING | DHCPCD_PERSISTENT)
 
Index: src/external/bsd/dhcpcd/dist/ipv6.c
diff -u src/external/bsd/dhcpcd/dist/ipv6.c:1.19 src/external/bsd/dhcpcd/dist/ipv6.c:1.20
--- src/external/bsd/dhcpcd/dist/ipv6.c:1.19	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/ipv6.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv6.c,v 1.19 2016/06/17 19:42:32 roy Exp $");
+ __RCSID("$NetBSD: ipv6.c,v 1.20 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -102,15 +102,22 @@
 #  endif
 #endif
 
-#if defined(HAVE_IN6_ADDR_GEN_MODE_NONE) || defined(ND6_IFF_AUTO_LINKLOCAL)
+#if defined(HAVE_IN6_ADDR_GEN_MODE_NONE) || defined(ND6_IFF_AUTO_LINKLOCAL) || \
+    defined(IFF_NOLINKLOCAL)
 /* If we're using a private SLAAC address on wireless,
  * don't add it until we have associated as we randomise
  * it based on the SSID. */
 #define CAN_ADD_LLADDR(ifp) \
 	(!((ifp)->options->options & DHCPCD_SLAACPRIVATE) || \
 	    (ifp)->carrier != LINK_DOWN)
-#else
+#elif __NetBSD__
+/* Earlier versions of NetBSD don't add duplicate LLADDR's if the interface
+ * is brought up and one already exists. */
 #define CAN_ADD_LLADDR(ifp) (1)
+#else
+/* We have no control over the OS adding the LLADDR, so just let it do it
+ * as we cannot force our own view on it. */
+#define CAN_ADD_LLADDR(ifp) (0)
 #endif
 
 #ifdef IPV6_MANAGETEMPADDR
@@ -562,24 +569,29 @@ ipv6_userprefix(
 void
 ipv6_checkaddrflags(void *arg)
 {
-	struct ipv6_addr *ap;
-	int ifa_flags;
+	struct ipv6_addr *ia;
+	int flags;
+
+	ia = arg;
+	if ((flags = if_addrflags6(ia)) == -1) {
+		logger(ia->iface->ctx, LOG_ERR,
+		    "%s: if_addrflags6: %m", ia->iface->name);
+		return;
+	}
 
-	ap = arg;
-	ifa_flags = if_addrflags6(&ap->addr, ap->iface);
-	if (ifa_flags == -1)
-		logger(ap->iface->ctx, LOG_ERR,
-		    "%s: if_addrflags6: %m", ap->iface->name);
-	else if (!(ifa_flags & IN6_IFF_TENTATIVE)) {
-		ipv6_handleifa(ap->iface->ctx, RTM_NEWADDR,
-		    ap->iface->ctx->ifaces, ap->iface->name,
-		    &ap->addr, ap->prefix_len, ifa_flags);
+	ia->addr_flags = flags;
+	if (!(ia->addr_flags & IN6_IFF_TENTATIVE)) {
+		/* Simulate the kernel announcing the new address. */
+		ipv6_handleifa(ia->iface->ctx, RTM_NEWADDR,
+		    ia->iface->ctx->ifaces, ia->iface->name,
+		    &ia->addr, ia->prefix_len);
 	} else {
+		/* Still tentative? Check again in a bit. */
 		struct timespec tv;
 
 		ms_to_ts(&tv, RETRANS_TIMER / 2);
-		eloop_timeout_add_tv(ap->iface->ctx->eloop, &tv,
-		    ipv6_checkaddrflags, ap);
+		eloop_timeout_add_tv(ia->iface->ctx->eloop, &tv,
+		    ipv6_checkaddrflags, ia);
 	}
 }
 #endif
@@ -613,8 +625,8 @@ ipv6_deleteaddr(struct ipv6_addr *ia)
 	}
 }
 
-int
-ipv6_addaddr(struct ipv6_addr *ap, const struct timespec *now)
+static int
+ipv6_addaddr1(struct ipv6_addr *ap, const struct timespec *now)
 {
 	struct interface *ifp;
 	struct ipv6_state *state;
@@ -745,9 +757,119 @@ ipv6_addaddr(struct ipv6_addr *ap, const
 	}
 #endif
 
+#ifdef __sun
+	/* Solaris does not announce new addresses which need DaD
+	 * so we need to take a copy and add it to our list.
+	 * Otherwise aliasing gets confused if we add another
+	 * address during DaD. */
+
+	state = IPV6_STATE(ap->iface);
+	TAILQ_FOREACH(nap, &state->addrs, next) {
+		if (IN6_ARE_ADDR_EQUAL(&nap->addr, &ap->addr))
+			break;
+	}
+	if (nap == NULL) {
+		if ((nap = malloc(sizeof(*nap))) == NULL) {
+			syslog(LOG_ERR, "%s: malloc: %m", __func__);
+			return 0; /* Well, we did add the address */
+		}
+		memcpy(nap, ap, sizeof(*nap));
+		TAILQ_INSERT_TAIL(&state->addrs, nap, next);
+	}
+#endif
+
 	return 0;
 }
 
+#ifdef ALIAS_ADDR
+/* Find the next logical aliase address we can use. */
+static int
+ipv6_aliasaddr(struct ipv6_addr *ia, struct ipv6_addr **repl)
+{
+	struct ipv6_state *state;
+	struct ipv6_addr *iap;
+	unsigned int unit;
+	char alias[IF_NAMESIZE];
+
+	if (ia->alias[0] != '\0')
+		return 0;
+	state = IPV6_STATE(ia->iface);
+
+	/* First find an existng address.
+	 * This can happen when dhcpcd restarts as ND and DHCPv6
+	 * maintain their own lists of addresses. */
+	TAILQ_FOREACH(iap, &state->addrs, next) {
+		if (iap->alias[0] != '\0' &&
+		    IN6_ARE_ADDR_EQUAL(&iap->addr, &ia->addr))
+		{
+			strlcpy(ia->alias, iap->alias, sizeof(ia->alias));
+			return 0;
+		}
+	}
+
+	unit = 0;
+find_unit:
+	if (unit == 0)
+		strlcpy(alias, ia->iface->name, sizeof(alias));
+	else
+		snprintf(alias, sizeof(alias), "%s:%u", ia->iface->name, unit);
+	TAILQ_FOREACH(iap, &state->addrs, next) {
+		if (iap->alias[0] == '\0')
+			continue;
+		if (IN6_IS_ADDR_UNSPECIFIED(&iap->addr)) {
+			/* No address assigned? Lets use it. */
+			strlcpy(ia->alias, iap->alias, sizeof(ia->alias));
+			if (repl)
+				*repl = iap;
+			return 1;
+		}
+		if (strcmp(iap->alias, alias) == 0)
+			break;
+	}
+
+	if (iap != NULL) {
+		if (unit == UINT_MAX) {
+			errno = ERANGE;
+			return -1;
+		}
+		unit++;
+		goto find_unit;
+	}
+
+	strlcpy(ia->alias, alias, sizeof(ia->alias));
+	return 0;
+}
+#endif
+
+int
+ipv6_addaddr(struct ipv6_addr *ia, const struct timespec *now)
+{
+	int r;
+#ifdef ALIAS_ADDR
+	int replaced, blank;
+	struct ipv6_addr *replaced_ia;
+
+	blank = (ia->alias[0] == '\0');
+	if ((replaced = ipv6_aliasaddr(ia, &replaced_ia)) == -1)
+		return -1;
+	if (blank)
+		logger(ia->iface->ctx, LOG_DEBUG, "%s: aliased %s",
+		    ia->alias, ia->saddr);
+#endif
+
+	if ((r = ipv6_addaddr1(ia, now)) == 0) {
+#ifdef ALIAS_ADDR
+		if (replaced) {
+			struct ipv6_state *state;
+
+			state = IPV6_STATE(ia->iface);
+			TAILQ_REMOVE(&state->addrs, replaced_ia, next);
+			ipv6_freeaddr(replaced_ia);
+		}
+#endif
+	}
+	return r;
+}
 
 int
 ipv6_findaddrmatch(const struct ipv6_addr *addr, const struct in6_addr *match,
@@ -941,12 +1063,13 @@ ipv6_getstate(struct interface *ifp)
 void
 ipv6_handleifa(struct dhcpcd_ctx *ctx,
     int cmd, struct if_head *ifs, const char *ifname,
-    const struct in6_addr *addr, uint8_t prefix_len, int flags)
+    const struct in6_addr *addr, uint8_t prefix_len)
 {
 	struct interface *ifp;
 	struct ipv6_state *state;
-	struct ipv6_addr *ap;
+	struct ipv6_addr *ia;
 	struct ll_callback *cb;
+	int flags;
 
 #if 0
 	char dbuf[INET6_ADDRSTRLEN];
@@ -954,60 +1077,55 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
 
 	dbp = inet_ntop(AF_INET6, &addr->s6_addr,
 	    dbuf, INET6_ADDRSTRLEN);
-	logger(ctx, LOG_INFO, "%s: cmd %d addr %s flags %d",
-	    ifname, cmd, dbp, flags);
+	logger(ctx, LOG_INFO, "%s: cmd %d addr %s",
+	    ifname, cmd, dbp);
 #endif
 
 	if (ifs == NULL)
 		ifs = ctx->ifaces;
-	if (ifs == NULL) {
-		errno = ESRCH;
+	if (ifs == NULL)
 		return;
-	}
 	if ((ifp = if_find(ifs, ifname)) == NULL)
 		return;
 	if ((state = ipv6_getstate(ifp)) == NULL)
 		return;
 
-	if (!IN6_IS_ADDR_LINKLOCAL(addr)) {
-		ipv6nd_handleifa(ctx, cmd, ifname, addr, flags);
-		dhcp6_handleifa(ctx, cmd, ifname, addr, flags);
-	}
-
-	TAILQ_FOREACH(ap, &state->addrs, next) {
-		if (IN6_ARE_ADDR_EQUAL(&ap->addr, addr))
+	TAILQ_FOREACH(ia, &state->addrs, next) {
+		if (IN6_ARE_ADDR_EQUAL(&ia->addr, addr))
 			break;
 	}
 
 	switch (cmd) {
 	case RTM_DELADDR:
-		if (ap) {
-			TAILQ_REMOVE(&state->addrs, ap, next);
-			ipv6_freeaddr(ap);
+		if (ia != NULL) {
+			TAILQ_REMOVE(&state->addrs, ia, next);
+			/* We'll free it at the end of the function. */
 		}
 		break;
 	case RTM_NEWADDR:
-		if (ap == NULL) {
+		if (ia == NULL) {
 			char buf[INET6_ADDRSTRLEN];
 			const char *cbp;
 
-			ap = calloc(1, sizeof(*ap));
-			if (ap == NULL) {
+			if ((ia = calloc(1, sizeof(*ia))) == NULL) {
 				logger(ctx, LOG_ERR,
 				    "%s: calloc: %m", __func__);
 				break;
 			}
-			ap->iface = ifp;
-			ap->addr = *addr;
-			ap->prefix_len = prefix_len;
-			ipv6_makeprefix(&ap->prefix, &ap->addr,
-			    ap->prefix_len);
+#ifdef ALIAS_ADDR
+			strlcpy(ia->alias, ifname, sizeof(ia->alias));
+#endif
+			ia->iface = ifp;
+			ia->addr = *addr;
+			ia->prefix_len = prefix_len;
+			ipv6_makeprefix(&ia->prefix, &ia->addr,
+			    ia->prefix_len);
 			cbp = inet_ntop(AF_INET6, &addr->s6_addr,
 			    buf, sizeof(buf));
 			if (cbp)
-				snprintf(ap->saddr, sizeof(ap->saddr),
+				snprintf(ia->saddr, sizeof(ia->saddr),
 				    "%s/%d", cbp, prefix_len);
-			if (if_getlifetime6(ap) == -1) {
+			if (if_getlifetime6(ia) == -1) {
 				/* No support or address vanished.
 				 * Either way, just set a deprecated
 				 * infinite time lifetime and continue.
@@ -1016,8 +1134,8 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
 				 * temporary addresses.
 				 * As we can't extend infinite, we'll
 				 * create a new temporary address. */
-				ap->prefix_pltime = 0;
-				ap->prefix_vltime =
+				ia->prefix_pltime = 0;
+				ia->prefix_vltime =
 				    ND6_INFINITE_LIFETIME;
 			}
 			/* This is a minor regression against RFC 4941
@@ -1030,33 +1148,39 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
 			 * pretend lifetimes are infinite and always
 			 * generate a new temporary address on
 			 * restart. */
-			ap->acquired = ap->created;
-			TAILQ_INSERT_TAIL(&state->addrs,
-			    ap, next);
+			ia->acquired = ia->created;
+			TAILQ_INSERT_TAIL(&state->addrs, ia, next);
+		}
+		flags = if_addrflags6(ia);
+		if (flags == -1) {
+			logger(ia->iface->ctx, LOG_ERR,
+			    "%s: %s: if_addrflags6: %m",
+			    ia->iface->name, ia->saddr);
+			return;
 		}
-		ap->addr_flags = flags;
+		ia->addr_flags = flags;
 #ifdef IPV6_MANAGETEMPADDR
-		if (ap->addr_flags & IN6_IFF_TEMPORARY)
-			ap->flags |= IPV6_AF_TEMPORARY;
+		if (ia->addr_flags & IN6_IFF_TEMPORARY)
+			ia->flags |= IPV6_AF_TEMPORARY;
 #endif
-		if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) || ap->dadcallback) {
+		if (IN6_IS_ADDR_LINKLOCAL(&ia->addr) || ia->dadcallback) {
 #ifdef IPV6_POLLADDRFLAG
-			if (ap->addr_flags & IN6_IFF_TENTATIVE) {
+			if (ia->addr_flags & IN6_IFF_TENTATIVE) {
 				struct timespec tv;
 
 				ms_to_ts(&tv, RETRANS_TIMER / 2);
 				eloop_timeout_add_tv(
-				    ap->iface->ctx->eloop,
-				    &tv, ipv6_checkaddrflags, ap);
+				    ia->iface->ctx->eloop,
+				    &tv, ipv6_checkaddrflags, ia);
 				break;
 			}
 #endif
 
-			if (ap->dadcallback)
-				ap->dadcallback(ap);
+			if (ia->dadcallback)
+				ia->dadcallback(ia);
 
-			if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) &&
-			    !(ap->addr_flags & IN6_IFF_NOTUSEABLE))
+			if (IN6_IS_ADDR_LINKLOCAL(&ia->addr) &&
+			    !(ia->addr_flags & IN6_IFF_NOTUSEABLE))
 			{
 				/* Now run any callbacks.
 				 * Typically IPv6RS or DHCPv6 */
@@ -1073,6 +1197,17 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx,
 		}
 		break;
 	}
+
+	if (ia != NULL) {
+		if (!IN6_IS_ADDR_LINKLOCAL(&ia->addr)) {
+			ipv6nd_handleifa(cmd, ia);
+			dhcp6_handleifa(cmd, ia);
+		}
+
+		/* Done with the ia now, so free it. */
+		if (cmd == RTM_DELADDR)
+			ipv6_freeaddr(ia);
+	}
 }
 
 int
@@ -1530,44 +1665,45 @@ ipv6_ctxfree(struct dhcpcd_ctx *ctx)
 
 int
 ipv6_handleifa_addrs(int cmd,
-    struct ipv6_addrhead *addrs, const struct in6_addr *addr, int flags)
+    struct ipv6_addrhead *addrs, const struct ipv6_addr *addr)
 {
-	struct ipv6_addr *ap, *apn;
+	struct ipv6_addr *ia, *ian;
 	uint8_t found, alldadcompleted;
 
 	alldadcompleted = 1;
 	found = 0;
-	TAILQ_FOREACH_SAFE(ap, addrs, next, apn) {
-		if (!IN6_ARE_ADDR_EQUAL(addr, &ap->addr)) {
-			if (ap->flags & IPV6_AF_ADDED &&
-			    !(ap->flags & IPV6_AF_DADCOMPLETED))
+	TAILQ_FOREACH_SAFE(ia, addrs, next, ian) {
+		if (!IN6_ARE_ADDR_EQUAL(&addr->addr, &ia->addr)) {
+			if (ia->flags & IPV6_AF_ADDED &&
+			    !(ia->flags & IPV6_AF_DADCOMPLETED))
 				alldadcompleted = 0;
 			continue;
 		}
 		switch (cmd) {
 		case RTM_DELADDR:
-			if (ap->flags & IPV6_AF_ADDED) {
-				logger(ap->iface->ctx, LOG_INFO,
+			if (ia->flags & IPV6_AF_ADDED) {
+				logger(ia->iface->ctx, LOG_INFO,
 				    "%s: deleted address %s",
-				    ap->iface->name, ap->saddr);
-				ap->flags &= ~IPV6_AF_ADDED;
+				    ia->iface->name, ia->saddr);
+				ia->flags &= ~IPV6_AF_ADDED;
 			}
 			break;
 		case RTM_NEWADDR:
 			/* Safety - ignore tentative announcements */
-			if (flags & (IN6_IFF_DETACHED |IN6_IFF_TENTATIVE))
+			if (addr->addr_flags &
+			    (IN6_IFF_DETACHED | IN6_IFF_TENTATIVE))
 				break;
-			if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0) {
+			if ((ia->flags & IPV6_AF_DADCOMPLETED) == 0) {
 				found++;
-				if (flags & IN6_IFF_DUPLICATED)
-					ap->flags |= IPV6_AF_DUPLICATED;
+				if (addr->addr_flags & IN6_IFF_DUPLICATED)
+					ia->flags |= IPV6_AF_DUPLICATED;
 				else
-					ap->flags &= ~IPV6_AF_DUPLICATED;
-				if (ap->dadcallback)
-					ap->dadcallback(ap);
+					ia->flags &= ~IPV6_AF_DUPLICATED;
+				if (ia->dadcallback)
+					ia->dadcallback(ia);
 				/* We need to set this here in-case the
 				 * dadcallback function checks it */
-				ap->flags |= IPV6_AF_DADCOMPLETED;
+				ia->flags |= IPV6_AF_DADCOMPLETED;
 			}
 			break;
 		}
@@ -2214,6 +2350,7 @@ make_prefix(const struct interface *ifp,
 		r->gate = in6addr_loopback;
 	} else
 		r->gate = in6addr_any;
+	r->src = addr->addr;
 	return r;
 }
 
@@ -2322,11 +2459,14 @@ ipv6_buildroutes(struct dhcpcd_ctx *ctx)
 
 	/* Should static take priority? */
 	ipv6_build_static_routes(ctx, &dnr);
+#ifdef HAVE_ROUTE_METRIC
+	rt = TAILQ_LAST(&dnr, rt6_head);
+#endif
 
 	/* First add reachable routers and their prefixes */
 	ipv6_build_ra_routes(ctx->ipv6, &dnr, 0);
 #ifdef HAVE_ROUTE_METRIC
-	have_default = (TAILQ_FIRST(&dnr) != NULL);
+	have_default = (rt != TAILQ_LAST(&dnr, rt6_head));
 #endif
 
 	/* We have no way of knowing if prefixes added by DHCP are reachable
@@ -2359,15 +2499,14 @@ ipv6_buildroutes(struct dhcpcd_ctx *ctx)
 		/* Is this route already in our table? */
 		if (find_route6(nrs, rt) != NULL)
 			continue;
-		//rt->src.s_addr = ifp->addr.s_addr;
 		/* Do we already manage it? */
 		if ((or = find_route6(ctx->ipv6->routes, rt))) {
 			if (or->iface != rt->iface ||
 #ifdef HAVE_ROUTE_METRIC
 			    rt->metric != or->metric ||
 #endif
-		//	    or->src.s_addr != ifp->addr.s_addr ||
 			    !IN6_ARE_ADDR_EQUAL(&or->gate, &rt->gate) ||
+			    // !IN6_ARE_ADDR_EQUAL(&or->src, &rt->src) ||
 			    or->mtu != rt->mtu)
 			{
 				if (c_route(or, rt) != 0)
Index: src/external/bsd/dhcpcd/dist/ipv6.h
diff -u src/external/bsd/dhcpcd/dist/ipv6.h:1.19 src/external/bsd/dhcpcd/dist/ipv6.h:1.20
--- src/external/bsd/dhcpcd/dist/ipv6.h:1.19	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/ipv6.h	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ipv6.h,v 1.19 2016/06/17 19:42:32 roy Exp $ */
+/* $NetBSD: ipv6.h,v 1.20 2016/07/29 10:07:58 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -34,6 +34,7 @@
 #include <netinet/in.h>
 
 #include "config.h"
+#include "if.h"
 
 #ifndef __linux__
 #  if !defined(__QNX__) && !defined(__sun)
@@ -137,6 +138,16 @@
 #  define IN6_IFF_DETACHED	0
 #endif
 
+#ifdef __sun
+   /* Solaris lacks these defines.
+    * While it supports DaD, to seems to only expose IFF_DUPLICATE
+    * so we have no way of knowing if it's tentative or not.
+    * I don't even know if Solaris has any special treatment for tentative. */
+#  define IN6_IFF_TENTATIVE	0
+#  define IN6_IFF_DUPLICATED	0x04
+#  define IN6_IFF_DETACHED	0
+#endif
+
 #define IN6_IFF_NOTUSEABLE \
 	(IN6_IFF_TENTATIVE | IN6_IFF_DUPLICATED | IN6_IFF_DETACHED)
 
@@ -169,6 +180,10 @@ struct ipv6_addr {
 	uint8_t *ns;
 	size_t nslen;
 	int nsprobes;
+
+#ifdef ALIAS_ADDR
+	char alias[IF_NAMESIZE];
+#endif
 };
 
 #define	IPV6_AF_ONLINK		0x0001
@@ -194,6 +209,7 @@ struct rt6 {
 	struct in6_addr mask;
 	struct in6_addr gate;
 	const struct interface *iface;
+	struct in6_addr src;
 	unsigned int flags;
 #ifdef HAVE_ROUTE_METRIC
 	unsigned int metric;
@@ -286,9 +302,8 @@ ssize_t ipv6_addaddrs(struct ipv6_addrhe
 void ipv6_freedrop_addrs(struct ipv6_addrhead *, int,
     const struct interface *);
 void ipv6_handleifa(struct dhcpcd_ctx *ctx, int, struct if_head *,
-    const char *, const struct in6_addr *, uint8_t, int);
-int ipv6_handleifa_addrs(int, struct ipv6_addrhead *,
-    const struct in6_addr *, int);
+    const char *, const struct in6_addr *, uint8_t);
+int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, const struct ipv6_addr *);
 struct ipv6_addr *ipv6_iffindaddr(struct interface *,
     const struct in6_addr *, int);
 int ipv6_hasaddr(const struct interface *);

Index: src/external/bsd/dhcpcd/dist/if.h
diff -u src/external/bsd/dhcpcd/dist/if.h:1.17 src/external/bsd/dhcpcd/dist/if.h:1.18
--- src/external/bsd/dhcpcd/dist/if.h:1.17	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/if.h	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: if.h,v 1.17 2016/06/17 19:42:32 roy Exp $ */
+/* $NetBSD: if.h,v 1.18 2016/07/29 10:07:58 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -53,6 +53,21 @@
 #  endif
 #endif
 
+/*
+ * Systems which handle 1 address per alias.
+ * Currenly this is just Solaris.
+ * While Linux can do aliased addresses, it is only useful for their
+ * legacy ifconfig(8) tool which cannot display >1 IPv4 address
+ * (it can display many IPv6 addresses which makes the limitation odd).
+ * Linux has ip(8) which is a more feature rich tool, without the above
+ * restriction.
+ */
+#ifndef ALIAS_ADDR
+#  ifdef __sun
+#    define ALIAS_ADDR
+#  endif
+#endif
+
 #include "config.h"
 #include "dhcpcd.h"
 #include "ipv4.h"
@@ -82,16 +97,19 @@
 	    ((addr & IN_CLASSB_NET) == 0xc0a80000))
 #endif
 
-#define RAW_PARTIALCSUM		1 << 0
+#define RAW_EOF			1 << 0
+#define RAW_PARTIALCSUM		2 << 0
 
 #ifdef __sun
+/* Solaris stupidly defines this for compat with BSD
+ * but then ignores it. */
+#undef RTF_CLONING
+
 /* Solaris getifaddrs is very un-suitable for dhcpcd.
  * See if-sun.c for details why. */
 struct ifaddrs;
 int if_getifaddrs(struct ifaddrs **);
 #define	getifaddrs	if_getifaddrs
-#else
-#define GETIFADDRS_AFLINK
 #endif
 
 int if_setflag(struct interface *ifp, short flag);
@@ -106,6 +124,20 @@ int if_domtu(const struct interface *, s
 #define if_setmtu(ifp, mtu) if_domtu((ifp), (mtu))
 int if_carrier(struct interface *);
 
+/*
+ * Helper to decode an interface name of bge0:1 to
+ * devname = bge0, drvname = bge0, ppa = 0, lun = 1.
+ * If ppa or lun are invalid they are set to -1.
+ */
+struct if_spec {
+	char ifname[IF_NAMESIZE];
+	char devname[IF_NAMESIZE];
+	char drvname[IF_NAMESIZE];
+	int ppa;
+	int lun;
+};
+int if_nametospec(const char *, struct if_spec *);
+
 /* The below functions are provided by if-KERNEL.c */
 int if_conf(struct interface *);
 int if_init(struct interface *);
@@ -149,7 +181,7 @@ ssize_t if_readraw(struct interface *, i
 void if_closeraw(struct interface *, int);
 
 int if_address(unsigned char, const struct ipv4_addr *);
-int if_addrflags(const struct in_addr *, const struct interface *);
+int if_addrflags(const struct ipv4_addr *);
 
 int if_route(unsigned char, const struct rt *rt);
 int if_initrt(struct dhcpcd_ctx *);
@@ -166,7 +198,7 @@ int ip6_temp_valid_lifetime(const char *
 #endif
 
 int if_address6(unsigned char, const struct ipv6_addr *);
-int if_addrflags6(const struct in6_addr *, const struct interface *);
+int if_addrflags6(const struct ipv6_addr *);
 int if_getlifetime6(struct ipv6_addr *);
 
 int if_route6(unsigned char, const struct rt6 *rt);
Index: src/external/bsd/dhcpcd/dist/ipv4ll.c
diff -u src/external/bsd/dhcpcd/dist/ipv4ll.c:1.17 src/external/bsd/dhcpcd/dist/ipv4ll.c:1.18
--- src/external/bsd/dhcpcd/dist/ipv4ll.c:1.17	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/ipv4ll.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv4ll.c,v 1.17 2016/06/17 19:42:32 roy Exp $");
+ __RCSID("$NetBSD: ipv4ll.c,v 1.18 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -247,7 +247,6 @@ ipv4ll_conflicted(struct arp_state *asta
 	ifp = astate->iface;
 	state = IPV4LL_STATE(ifp);
 	assert(state != NULL);
-	assert(state->addr != NULL);
 
 	fail = 0;
 	/* RFC 3927 2.2.1, Probe Conflict Detection */
@@ -257,7 +256,8 @@ ipv4ll_conflicted(struct arp_state *asta
 		fail = astate->addr.s_addr;
 
 	/* RFC 3927 2.5, Conflict Defense */
-	if (IN_LINKLOCAL(ntohl(state->addr->addr.s_addr)) &&
+	if (state->addr != NULL &&
+	    IN_LINKLOCAL(ntohl(state->addr->addr.s_addr)) &&
 	    amsg && amsg->sip.s_addr == state->addr->addr.s_addr)
 		fail = state->addr->addr.s_addr;
 
@@ -267,7 +267,9 @@ ipv4ll_conflicted(struct arp_state *asta
 	astate->failed.s_addr = fail;
 	arp_report_conflicted(astate, amsg);
 
-	if (astate->failed.s_addr == state->addr->addr.s_addr) {
+	if (state->addr != NULL &&
+	    astate->failed.s_addr == state->addr->addr.s_addr)
+	{
 		struct timespec now, defend;
 
 		/* RFC 3927 Section 2.5 says a defence should
@@ -383,12 +385,14 @@ ipv4ll_start(void *arg)
 
 	/* Find an existing IPv4LL address and ensure we can work with it. */
 	ia = ipv4_iffindlladdr(ifp);
+
 #ifdef IN_IFF_TENTATIVE
 	if (ia != NULL && ia->addr_flags & IN_IFF_DUPLICATED) {
 		ipv4_deladdr(ia, 0);
 		ia = NULL;
 	}
 #endif
+
 	if (ia != NULL) {
 		astate->addr = ia->addr;
 #ifdef IN_IFF_TENTATIVE

Index: src/external/bsd/dhcpcd/dist/ipv4.c
diff -u src/external/bsd/dhcpcd/dist/ipv4.c:1.23 src/external/bsd/dhcpcd/dist/ipv4.c:1.24
--- src/external/bsd/dhcpcd/dist/ipv4.c:1.23	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/ipv4.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv4.c,v 1.23 2016/06/17 19:42:32 roy Exp $");
+ __RCSID("$NetBSD: ipv4.c,v 1.24 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -56,8 +56,9 @@
 #include "script.h"
 
 #define IPV4_LOOPBACK_ROUTE
-#if defined(__linux__) || (defined(BSD) && defined(RTF_LOCAL))
-/* Linux has had loopback routes in the local table since 2.2 */
+#if defined(__linux__) || defined(__sun) || (defined(BSD) && defined(RTF_LOCAL))
+/* Linux has had loopback routes in the local table since 2.2
+ * Solaris does not seem to support loopback routes. */
 #undef IPV4_LOOPBACK_ROUTE
 #endif
 
@@ -194,53 +195,6 @@ ipv4_findmaskaddr(struct dhcpcd_ctx *ctx
 }
 
 int
-ipv4_srcaddr(const struct rt *rt, struct in_addr *addr)
-{
-	const struct dhcp_state *dstate;
-	const struct ipv4ll_state *istate;
-
-	if (rt->iface == NULL) {
-		errno = ENOENT;
-		return -1;
-	}
-
-	/* Prefer DHCP source address if matching */
-	dstate = D_CSTATE(rt->iface);
-	if (dstate && dstate->addr &&
-	    rt->mask.s_addr == dstate->addr->mask.s_addr &&
-	    rt->dest.s_addr ==
-	    (dstate->addr->addr.s_addr & dstate->addr->mask.s_addr))
-	{
-		*addr = dstate->addr->addr;
-		return 1;
-	}
-
-	/* Then IPv4LL source address if matching */
-	istate = IPV4LL_CSTATE(rt->iface);
-	if (istate && istate->addr &&
-	    rt->mask.s_addr == istate->addr->mask.s_addr &&
-	    rt->dest.s_addr ==
-	    (istate->addr->addr.s_addr & istate->addr->mask.s_addr))
-	{
-		*addr = istate->addr->addr;
-		return 1;
-	}
-
-	/* If neither match, return DHCP then IPv4LL */
-	if (dstate && dstate->addr) {
-		*addr = dstate->addr->addr;
-		return 0;
-	}
-	if (istate && istate->addr) {
-		*addr = istate->addr->addr;
-		return 0;
-	}
-
-	errno = ESRCH;
-	return -1;
-}
-
-int
 ipv4_hasaddr(const struct interface *ifp)
 {
 	const struct dhcp_state *dstate;
@@ -773,8 +727,8 @@ ipv4_doroute(struct rt *rt, struct rt_he
 #ifdef HAVE_ROUTE_METRIC
 		    or->metric != rt->metric ||
 #endif
-		    or->src.s_addr != rt->src.s_addr ||
 		    or->gate.s_addr != rt->gate.s_addr ||
+		    or->src.s_addr != rt->src.s_addr ||
 		    or->mtu != rt->mtu)
 		{
 			if (c_route(or, rt) != 0)
@@ -975,12 +929,62 @@ ipv4_getstate(struct interface *ifp)
 	return state;
 }
 
+#ifdef ALIAS_ADDR
+/* Find the next logical aliase address we can use. */
+static int
+ipv4_aliasaddr(struct ipv4_addr *ia, struct ipv4_addr **repl)
+{
+	struct ipv4_state *state;
+	struct ipv4_addr *iap;
+	unsigned int lun;
+	char alias[IF_NAMESIZE];
+
+	if (ia->alias[0] != '\0')
+		return 0;
+
+	lun = 0;
+	state = IPV4_STATE(ia->iface);
+find_lun:
+	if (lun == 0)
+		strlcpy(alias, ia->iface->name, sizeof(alias));
+	else
+		snprintf(alias, sizeof(alias), "%s:%u", ia->iface->name, lun);
+	TAILQ_FOREACH(iap, &state->addrs, next) {
+		if (iap->alias[0] != '\0' && iap->addr.s_addr == INADDR_ANY) {
+			/* No address assigned? Lets use it. */
+			strlcpy(ia->alias, iap->alias, sizeof(ia->alias));
+			if (repl)
+				*repl = iap;
+			return 1;
+		}
+		if (strcmp(iap->alias, alias) == 0)
+			break;
+	}
+
+	if (iap != NULL) {
+		if (lun == UINT_MAX) {
+			errno = ERANGE;
+			return -1;
+		}
+		lun++;
+		goto find_lun;
+	}
+
+	strlcpy(ia->alias, alias, sizeof(ia->alias));
+	return 0;
+}
+#endif
+
 struct ipv4_addr *
 ipv4_addaddr(struct interface *ifp, const struct in_addr *addr,
     const struct in_addr *mask, const struct in_addr *bcast)
 {
 	struct ipv4_state *state;
 	struct ipv4_addr *ia;
+#ifdef ALIAS_ADDR
+	int replaced, blank;
+	struct ipv4_addr *replaced_ia;
+#endif
 
 	if ((state = ipv4_getstate(ifp)) == NULL) {
 		logger(ifp->ctx, LOG_ERR, "%s: ipv4_getstate: %m", __func__);
@@ -1009,6 +1013,19 @@ ipv4_addaddr(struct interface *ifp, cons
 #endif
 	snprintf(ia->saddr, sizeof(ia->saddr), "%s/%d",
 	    inet_ntoa(*addr), inet_ntocidr(*mask));
+
+#ifdef ALIAS_ADDR
+	blank = (ia->alias[0] == '\0');
+	if ((replaced = ipv4_aliasaddr(ia, &replaced_ia)) == -1) {
+		logger(ifp->ctx, LOG_ERR, "%s: ipv4_aliasaddr: %m", ifp->name);
+		free(ia);
+		return NULL;
+	}
+	if (blank)
+		logger(ia->iface->ctx, LOG_DEBUG, "%s: aliased %s",
+		    ia->alias, ia->saddr);
+#endif
+
 	logger(ifp->ctx, LOG_DEBUG, "%s: adding IP address %s broadcast %s",
 	    ifp->name, ia->saddr, inet_ntoa(*bcast));
 	if (if_address(RTM_NEWADDR, ia) == -1) {
@@ -1019,6 +1036,13 @@ ipv4_addaddr(struct interface *ifp, cons
 		return NULL;
 	}
 
+#ifdef ALIAS_ADDR
+	if (replaced) {
+		TAILQ_REMOVE(&state->addrs, replaced_ia, next);
+		free(replaced_ia);
+	}
+#endif
+
 	TAILQ_INSERT_TAIL(&state->addrs, ia, next);
 	return ia;
 }
@@ -1211,11 +1235,12 @@ void
 ipv4_handleifa(struct dhcpcd_ctx *ctx,
     int cmd, struct if_head *ifs, const char *ifname,
     const struct in_addr *addr, const struct in_addr *mask,
-    const struct in_addr *brd, int flags)
+    const struct in_addr *brd)
 {
 	struct interface *ifp;
 	struct ipv4_state *state;
 	struct ipv4_addr *ia;
+	int flags;
 
 	if (ifs == NULL)
 		ifs = ctx->ifaces;
@@ -1240,6 +1265,9 @@ ipv4_handleifa(struct dhcpcd_ctx *ctx,
 			}
 			ia->iface = ifp;
 			ia->addr = *addr;
+#ifdef ALIAS_ADDR
+			strlcpy(ia->alias, ifname, sizeof(ia->alias));
+#endif
 			TAILQ_INSERT_TAIL(&state->addrs, ia, next);
 		}
 		/* Mask could have changed */
@@ -1250,6 +1278,14 @@ ipv4_handleifa(struct dhcpcd_ctx *ctx,
 			ia->brd = *brd;
 		else
 			ia->brd.s_addr = INADDR_ANY;
+
+		flags = if_addrflags(ia);
+		if (flags == -1) {
+			logger(ia->iface->ctx, LOG_ERR,
+			    "%s: %s: if_addrflags: %m",
+			    ia->iface->name, ia->saddr);
+			return;
+		}
 		ia->addr_flags = flags;
 		break;
 	case RTM_DELADDR:

Index: src/external/bsd/dhcpcd/dist/ipv6nd.c
diff -u src/external/bsd/dhcpcd/dist/ipv6nd.c:1.30 src/external/bsd/dhcpcd/dist/ipv6nd.c:1.31
--- src/external/bsd/dhcpcd/dist/ipv6nd.c:1.30	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/ipv6nd.c	Fri Jul 29 10:07:58 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv6nd.c,v 1.30 2016/06/17 19:42:32 roy Exp $");
+ __RCSID("$NetBSD: ipv6nd.c,v 1.31 2016/07/29 10:07:58 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -1309,17 +1309,19 @@ ipv6nd_env(char **env, const char *prefi
 }
 
 void
-ipv6nd_handleifa(struct dhcpcd_ctx *ctx, int cmd, const char *ifname,
-    const struct in6_addr *addr, int flags)
+ipv6nd_handleifa(int cmd, struct ipv6_addr *addr)
 {
 	struct ra *rap;
 
-	if (ctx->ipv6 == NULL)
+	/* IPv6 init may not have happened yet if we are learning
+	 * existing addresses when dhcpcd starts. */
+	if (addr->iface->ctx->ipv6 == NULL)
 		return;
-	TAILQ_FOREACH(rap, ctx->ipv6->ra_routers, next) {
-		if (strcmp(rap->iface->name, ifname))
+
+	TAILQ_FOREACH(rap, addr->iface->ctx->ipv6->ra_routers, next) {
+		if (rap->iface != addr->iface)
 			continue;
-		ipv6_handleifa_addrs(cmd, &rap->addrs, addr, flags);
+		ipv6_handleifa_addrs(cmd, &rap->addrs, addr);
 	}
 }
 

Index: src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf:1.9 src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf:1.10
--- src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf:1.9	Fri Jun 17 19:42:32 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf	Fri Jul 29 10:07:58 2016
@@ -1,4 +1,4 @@
-# $NetBSD: 20-resolv.conf,v 1.9 2016/06/17 19:42:32 roy Exp $
+# $NetBSD: 20-resolv.conf,v 1.10 2016/07/29 10:07:58 roy Exp $
 
 # Generate /etc/resolv.conf
 # Support resolvconf(8) if available
@@ -11,6 +11,7 @@
 resolv_conf_dir="$state_dir/resolv.conf"
 NL="
 "
+: ${resolvconf:=resolvconf}
 
 build_resolv_conf()
 {
@@ -164,9 +165,9 @@ add_resolv_conf()
 	for x in ${new_domain_name_servers}; do
 		conf="${conf}nameserver $x$NL"
 	done
-	if type resolvconf >/dev/null 2>&1; then
+	if type "$resolvconf" >/dev/null 2>&1; then
 		[ -n "$ifmetric" ] && export IF_METRIC="$ifmetric"
-		printf %s "$conf" | resolvconf -a "$ifname"
+		printf %s "$conf" | "$resolvconf" -a "$ifname"
 		return $?
 	fi
 
@@ -180,8 +181,8 @@ add_resolv_conf()
 
 remove_resolv_conf()
 {
-	if type resolvconf >/dev/null 2>&1; then
-		resolvconf -d "$ifname" -f
+	if type "$resolvconf" >/dev/null 2>&1; then
+		"$resolvconf" -d "$ifname" -f
 	else
 		if [ -e "$resolv_conf_dir/$ifname" ]; then
 			rm -f "$resolv_conf_dir/$ifname"

Reply via email to