Module Name:    src
Committed By:   roy
Date:           Wed Jul 30 15:47:32 UTC 2014

Modified Files:
        src/external/bsd/dhcpcd/dist: dhcp.c dhcpcd.c dhcpcd.conf.5.in
            if-options.c ipv6nd.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in \
    src/external/bsd/dhcpcd/dist/ipv6nd.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/if-options.c

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/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.14 src/external/bsd/dhcpcd/dist/dhcp.c:1.15
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.14	Mon Jul 14 11:49:48 2014
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Wed Jul 30 15:47:32 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.14 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.15 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -58,6 +58,7 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#define ELOOP_QUEUE 2
 #include "config.h"
 #include "arp.h"
 #include "common.h"
@@ -205,9 +206,12 @@ get_option(struct dhcpcd_ctx *ctx,
 				goto exit;
 			break;
 		case DHO_OPTIONSOVERLOADED:
-			/* Ensure we only get this option once */
+			/* Ensure we only get this option once by setting
+			 * the last bit as well as the value.
+			 * This is valid because only the first two bits
+			 * actually mean anything in RFC2132 Section 9.3 */
 			if (!overl)
-				overl = p[1];
+				overl = 0x80 | p[1];
 			break;
 		}
 		l = *p++;

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.6 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.7
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.6	Mon Jul 14 11:49:48 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Wed Jul 30 15:47:32 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.6 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.7 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -345,8 +345,6 @@ configure_interface1(struct interface *i
 		ifo->options &= ~(DHCPCD_ARP | DHCPCD_IPV4LL);
 	if (!(ifp->flags & (IFF_POINTOPOINT | IFF_LOOPBACK | IFF_MULTICAST)))
 		ifo->options &= ~DHCPCD_IPV6RS;
-	if (ifo->options & DHCPCD_LINK && ifp->carrier == LINK_UNKNOWN)
-		ifo->options &= ~DHCPCD_LINK;
 
 	if (ifo->metric != -1)
 		ifp->metric = (unsigned int)ifo->metric;
@@ -613,14 +611,33 @@ dhcpcd_startinterface(void *arg)
 	struct if_options *ifo = ifp->options;
 	size_t i;
 	char buf[DUID_LEN * 3];
+	struct timeval tv;
 
 	pre_start(ifp);
 	if (if_up(ifp) == -1)
 		syslog(LOG_ERR, "%s: if_up: %m", ifp->name);
 
-	if (ifp->carrier == LINK_DOWN && ifo->options & DHCPCD_LINK) {
-		syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
-		return;
+	if (ifo->options & DHCPCD_LINK) {
+link_retry:
+		switch (ifp->carrier) {
+		case LINK_UP:
+			break;
+		case LINK_DOWN:
+			syslog(LOG_INFO, "%s: waiting for carrier", ifp->name);
+			return;
+		case LINK_UNKNOWN:
+			/* No media state available, so we loop until
+			 * IFF_UP and IFF_RUNNING are set. */
+			ifp->carrier = if_carrier(ifp);
+			if (ifp->carrier != LINK_UNKNOWN)
+				goto link_retry;
+			syslog(LOG_INFO, "%s: unknown carrier", ifp->name);
+			tv.tv_sec = 0;
+			tv.tv_usec = 100;
+			eloop_timeout_add_tv(ifp->ctx->eloop, &tv,
+			    dhcpcd_startinterface, ifp);
+			return;
+		}
 	}
 
 	if (ifo->options & (DHCPCD_DUID | DHCPCD_IPV6)) {

Index: src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.9 src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.10
--- src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.9	Mon Jul 14 11:49:48 2014
+++ src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in	Wed Jul 30 15:47:32 2014
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.conf.5.in,v 1.9 2014/07/14 11:49:48 roy Exp $
+.\"     $NetBSD: dhcpcd.conf.5.in,v 1.10 2014/07/30 15:47:32 roy Exp $
 .\" Copyright (c) 2006-2014 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 July 7, 2014
+.Dd July 14, 2014
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -264,7 +264,7 @@ of 64 is assumed, unless the maximum
 does not fit.
 In this case
 .Ar prefix_len
-is increased to the highest multiple of 8 that can accomodate the
+is increased to the highest multiple of 8 that can accommodate the
 .Ar sla_id .
 .Ar sla_id
 is an integer and is added to the prefix which must fit inside
@@ -653,7 +653,7 @@ This option cannot be requested, regardl
 .It Ic index
 The option can appear more than once and will be indexed.
 .It Ic array
-The option data is split into a space seperated array, each element being
+The option data is split into a space separated array, each element being
 the same type.
 .El
 .Ss Types to define
Index: src/external/bsd/dhcpcd/dist/ipv6nd.c
diff -u src/external/bsd/dhcpcd/dist/ipv6nd.c:1.9 src/external/bsd/dhcpcd/dist/ipv6nd.c:1.10
--- src/external/bsd/dhcpcd/dist/ipv6nd.c:1.9	Mon Jul 14 11:49:48 2014
+++ src/external/bsd/dhcpcd/dist/ipv6nd.c	Wed Jul 30 15:47:32 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv6nd.c,v 1.9 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: ipv6nd.c,v 1.10 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -49,7 +49,7 @@
 #include <syslog.h>
 #include <unistd.h>
 
-#define ELOOP_QUEUE 2
+#define ELOOP_QUEUE 3
 #include "common.h"
 #include "dhcpcd.h"
 #include "dhcp6.h"
@@ -606,9 +606,14 @@ ipv6nd_dadcallback(void *arg)
 		 * Because ap->dadcounter is always increamented,
 		 * a different address is generated. */
 		/* XXX Cache DAD counter per prefix/id/ssid? */
-		if (ifp->options->options & DHCPCD_SLAACPRIVATE &&
-		    ap->dadcounter < IDGEN_RETRIES)
-		{
+		if (ifp->options->options & DHCPCD_SLAACPRIVATE) {
+			if (ap->dadcounter >= IDGEN_RETRIES) {
+				syslog(LOG_ERR,
+				    "%s: unable to obtain a"
+				    " stable private address",
+				    ifp->name);
+				goto try_script;
+			}
 			syslog(LOG_INFO, "%s: deleting address %s",
 				ifp->name, ap->saddr);
 			if (if_deladdress6(ap) == -1 &&
@@ -645,6 +650,7 @@ ipv6nd_dadcallback(void *arg)
 		}
 	}
 
+try_script:
 	if (!wascompleted) {
 		TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) {
 			if (rap->iface != ifp)

Index: src/external/bsd/dhcpcd/dist/if-options.c
diff -u src/external/bsd/dhcpcd/dist/if-options.c:1.10 src/external/bsd/dhcpcd/dist/if-options.c:1.11
--- src/external/bsd/dhcpcd/dist/if-options.c:1.10	Mon Jul 14 11:49:48 2014
+++ src/external/bsd/dhcpcd/dist/if-options.c	Wed Jul 30 15:47:32 2014
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.10 2014/07/14 11:49:48 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.11 2014/07/30 15:47:32 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -2065,11 +2065,11 @@ read_config(struct dhcpcd_ctx *ctx,
 		for (e = dhcpcd_embedded_conf; *e; e++) {
 			ol = strlen(*e) + 1;
 			if (ol > buflen) {
-				free(buf);
 				buflen = ol;
-				buf = malloc(buflen);
+				buf = realloc(buf, buflen);
 				if (buf == NULL) {
 					syslog(LOG_ERR, "%s: %m", __func__);
+					free(buf);
 					return NULL;
 				}
 			}

Reply via email to