Module Name:    src
Committed By:   roy
Date:           Fri Sep  4 12:25:01 UTC 2015

Modified Files:
        src/external/bsd/dhcpcd/dist: defs.h dhcp.c dhcpcd.c if-options.c
            if-options.h if.c script.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/defs.h
cvs rdiff -u -r1.34 -r1.35 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/if-options.c
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/if-options.h
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/if.c
cvs rdiff -u -r1.22 -r1.23 src/external/bsd/dhcpcd/dist/script.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/defs.h
diff -u src/external/bsd/dhcpcd/dist/defs.h:1.20 src/external/bsd/dhcpcd/dist/defs.h:1.21
--- src/external/bsd/dhcpcd/dist/defs.h:1.20	Fri Aug 21 10:39:00 2015
+++ src/external/bsd/dhcpcd/dist/defs.h	Fri Sep  4 12:25:01 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.20 2015/08/21 10:39:00 roy Exp $ */
+/* $NetBSD: defs.h,v 1.21 2015/09/04 12:25:01 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.9.2"
+#define VERSION			"6.9.3"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.34 src/external/bsd/dhcpcd/dist/dhcp.c:1.35
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.34	Sat Aug 22 05:45:57 2015
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Fri Sep  4 12:25:01 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.34 2015/08/22 05:45:57 christos Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.35 2015/09/04 12:25:01 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -713,8 +713,11 @@ uint16_t
 dhcp_get_mtu(const struct interface *ifp)
 {
 	const struct dhcp_message *dhcp;
-	uint16_t mtu = 0;	// XXX: gcc
+	uint16_t mtu;
 
+	if (ifp->options->mtu)
+		return (uint16_t)ifp->options->mtu;
+	mtu = 0; /* bogus gcc warning */
 	if ((dhcp = D_CSTATE(ifp)->new) == NULL ||
 	    has_option_mask(ifp->options->nomask, DHO_MTU) ||
 	    get_option_uint16(ifp->ctx, &mtu, dhcp, DHO_MTU) == -1)
@@ -2022,7 +2025,8 @@ dhcp_arp_conflicted(struct arp_state *as
 			astate->failed = astate->addr;
 		arp_report_conflicted(astate, amsg);
 		unlink(state->leasefile);
-		if (!state->lease.frominfo)
+		if (!(ifp->options->options & DHCPCD_STATIC) &&
+		    !state->lease.frominfo)
 			dhcp_decline(ifp);
 #ifdef IN_IFF_DUPLICATED
 		ia = ipv4_iffindaddr(ifp, &astate->addr, NULL);
@@ -2186,6 +2190,61 @@ dhcp_message_new(const struct in_addr *a
 }
 
 static void
+dhcp_arp_bind(struct interface *ifp)
+{
+	const struct dhcp_state *state;
+	struct in_addr addr;
+	struct ipv4_addr *ia;
+	struct arp_state *astate;
+
+	eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
+
+	state = D_CSTATE(ifp);
+	addr.s_addr = state->offer->yiaddr;
+	/* If the interface already has the address configured
+	 * then we can't ARP for duplicate detection. */
+	ia = ipv4_findaddr(ifp->ctx, &addr);
+
+#ifdef IN_IFF_TENTATIVE
+	if (ia == NULL || ia->addr_flags & IN_IFF_NOTUSEABLE) {
+		if ((astate = arp_new(ifp, &addr)) != NULL) {
+			astate->probed_cb = dhcp_arp_probed;
+			astate->conflicted_cb = dhcp_arp_conflicted;
+			astate->announced_cb = dhcp_arp_announced;
+		}
+		if (ia == NULL) {
+			struct dhcp_lease l;
+
+			get_lease(ifp->ctx, &l, state->offer);
+			/* Add the address now, let the kernel handle DAD. */
+			ipv4_addaddr(ifp, &l.addr, &l.net, &l.brd);
+		} else
+			logger(ifp->ctx, LOG_INFO, "%s: waiting for DAD on %s",
+			    ifp->name, inet_ntoa(addr));
+		return;
+	}
+#else
+	if (ifp->options->options & DHCPCD_ARP && ia == NULL) {
+		struct dhcp_lease l;
+
+		get_lease(ifp->ctx, &l, state->offer);
+		logger(ifp->ctx, LOG_INFO, "%s: probing static address %s/%d",
+		    ifp->name, inet_ntoa(l.addr), inet_ntocidr(l.net));
+		if ((astate = arp_new(ifp, &addr)) != NULL) {
+			astate->probed_cb = dhcp_arp_probed;
+			astate->conflicted_cb = dhcp_arp_conflicted;
+			astate->announced_cb = dhcp_arp_announced;
+			/* We need to handle DAD. */
+			arp_probe(astate);
+		}
+		return;
+	}
+#endif
+
+	dhcp_bind(ifp);
+}
+
+static void
 dhcp_static(struct interface *ifp)
 {
 	struct if_options *ifo;
@@ -2210,10 +2269,8 @@ dhcp_static(struct interface *ifp)
 
 	state->offer = dhcp_message_new(ia ? &ia->addr : &ifo->req_addr,
 	    ia ? &ia->net : &ifo->req_mask);
-	if (state->offer) {
-		eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
-		dhcp_bind(ifp);
-	}
+	if (state->offer)
+		dhcp_arp_bind(ifp);
 }
 
 void
@@ -2503,8 +2560,9 @@ dhcp_handledhcp(struct interface *ifp, s
 	unsigned int i;
 	size_t auth_len;
 	char *msg;
+#ifdef IN_IFF_DUPLICATED
 	struct ipv4_addr *ia;
-	struct arp_state *astate;
+#endif
 
 	/* We may have found a BOOTP server */
 	if (get_option_uint8(ifp->ctx, &type, dhcp, DHO_MESSAGETYPE) == -1)
@@ -2797,43 +2855,7 @@ dhcp_handledhcp(struct interface *ifp, s
 	lease->frominfo = 0;
 	eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
 
-	addr.s_addr = state->offer->yiaddr;
-	/* If the interface already has the address configured
-	 * then we can't ARP for duplicate detection. */
-	ia = ipv4_findaddr(ifp->ctx, &addr);
-
-#ifdef IN_IFF_TENTATIVE
-	if (ia == NULL || ia->addr_flags & IN_IFF_NOTUSEABLE) {
-		if ((astate = arp_new(ifp, &addr)) != NULL) {
-			astate->probed_cb = dhcp_arp_probed;
-			astate->conflicted_cb = dhcp_arp_conflicted;
-			astate->announced_cb = dhcp_arp_announced;
-		}
-		if (ia == NULL) {
-			struct dhcp_lease l;
-
-			get_lease(ifp->ctx, &l, state->offer);
-			/* Add the address now, let the kernel handle DAD. */
-			ipv4_addaddr(ifp, &l.addr, &l.net, &l.brd);
-		}
-		return;
-	}
-#else
-	if (ifo->options & DHCPCD_ARP) {
-		if (ia == NULL) {
-			if ((astate = arp_new(ifp, &addr)) != NULL) {
-				astate->probed_cb = dhcp_arp_probed;
-				astate->conflicted_cb = dhcp_arp_conflicted;
-				astate->announced_cb = dhcp_arp_announced;
-				/* We need to handle DAD. */
-				arp_probe(astate);
-			}
-			return;
-		}
-	}
-#endif
-
-	dhcp_bind(ifp);
+	dhcp_arp_bind(ifp);
 }
 
 static size_t

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.27 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.28
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.27	Fri Aug 21 10:39:00 2015
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Fri Sep  4 12:25:01 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.27 2015/08/21 10:39:00 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.28 2015/09/04 12:25:01 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -436,7 +436,7 @@ configure_interface1(struct interface *i
 		ifo->options |= DHCPCD_STATIC;
 	if (ifp->flags & IFF_NOARP ||
 	    ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC))
-		ifo->options &= ~(DHCPCD_ARP | DHCPCD_IPV4LL);
+		ifo->options &= ~DHCPCD_IPV4LL;
 	if (ifp->flags & (IFF_POINTOPOINT | IFF_LOOPBACK) ||
 	    !(ifp->flags & IFF_MULTICAST))
 		ifo->options &= ~DHCPCD_IPV6RS;

Index: src/external/bsd/dhcpcd/dist/if-options.c
diff -u src/external/bsd/dhcpcd/dist/if-options.c:1.26 src/external/bsd/dhcpcd/dist/if-options.c:1.27
--- src/external/bsd/dhcpcd/dist/if-options.c:1.26	Fri Aug 21 10:39:00 2015
+++ src/external/bsd/dhcpcd/dist/if-options.c	Fri Sep  4 12:25:01 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.26 2015/08/21 10:39:00 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.27 2015/09/04 12:25:01 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -813,7 +813,7 @@ parse_option(struct dhcpcd_ctx *ctx, con
 			ifo->req_mask.s_addr = 0;
 		}
 		ifo->options |= DHCPCD_INFORM | DHCPCD_PERSISTENT;
-		ifo->options &= ~(DHCPCD_ARP | DHCPCD_STATIC);
+		ifo->options &= ~DHCPCD_STATIC;
 		break;
 	case 't':
 		ifo->timeout = (time_t)strtoi(arg, NULL, 0, 0, INT32_MAX, &e);
@@ -1101,6 +1101,16 @@ parse_option(struct dhcpcd_ctx *ctx, con
 				return -1;
 			}
 			TAILQ_INSERT_TAIL(ifo->routes, rt, next);
+		} else if (strncmp(arg, "interface_mtu=",
+		    strlen("interface_mtu=")) == 0 ||
+		    strncmp(arg, "mtu=", strlen("mtu=")) == 0)
+		{
+			ifo->mtu = (unsigned int)strtou(p, NULL, 0,
+			    MTU_MIN, MTU_MAX, &e);
+			if (e) {
+				logger(ctx, LOG_ERR, "invalid MTU %s", p);
+				return -1;
+			}
 		} else {
 			dl = 0;
 			if (ifo->config != NULL) {

Index: src/external/bsd/dhcpcd/dist/if-options.h
diff -u src/external/bsd/dhcpcd/dist/if-options.h:1.13 src/external/bsd/dhcpcd/dist/if-options.h:1.14
--- src/external/bsd/dhcpcd/dist/if-options.h:1.13	Fri Aug 21 10:39:00 2015
+++ src/external/bsd/dhcpcd/dist/if-options.h	Fri Sep  4 12:25:01 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if-options.h,v 1.13 2015/08/21 10:39:00 roy Exp $ */
+/* $NetBSD: if-options.h,v 1.14 2015/09/04 12:25:01 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -174,6 +174,7 @@ struct if_options {
 	struct in_addr req_addr;
 	struct in_addr req_mask;
 	struct rt_head *routes;
+	unsigned int mtu;
 	char **config;
 
 	char **environ;

Index: src/external/bsd/dhcpcd/dist/if.c
diff -u src/external/bsd/dhcpcd/dist/if.c:1.15 src/external/bsd/dhcpcd/dist/if.c:1.16
--- src/external/bsd/dhcpcd/dist/if.c:1.15	Fri Aug 21 10:39:00 2015
+++ src/external/bsd/dhcpcd/dist/if.c	Fri Sep  4 12:25:01 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if.c,v 1.15 2015/08/21 10:39:00 roy Exp $");
+ __RCSID("$NetBSD: if.c,v 1.16 2015/09/04 12:25:01 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -679,7 +679,7 @@ xsocket(int domain, int type, int protoc
 	if ((s = socket(domain, type, protocol)) == -1)
 		return -1;
 	if ((flags & O_CLOEXEC) && (xflags = fcntl(s, F_GETFD, 0)) == -1 ||
-	    fcntl(s, F_SETFD, xlags | FD_CLOEXEC) == -1)
+	    fcntl(s, F_SETFD, xflags | FD_CLOEXEC) == -1)
 		goto out;
 	if ((flags & O_NONBLOCK) && (xflags = fcntl(s, F_GETFL, 0)) == -1 ||
 	    fcntl(s, F_SETFL, xflags | O_NONBLOCK) == -1)

Index: src/external/bsd/dhcpcd/dist/script.c
diff -u src/external/bsd/dhcpcd/dist/script.c:1.22 src/external/bsd/dhcpcd/dist/script.c:1.23
--- src/external/bsd/dhcpcd/dist/script.c:1.22	Fri Aug 21 10:39:00 2015
+++ src/external/bsd/dhcpcd/dist/script.c	Fri Sep  4 12:25:01 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: script.c,v 1.22 2015/08/21 10:39:00 roy Exp $");
+ __RCSID("$NetBSD: script.c,v 1.23 2015/09/04 12:25:01 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -134,8 +134,7 @@ make_var(struct dhcpcd_ctx *ctx, const c
 	char *v;
 
 	len = strlen(prefix) + strlen(var) + 2;
-	v = malloc(len);
-	if (v == NULL) {
+	if ((v = malloc(len)) == NULL) {
 		logger(ctx, LOG_ERR, "%s: %m", __func__);
 		return NULL;
 	}
@@ -161,8 +160,10 @@ append_config(struct dhcpcd_ctx *ctx, ch
 		eq = strchr(config[i], '=');
 		e1 = (size_t)(eq - config[i] + 1);
 		for (j = 0; j < *len; j++) {
-			if (strncmp(ne[j] + strlen(prefix) + 1,
-				config[i], e1) == 0)
+			if (strncmp(ne[j], prefix, strlen(prefix)) == 0 &&
+			    ne[j][strlen(prefix)] == '_' &&
+			    strncmp(ne[j] + strlen(prefix) + 1,
+			    config[i], e1) == 0)
 			{
 				p = make_var(ctx, prefix, config[i]);
 				if (p == NULL) {

Reply via email to