Module Name:    src
Committed By:   roy
Date:           Wed Jan 20 19:42:33 UTC 2016

Modified Files:
        src/external/bsd/dhcpcd/dist: defs.h dhcp6.c dhcpcd.8.in dhcpcd.c
            dhcpcd.h if-options.c if-options.h

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/defs.h
cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/dhcp6.c
cvs rdiff -u -r1.46 -r1.47 src/external/bsd/dhcpcd/dist/dhcpcd.8.in
cvs rdiff -u -r1.30 -r1.31 src/external/bsd/dhcpcd/dist/dhcpcd.c
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/dhcpcd.h
cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/if-options.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/if-options.h

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.23 src/external/bsd/dhcpcd/dist/defs.h:1.24
--- src/external/bsd/dhcpcd/dist/defs.h:1.23	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/defs.h	Wed Jan 20 19:42:33 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.23 2016/01/07 20:09:43 roy Exp $ */
+/* $NetBSD: defs.h,v 1.24 2016/01/20 19:42:33 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"6.10.0"
+#define VERSION			"6.10.1"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/dhcp6.c:1.17 src/external/bsd/dhcpcd/dist/dhcp6.c:1.18
--- src/external/bsd/dhcpcd/dist/dhcp6.c:1.17	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/dhcp6.c	Wed Jan 20 19:42:33 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp6.c,v 1.17 2016/01/07 20:09:43 roy Exp $");
+ __RCSID("$NetBSD: dhcp6.c,v 1.18 2016/01/20 19:42:33 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -2485,14 +2485,20 @@ dhcp6_delegate_prefix(struct interface *
 			for (k = 0; k < i; j++)
 				if (strcmp(sla->ifname, ia->sla[j].ifname) == 0)
 					break;
-			if (j >= i &&
-			    ((ifd = if_find(ifp->ctx->ifaces,
-			        sla->ifname)) == NULL ||
-			    !ifd->active))
-				logger(ifp->ctx, LOG_ERR,
-				    "%s: interface does not exist"
-				    " for delegation",
-				    sla->ifname);
+			if (j >= i) {
+				ifd = if_find(ifp->ctx->ifaces, sla->ifname);
+				if (ifd == NULL)
+					logger(ifp->ctx, LOG_ERR,
+					    "%s: interface does not exist"
+					    " for delegation",
+					    sla->ifname);
+				else if (!ifd->active) {
+					logger(ifp->ctx, LOG_INFO,
+					    "%s: activating for delegation",
+					    sla->ifname);
+					dhcpcd_activateinterface(ifd);
+				}
+			}
 		}
 	}
 

Index: src/external/bsd/dhcpcd/dist/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.46 src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.47
--- src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.46	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.8.in	Wed Jan 20 19:42:33 2016
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.8.in,v 1.46 2016/01/07 20:09:43 roy Exp $
+.\"     $NetBSD: dhcpcd.8.in,v 1.47 2016/01/20 19:42:33 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 January 7, 2016
+.Dd January 14, 2016
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -31,7 +31,7 @@
 .Nd a DHCP client
 .Sh SYNOPSIS
 .Nm
-.Op Fl 46ABbDdEGgHJKLMNPpqTV
+.Op Fl 146ABbDdEGgHJKLMNPpqTV
 .Op Fl C , Fl Fl nohook Ar hook
 .Op Fl c , Fl Fl script Ar script
 .Op Fl e , Fl Fl env Ar value
@@ -570,6 +570,11 @@ However, there are sometimes situations 
 configured exactly how the the DHCP server wants.
 Here are some options that deal with turning these bits off.
 .Bl -tag -width indent
+.It Fl 1 , Fl Fl oneshot
+Exit after configuring an interface.
+Use the
+.Fl w , Fl Fl waitip
+option to specify which protocol(s) to configure before exiting.
 .It Fl 4 , Fl Fl ipv4only
 Configure IPv4 only.
 .It Fl 6 , Fl Fl ipv6only

Index: src/external/bsd/dhcpcd/dist/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.c:1.30 src/external/bsd/dhcpcd/dist/dhcpcd.c:1.31
--- src/external/bsd/dhcpcd/dist/dhcpcd.c:1.30	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.c	Wed Jan 20 19:42:33 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.30 2016/01/07 20:09:43 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.31 2016/01/20 19:42:33 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -321,6 +321,12 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx)
 			return 0;
 	}
 
+	if (ctx->options & DHCPCD_ONESHOT) {
+		logger(ctx, LOG_INFO, "exiting due to oneshot");
+		eloop_exit(ctx->eloop, EXIT_SUCCESS);
+		return 0;
+	}
+
 	eloop_timeout_delete(ctx->eloop, handle_exit_timeout, ctx);
 	if (ctx->options & DHCPCD_DAEMONISED ||
 	    !(ctx->options & DHCPCD_DAEMONISE))
@@ -667,6 +673,41 @@ dhcpcd_pollup(void *arg)
 	dhcpcd_handlecarrier(ifp->ctx, carrier, ifp->flags, ifp->name);
 }
 
+static void
+dhcpcd_initstate1(struct interface *ifp, int argc, char **argv,
+    unsigned long long options)
+{
+	struct if_options *ifo;
+
+	configure_interface(ifp, argc, argv, options);
+	ifo = ifp->options;
+
+	if (ifo->options & DHCPCD_IPV4 && ipv4_init(ifp->ctx) == -1) {
+		logger(ifp->ctx, LOG_ERR, "ipv4_init: %m");
+		ifo->options &= ~DHCPCD_IPV4;
+	}
+	if (ifo->options & DHCPCD_IPV6 && ipv6_init(ifp->ctx) == NULL) {
+		logger(ifp->ctx, LOG_ERR, "ipv6_init: %m");
+		ifo->options &= ~DHCPCD_IPV6RS;
+	}
+
+	/* Add our link-local address before upping the interface
+	 * so our RFC7217 address beats the hwaddr based one.
+	 * This needs to happen before PREINIT incase a hook script
+	 * inadvertently ups the interface. */
+	if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) {
+		logger(ifp->ctx, LOG_ERR, "%s: ipv6_start: %m", ifp->name);
+		ifo->options &= ~DHCPCD_IPV6;
+	}
+}
+
+static void
+dhcpcd_initstate(struct interface *ifp, unsigned long long options)
+{
+
+	dhcpcd_initstate1(ifp, ifp->ctx->argc, ifp->ctx->argv, options);
+}
+
 void
 dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
     const char *ifname)
@@ -944,67 +985,44 @@ dhcpcd_prestartinterface(void *arg)
 }
 
 static void
-handle_link(void *arg)
-{
-	struct dhcpcd_ctx *ctx;
-
-	ctx = arg;
-	if (if_managelink(ctx) == -1) {
-		logger(ctx, LOG_ERR, "if_managelink: %m");
-		eloop_event_delete(ctx->eloop, ctx->link_fd);
-		close(ctx->link_fd);
-		ctx->link_fd = -1;
-	}
-}
-
-static void
-dhcpcd_initstate1(struct interface *ifp, int argc, char **argv,
-    unsigned long long options)
+run_preinit(struct interface *ifp)
 {
-	struct if_options *ifo;
 
-	configure_interface(ifp, argc, argv, options);
-	ifo = ifp->options;
+	pre_start(ifp);
+	if (ifp->ctx->options & DHCPCD_TEST)
+		return;
 
-	if (ifo->options & DHCPCD_IPV4 && ipv4_init(ifp->ctx) == -1) {
-		logger(ifp->ctx, LOG_ERR, "ipv4_init: %m");
-		ifo->options &= ~DHCPCD_IPV4;
-	}
-	if (ifo->options & DHCPCD_IPV6 && ipv6_init(ifp->ctx) == NULL) {
-		logger(ifp->ctx, LOG_ERR, "ipv6_init: %m");
-		ifo->options &= ~DHCPCD_IPV6RS;
-	}
+	script_runreason(ifp, "PREINIT");
 
-	/* Add our link-local address before upping the interface
-	 * so our RFC7217 address beats the hwaddr based one.
-	 * This needs to happen before PREINIT incase a hook script
-	 * inadvertently ups the interface. */
-	if (ifo->options & DHCPCD_IPV6 && ipv6_start(ifp) == -1) {
-		logger(ifp->ctx, LOG_ERR, "%s: ipv6_start: %m", ifp->name);
-		ifo->options &= ~DHCPCD_IPV6;
-	}
+	if (ifp->options->options & DHCPCD_LINK && ifp->carrier != LINK_UNKNOWN)
+		script_runreason(ifp,
+		    ifp->carrier == LINK_UP ? "CARRIER" : "NOCARRIER");
 }
 
 void
-dhcpcd_initstate(struct interface *ifp, unsigned long long options)
+dhcpcd_activateinterface(struct interface *ifp)
 {
 
-	dhcpcd_initstate1(ifp, ifp->ctx->argc, ifp->ctx->argv, options);
+	if (!ifp->active) {
+		ifp->active = 1;
+		dhcpcd_initstate(ifp, 0);
+		run_preinit(ifp);
+		dhcpcd_prestartinterface(ifp);
+	}
 }
 
 static void
-run_preinit(struct interface *ifp)
+handle_link(void *arg)
 {
+	struct dhcpcd_ctx *ctx;
 
-	pre_start(ifp);
-	if (ifp->ctx->options & DHCPCD_TEST)
-		return;
-
-	script_runreason(ifp, "PREINIT");
-
-	if (ifp->options->options & DHCPCD_LINK && ifp->carrier != LINK_UNKNOWN)
-		script_runreason(ifp,
-		    ifp->carrier == LINK_UP ? "CARRIER" : "NOCARRIER");
+	ctx = arg;
+	if (if_managelink(ctx) == -1) {
+		logger(ctx, LOG_ERR, "if_managelink: %m");
+		eloop_event_delete(ctx->eloop, ctx->link_fd);
+		close(ctx->link_fd);
+		ctx->link_fd = -1;
+	}
 }
 
 int
@@ -1023,25 +1041,17 @@ dhcpcd_handleinterface(void *arg, int ac
 			errno = ESRCH;
 			return -1;
 		}
-		if (ifp->active)
+		if (ifp->active) {
 			logger(ctx, LOG_DEBUG, "%s: interface departed",
 			    ifp->name);
-		ifp->options->options |= DHCPCD_DEPARTED;
-		stop_interface(ifp);
+			ifp->options->options |= DHCPCD_DEPARTED;
+			stop_interface(ifp);
+		}
 		TAILQ_REMOVE(ctx->ifaces, ifp, next);
 		if_free(ifp);
 		return 0;
 	}
 
-	/* If running off an interface list, check it's in it. */
-	if (ctx->ifc && action != 2) {
-		for (i = 0; i < ctx->ifc; i++)
-			if (strcmp(ctx->ifv[i], ifname) == 0)
-				break;
-		if (i >= ctx->ifc)
-			return 0;
-	}
-
 	i = -1;
 	ifs = if_discover(ctx, -1, UNCONST(argv));
 	if (ifs == NULL) {
@@ -1049,33 +1059,42 @@ dhcpcd_handleinterface(void *arg, int ac
 		return -1;
 	}
 	TAILQ_FOREACH_SAFE(ifp, ifs, next, ifn) {
-		if (!ifp->active || strcmp(ifp->name, ifname) != 0)
+		if (strcmp(ifp->name, ifname) != 0)
 			continue;
+
+		/* If running off an interface list, check it's in it. */
+		if (ctx->ifc) {
+			for (i = 0; i < ctx->ifc; i++)
+				if (strcmp(ctx->ifv[i], ifname) == 0)
+					break;
+			if (i >= ctx->ifc)
+				ifp->active = 0;
+		}
+
 		i = 0;
 		/* Check if we already have the interface */
 		iff = if_find(ctx->ifaces, ifp->name);
 		if (iff) {
-			logger(ctx, LOG_DEBUG, "%s: interface updated", iff->name);
+			if (iff->active)
+				logger(ctx, LOG_DEBUG, "%s: interface updated",
+				    iff->name);
 			/* The flags and hwaddr could have changed */
 			iff->flags = ifp->flags;
 			iff->hwlen = ifp->hwlen;
 			if (ifp->hwlen != 0)
 				memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen);
 		} else {
-			logger(ctx, LOG_DEBUG, "%s: interface added", ifp->name);
 			TAILQ_REMOVE(ifs, ifp, next);
 			TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
+			if (!ifp->active)
+				continue;
+			logger(ctx, LOG_DEBUG, "%s: interface added",
+			    ifp->name);
 			dhcpcd_initstate(ifp, 0);
 			run_preinit(ifp);
 			iff = ifp;
-			iff->active = 0;
-		}
-		if (!iff->active) {
-			iff->active = 1;
-			dhcpcd_initstate(iff, 0);
-			run_preinit(iff);
 		}
-		if (action > 0)
+		if (action > 0 && iff->active)
 			dhcpcd_prestartinterface(iff);
 	}
 

Index: src/external/bsd/dhcpcd/dist/dhcpcd.h
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.h:1.14 src/external/bsd/dhcpcd/dist/dhcpcd.h:1.15
--- src/external/bsd/dhcpcd/dist/dhcpcd.h:1.14	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/dhcpcd.h	Wed Jan 20 19:42:33 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: dhcpcd.h,v 1.14 2016/01/07 20:09:43 roy Exp $ */
+/* $NetBSD: dhcpcd.h,v 1.15 2016/01/20 19:42:33 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -204,6 +204,6 @@ void dhcpcd_dropinterface(struct interfa
 int dhcpcd_selectprofile(struct interface *, const char *);
 
 void dhcpcd_startinterface(void *);
-void dhcpcd_initstate(struct interface *, unsigned long long);
+void dhcpcd_activateinterface(struct interface *);
 
 #endif

Index: src/external/bsd/dhcpcd/dist/if-options.c
diff -u src/external/bsd/dhcpcd/dist/if-options.c:1.29 src/external/bsd/dhcpcd/dist/if-options.c:1.30
--- src/external/bsd/dhcpcd/dist/if-options.c:1.29	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/if-options.c	Wed Jan 20 19:42:33 2016
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.29 2016/01/07 20:09:43 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.30 2016/01/20 19:42:33 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -156,6 +156,9 @@ const struct option cf_options[] = {
 	{"whitelist",       required_argument, NULL, 'W'},
 	{"blacklist",       required_argument, NULL, 'X'},
 	{"denyinterfaces",  required_argument, NULL, 'Z'},
+	{"oneshot",         no_argument,       NULL, '1'},
+	{"ipv4only",        no_argument,       NULL, '4'},
+	{"ipv6only",        no_argument,       NULL, '6'},
 	{"arping",          required_argument, NULL, O_ARPING},
 	{"destination",     required_argument, NULL, O_DESTINATION},
 	{"fallback",        required_argument, NULL, O_FALLBACK},
@@ -167,8 +170,6 @@ const struct option cf_options[] = {
 	{"ipv6ra_own",      no_argument,       NULL, O_IPV6RA_OWN},
 	{"ipv6ra_own_default", no_argument,    NULL, O_IPV6RA_OWN_D},
 	{"ipv6ra_accept_nopublic", no_argument, NULL, O_IPV6RA_ACCEPT_NOPUBLIC},
-	{"ipv4only",        no_argument,       NULL, '4'},
-	{"ipv6only",        no_argument,       NULL, '6'},
 	{"ipv4",            no_argument,       NULL, O_IPV4},
 	{"noipv4",          no_argument,       NULL, O_NOIPV4},
 	{"ipv6",            no_argument,       NULL, O_IPV6},
@@ -1181,6 +1182,9 @@ parse_option(struct dhcpcd_ctx *ctx, con
 		if (ifname == NULL)
 			ctx->ifdv = splitv(ctx, &ctx->ifdc, ctx->ifdv, arg);
 		break;
+	case '1':
+		ifo->options |= DHCPCD_ONESHOT;
+		break;
 	case '4':
 		ifo->options &= ~DHCPCD_IPV6;
 		ifo->options |= DHCPCD_IPV4;
@@ -2171,7 +2175,7 @@ read_config(struct dhcpcd_ctx *ctx,
 	buflen = 0;
 
 	/* Parse our embedded options file */
-	if (ifname == NULL) {
+	if (ifname == NULL && !(ctx->options & DHCPCD_PRINT_PIDFILE)) {
 		/* Space for initial estimates */
 #if defined(INET) && defined(INITDEFINES)
 		ifo->dhcp_override =

Index: src/external/bsd/dhcpcd/dist/if-options.h
diff -u src/external/bsd/dhcpcd/dist/if-options.h:1.16 src/external/bsd/dhcpcd/dist/if-options.h:1.17
--- src/external/bsd/dhcpcd/dist/if-options.h:1.16	Thu Jan  7 20:09:43 2016
+++ src/external/bsd/dhcpcd/dist/if-options.h	Wed Jan 20 19:42:33 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: if-options.h,v 1.16 2016/01/07 20:09:43 roy Exp $ */
+/* $NetBSD: if-options.h,v 1.17 2016/01/20 19:42:33 roy Exp $ */
 
 /*
  * dhcpcd - DHCP client daemon
@@ -43,7 +43,7 @@
 
 /* Don't set any optional arguments here so we retain POSIX
  * compatibility with getopt */
-#define IF_OPTS "46bc:de:f:gh:i:j:kl:m:no:pqr:s:t:u:v:wxy:z:" \
+#define IF_OPTS "146bc:de:f:gh:i:j:kl:m:no:pqr:s:t:u:v:wxy:z:" \
 		"ABC:DEF:GHI:JKLMNO:PQ:S:TUVW:X:Z:"
 #define NOERR_IF_OPTS		":" IF_OPTS
 
@@ -116,6 +116,7 @@
 #define DHCPCD_BOOTP			(1ULL << 57)
 #define DHCPCD_INITIAL_DELAY		(1ULL << 58)
 #define DHCPCD_PRINT_PIDFILE		(1ULL << 59)
+#define DHCPCD_ONESHOT			(1ULL << 60)
 
 #define DHCPCD_NODROP	(DHCPCD_EXITING | DHCPCD_PERSISTENT)
 

Reply via email to