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/84ce5d28e40c
branches: trunk
changeset: 340430:84ce5d28e40c
user: roy <roy%NetBSD.org@localhost>
date: Fri Sep 04 12:25:01 2015 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/dhcp.c | 114 ++++++++++++++++++++-------------
external/bsd/dhcpcd/dist/dhcpcd.c | 4 +-
external/bsd/dhcpcd/dist/if-options.c | 14 +++-
external/bsd/dhcpcd/dist/if-options.h | 3 +-
external/bsd/dhcpcd/dist/if.c | 4 +-
external/bsd/dhcpcd/dist/script.c | 11 +-
7 files changed, 94 insertions(+), 60 deletions(-)
diffs (truncated from 307 to 300 lines):
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Fri Sep 04 12:25:01 2015 +0000
@@ -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"
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c Fri Sep 04 12:25:01 2015 +0000
@@ -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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Fri Sep 04 12:25:01 2015 +0000
@@ -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 @@
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;
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c Fri Sep 04 12:25:01 2015 +0000
@@ -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 @@
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 @@
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) {
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/if-options.h
--- a/external/bsd/dhcpcd/dist/if-options.h Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.h Fri Sep 04 12:25:01 2015 +0000
@@ -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 in_addr req_addr;
struct in_addr req_mask;
struct rt_head *routes;
+ unsigned int mtu;
char **config;
char **environ;
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/if.c
--- a/external/bsd/dhcpcd/dist/if.c Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/if.c Fri Sep 04 12:25:01 2015 +0000
@@ -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 @@
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)
diff -r b1eed6d8e6b6 -r 84ce5d28e40c external/bsd/dhcpcd/dist/script.c
--- a/external/bsd/dhcpcd/dist/script.c Fri Sep 04 10:16:35 2015 +0000
+++ b/external/bsd/dhcpcd/dist/script.c Fri Sep 04 12:25:01 2015 +0000
@@ -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 @@
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 @@
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)
Home |
Main Index |
Thread Index |
Old Index