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/src Sync
details: https://anonhg.NetBSD.org/src/rev/843210a32982
branches: trunk
changeset: 448134:843210a32982
user: roy <roy%NetBSD.org@localhost>
date: Tue Jan 22 15:20:21 2019 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/src/bpf.c | 2 +-
external/bsd/dhcpcd/dist/src/dhcp.c | 8 +-
external/bsd/dhcpcd/dist/src/dhcp6.c | 54 ++++--
external/bsd/dhcpcd/dist/src/dhcpcd.c | 24 +-
external/bsd/dhcpcd/dist/src/if-bsd.c | 235 ++++++++++++++---------------
external/bsd/dhcpcd/dist/src/if-options.c | 4 +-
external/bsd/dhcpcd/dist/src/ipv6nd.c | 160 ++++++++++++++++++--
7 files changed, 313 insertions(+), 174 deletions(-)
diffs (truncated from 876 to 300 lines):
diff -r 219324d0e8e9 -r 843210a32982 external/bsd/dhcpcd/dist/src/bpf.c
--- a/external/bsd/dhcpcd/dist/src/bpf.c Tue Jan 22 15:17:33 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/bpf.c Tue Jan 22 15:20:21 2019 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd: BPF arp and bootp filtering
- * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
diff -r 219324d0e8e9 -r 843210a32982 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c Tue Jan 22 15:17:33 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c Tue Jan 22 15:20:21 2019 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -1604,11 +1604,6 @@
n = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)) == -1)
goto eexit;
-#ifdef SO_RERROR
- n = 1;
- if (setsockopt(s, SOL_SOCKET, SO_RERROR, &n, sizeof(n)) == -1)
- goto eexit;
-#endif
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(BOOTPC);
@@ -2636,6 +2631,7 @@
* interface gets the reply. */
ia = ipv4_iffindaddr(ifp, &state->lease.addr, NULL);
if (ia != NULL &&
+ !(ifp->ctx->options & DHCPCD_TEST) &&
#ifdef IN_IFF_NOTUSEABLE
!(ia->addr_flags & IN_IFF_NOTUSEABLE) &&
#endif
diff -r 219324d0e8e9 -r 843210a32982 external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c Tue Jan 22 15:17:33 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c Tue Jan 22 15:20:21 2019 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -1516,6 +1516,7 @@
if (valid)
dhcpcd_daemonise(ifp->ctx);
}
+ ipv6nd_advertise(ia);
}
}
}
@@ -3194,7 +3195,7 @@
ctx = ifp->ctx;
state = D6_STATE(ifp);
if (state == NULL || state->send == NULL) {
- logdebug("%s: DHCPv6 reply received but not running",
+ logdebugx("%s: DHCPv6 reply received but not running",
ifp->name);
return;
}
@@ -3299,14 +3300,24 @@
if (dhcp6_validatelease(ifp, r, len,
ctx->sfrom, NULL) == -1)
{
-#ifndef SMALL
- /* PD doesn't use CONFIRM, so REBIND could
- * throw up an invalid prefix if we
- * changed link */
- if (state->state == DH6S_REBIND &&
- dhcp6_hasprefixdelegation(ifp))
+ /*
+ * If we can't use the lease, fallback to
+ * DISCOVER and try and get a new one.
+ *
+ * This is needed become some servers
+ * renumber the prefix or address
+ * and deny the current one before it expires
+ * rather than sending it back with a zero
+ * lifetime along with the new prefix or
+ * address to use.
+ * This behavior is wrong, but moving to the
+ * DISCOVER phase works around it.
+ *
+ * The currently held lease is still valid
+ * until a new one is found.
+ */
+ if (state->state != DH6S_DISCOVER)
dhcp6_startdiscover(ifp);
-#endif
return;
}
if (state->state == DH6S_DISCOVER)
@@ -3538,11 +3549,12 @@
}
if (r->type == DHCP6_RECONFIGURE) {
- logdebugx("%s: RECONFIGURE recv from %s,"
+ logdebugx("%s: RECONFIGURE6 recv from %s,"
" sending to all interfaces",
ifp->name, ctx->sfrom);
TAILQ_FOREACH(ifp, ctx->ifaces, next) {
- if (D6_CSTATE(ifp) != NULL)
+ state = D6_CSTATE(ifp);
+ if (state != NULL && state->send != NULL)
dhcp6_recvif(ifp, r, len);
}
return;
@@ -3620,11 +3632,6 @@
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &n, sizeof(n)) == -1)
goto errexit;
-#ifdef SO_RERROR
- n = 1;
- if (setsockopt(s, SOL_SOCKET, SO_RERROR, &n, sizeof(n)) == -1)
- goto errexit;
-#endif
memset(&sa, 0, sizeof(sa));
sa.sin6_family = AF_INET6;
sa.sin6_port = htons(DHCP6_CLIENT_PORT);
@@ -3947,6 +3954,21 @@
}
void
+dhcp6_abort(struct interface *ifp)
+{
+ struct dhcp6_state *state;
+ struct ipv6_addr *ia;
+
+ eloop_timeout_delete(ifp->ctx->eloop, dhcp6_start1, ifp);
+ state = D6_STATE(ifp);
+ if (state == NULL)
+ return;
+ TAILQ_FOREACH(ia, &state->addrs, next) {
+ ipv6nd_advertise(ia);
+ }
+}
+
+void
dhcp6_handleifa(int cmd, struct ipv6_addr *ia, pid_t pid)
{
struct dhcp6_state *state;
diff -r 219324d0e8e9 -r 843210a32982 external/bsd/dhcpcd/dist/src/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.c Tue Jan 22 15:17:33 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.c Tue Jan 22 15:20:21 2019 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
* SUCH DAMAGE.
*/
-const char dhcpcd_copyright[] = "Copyright (c) 2006-2018 Roy Marples";
+const char dhcpcd_copyright[] = "Copyright (c) 2006-2019 Roy Marples";
#include <sys/file.h>
#include <sys/socket.h>
@@ -314,13 +314,6 @@
return 0;
}
- /* Store the pid and routing message seq number so we can identify
- * the last message successfully sent to the kernel.
- * This allows us to ignore all messages we sent after forking
- * and detaching. */
- ctx->ppid = getpid();
- ctx->pseq = ctx->sseq;
-
switch (pid = fork()) {
case -1:
logerr("%s: fork", __func__);
@@ -451,6 +444,10 @@
ifo->options &=
~(DHCPCD_IPV6RS | DHCPCD_DHCP6 | DHCPCD_WAITIP6);
+ if (!(ifo->options & DHCPCD_IPV6RS))
+ ifo->options &=
+ ~(DHCPCD_IPV6RA_AUTOCONF | DHCPCD_IPV6RA_REQRDNSS);
+
/* We want to setup INET6 on the interface as soon as possible. */
if (ifp->active == IF_ACTIVE_USER &&
ifo->options & DHCPCD_IPV6 &&
@@ -738,6 +735,7 @@
#endif
dhcp_abort(ifp);
ipv6nd_expire(ifp, 0);
+ dhcp6_abort(ifp);
#else
dhcpcd_drop(ifp, 0);
#endif
@@ -754,19 +752,21 @@
#endif
if (ifp->wireless) {
uint8_t ossid[IF_SSIDLEN];
-#ifdef NOCARRIER_PRESERVE_IP
size_t olen;
olen = ifp->ssid_len;
-#endif
memcpy(ossid, ifp->ssid, ifp->ssid_len);
if_getssid(ifp);
-#ifdef NOCARRIER_PRESERVE_IP
+
/* If we changed SSID network, drop leases */
if (ifp->ssid_len != olen ||
memcmp(ifp->ssid, ossid, ifp->ssid_len))
+ {
+#ifdef NOCARRIER_PRESERVE_IP
dhcpcd_drop(ifp, 0);
#endif
+ ipv4ll_reset(ifp);
+ }
}
dhcpcd_initstate(ifp, 0);
script_runreason(ifp, "CARRIER");
diff -r 219324d0e8e9 -r 843210a32982 external/bsd/dhcpcd/dist/src/if-bsd.c
--- a/external/bsd/dhcpcd/dist/src/if-bsd.c Tue Jan 22 15:17:33 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-bsd.c Tue Jan 22 15:20:21 2019 +0000
@@ -1,6 +1,6 @@
/*
* BSD interface driver for dhcpcd
- * Copyright (c) 2006-2018 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -125,6 +125,7 @@
if_opensockets_os(struct dhcpcd_ctx *ctx)
{
struct priv *priv;
+ int n;
#if defined(RO_MSGFILTER) || defined(ROUTE_MSGFILTER)
unsigned char msgfilter[] = {
RTM_IFINFO,
@@ -161,12 +162,14 @@
if (ctx->link_fd == -1)
return -1;
-#ifdef SO_RERROR
- int n = 1;
- if (setsockopt(ctx->link_fd, SOL_SOCKET, SO_RERROR,
+ /* Ignore our own route(4) messages.
+ * Sadly there is no way of doing this for route(4) messages
+ * generated from addresses we add/delete. */
+ n = 0;
+ if (setsockopt(ctx->link_fd, SOL_SOCKET, SO_USELOOPBACK,
&n, sizeof(n)) == -1)
- logerr(__func__);
-#endif
+ logerr("%s: SO_USELOOPBACK", __func__);
+
#if defined(RO_MSGFILTER)
if (setsockopt(ctx->link_fd, PF_ROUTE, RO_MSGFILTER,
&msgfilter, sizeof(msgfilter)) == -1)
@@ -471,11 +474,6 @@
assert(rt != NULL);
ctx = rt->rt_ifp->ctx;
- if ((cmd == RTM_ADD || cmd == RTM_DELETE || cmd == RTM_CHANGE) &&
- ctx->options & DHCPCD_DAEMONISE &&
- !(ctx->options & DHCPCD_DAEMONISED))
- ctx->options |= DHCPCD_RTM_PPID;
-
#define ADDSA(sa) do { \
memcpy(bp, (sa), (sa)->sa_len); \
bp += RT_ROUNDUP((sa)->sa_len); \
@@ -506,8 +504,10 @@
!sa_is_loopback(&rt->rt_gateway))
{
rtm->rtm_index = (unsigned short)rt->rt_ifp->index;
- if (!gateway_unspec)
- rtm->rtm_addrs |= RTA_IFP;
+#ifdef __OpenBSD__
+ if (!gateway_unspec || rt->rt_dest.sa_family!=AF_INET6)
+#endif
+ rtm->rtm_addrs |= RTA_IFP;
if (!sa_is_unspecified(&rt->rt_ifa))
rtm->rtm_addrs |= RTA_IFA;
}
@@ -590,7 +590,6 @@
rtm->rtm_msglen = (unsigned short)(bp - (char *)rtm);
if (write(ctx->link_fd, rtm, rtm->rtm_msglen) == -1)
return -1;
- ctx->sseq = ctx->seq;
return 0;
}
Home |
Main Index |
Thread Index |
Old Index