Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/dhcpcd/dist Sync
details: https://anonhg.NetBSD.org/src/rev/f98310362fa6
branches: trunk
changeset: 343049:f98310362fa6
user: roy <roy%NetBSD.org@localhost>
date: Wed Jan 20 19:42:33 2016 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/dhcp6.c | 24 +++-
external/bsd/dhcpcd/dist/dhcpcd.8.in | 11 +-
external/bsd/dhcpcd/dist/dhcpcd.c | 163 ++++++++++++++++++---------------
external/bsd/dhcpcd/dist/dhcpcd.h | 4 +-
external/bsd/dhcpcd/dist/if-options.c | 12 +-
external/bsd/dhcpcd/dist/if-options.h | 5 +-
7 files changed, 129 insertions(+), 94 deletions(-)
diffs (truncated from 424 to 300 lines):
diff -r 79cdc5fb4642 -r f98310362fa6 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Wed Jan 20 19:35:32 2016 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Wed Jan 20 19:42:33 2016 +0000
@@ -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"
diff -r 79cdc5fb4642 -r f98310362fa6 external/bsd/dhcpcd/dist/dhcp6.c
--- a/external/bsd/dhcpcd/dist/dhcp6.c Wed Jan 20 19:35:32 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp6.c Wed Jan 20 19:42:33 2016 +0000
@@ -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 @@
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);
+ }
+ }
}
}
diff -r 79cdc5fb4642 -r f98310362fa6 external/bsd/dhcpcd/dist/dhcpcd.8.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.8.in Wed Jan 20 19:35:32 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.8.in Wed Jan 20 19:42:33 2016 +0000
@@ -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 @@
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
diff -r 79cdc5fb4642 -r f98310362fa6 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Wed Jan 20 19:35:32 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Wed Jan 20 19:42:33 2016 +0000
@@ -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 @@
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_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,55 +985,6 @@
}
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)
-{
- 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;
- }
-}
-
-void
-dhcpcd_initstate(struct interface *ifp, unsigned long long options)
-{
-
- dhcpcd_initstate1(ifp, ifp->ctx->argc, ifp->ctx->argv, options);
-}
-
-static void
run_preinit(struct interface *ifp)
{
@@ -1007,6 +999,32 @@
ifp->carrier == LINK_UP ? "CARRIER" : "NOCARRIER");
}
+void
+dhcpcd_activateinterface(struct interface *ifp)
+{
+
+ if (!ifp->active) {
+ ifp->active = 1;
+ dhcpcd_initstate(ifp, 0);
+ run_preinit(ifp);
+ dhcpcd_prestartinterface(ifp);
+ }
+}
+
+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;
+ }
+}
+
int
dhcpcd_handleinterface(void *arg, int action, const char *ifname)
{
@@ -1023,25 +1041,17 @@
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 @@
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);
Home |
Main Index |
Thread Index |
Old Index