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/39355ca4e794
branches: trunk
changeset: 347130:39355ca4e794
user: roy <roy%NetBSD.org@localhost>
date: Mon Aug 15 11:04:53 2016 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/dhcp.c | 16 ++++------
external/bsd/dhcpcd/dist/dhcp6.c | 24 ++++++++++++++--
external/bsd/dhcpcd/dist/dhcpcd.8.in | 6 ++--
external/bsd/dhcpcd/dist/eloop.c | 12 ++++----
external/bsd/dhcpcd/dist/if-bsd.c | 51 ++++++++++++++++++++++++++++++++---
external/bsd/dhcpcd/dist/ipv4.c | 4 +-
external/bsd/dhcpcd/dist/ipv6.c | 6 ++-
external/bsd/dhcpcd/dist/ipv6nd.c | 36 ++++++++++++++++++++++++-
9 files changed, 125 insertions(+), 34 deletions(-)
diffs (truncated from 412 to 300 lines):
diff -r 1a2bff966c4d -r 39355ca4e794 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Mon Aug 15 09:30:22 2016 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Mon Aug 15 11:04:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.29 2016/07/29 10:07:57 roy Exp $ */
+/* $NetBSD: defs.h,v 1.30 2016/08/15 11:04:53 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "6.11.2"
+#define VERSION "6.11.3"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r 1a2bff966c4d -r 39355ca4e794 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c Mon Aug 15 09:30:22 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c Mon Aug 15 11:04:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.44 2016/07/29 10:07:57 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.45 2016/08/15 11:04:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -1541,7 +1541,6 @@
struct dhcp_state *state;
#ifdef SO_BINDTODEVICE
struct ifreq ifr;
- char *p;
#endif
if ((s = xsocket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP)) == -1)
@@ -1554,10 +1553,6 @@
if (ifp) {
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
- /* We can only bind to the real device */
- p = strchr(ifr.ifr_name, ':');
- if (p)
- *p = '\0';
if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, &ifr,
sizeof(ifr)) == -1)
goto eexit;
@@ -2401,6 +2396,7 @@
state->state = DHS_INFORM;
free(state->offer);
state->offer = NULL;
+ state->offer_len = 0;
if (ifo->req_addr.s_addr == INADDR_ANY) {
ia = ipv4_iffindaddr(ifp, NULL, NULL);
@@ -2976,8 +2972,8 @@
return;
}
}
+ state->offer_len = bootp_len;
memcpy(state->offer, bootp, bootp_len);
- state->offer_len = bootp_len;
bootp_copied = true;
if (ifp->ctx->options & DHCPCD_TEST) {
free(state->old);
@@ -3054,8 +3050,8 @@
return;
}
}
+ state->offer_len = bootp_len;
memcpy(state->offer, bootp, bootp_len);
- state->offer_len = bootp_len;
}
lease->frominfo = 0;
@@ -3439,6 +3435,7 @@
clock_gettime(CLOCK_MONOTONIC, &state->started);
free(state->offer);
state->offer = NULL;
+ state->offer_len = 0;
if (state->arping_index < ifo->arping_len) {
struct arp_state *astate;
@@ -3495,6 +3492,7 @@
{
free(state->offer);
state->offer = NULL;
+ state->offer_len = 0;
}
}
}
@@ -3660,7 +3658,7 @@
if (cmd == RTM_DELADDR) {
if (IPV4_BRD_EQ(state->addr, ia)) {
logger(ifp->ctx, LOG_INFO,
- "%s: removing IP address %s", ifp->name, ia->saddr);
+ "%s: deleted IP address %s", ifp->name, ia->saddr);
dhcp_drop(ifp, "EXPIRE");
}
return;
diff -r 1a2bff966c4d -r 39355ca4e794 external/bsd/dhcpcd/dist/dhcp6.c
--- a/external/bsd/dhcpcd/dist/dhcp6.c Mon Aug 15 09:30:22 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp6.c Mon Aug 15 11:04:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp6.c,v 1.23 2016/07/29 10:07:57 roy Exp $");
+ __RCSID("$NetBSD: dhcp6.c,v 1.24 2016/08/15 11:04:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -3177,6 +3177,22 @@
logger(dctx, LOG_WARNING, "setsockopt: SO_REUSEPORT: %m");
#endif
+ if (!(dctx->options & DHCPCD_MASTER)) {
+ /* Bind to the link-local address to allow more than one
+ * DHCPv6 client to work. */
+ struct interface *ifp;
+ struct ipv6_addr *ia;
+
+ TAILQ_FOREACH(ifp, dctx->ifaces, next) {
+ if (ifp->active)
+ break;
+ }
+ if (ifp != NULL && (ia = ipv6_linklocal(ifp)) != NULL) {
+ memcpy(&sa.sin6_addr, &ia->addr, sizeof(sa.sin6_addr));
+ sa.sin6_scope_id = ifp->index;
+ }
+ }
+
if (bind(ctx->dhcp_fd, (struct sockaddr *)&sa, sizeof(sa)) == -1)
goto errexit;
@@ -3233,6 +3249,9 @@
size_t i;
const struct dhcp_compat *dhc;
+ if (ifp->ctx->ipv6->dhcp_fd == -1 && dhcp6_open(ifp->ctx) == -1)
+ return;
+
state = D6_STATE(ifp);
/* If no DHCPv6 options are configured,
match configured DHCPv4 options to DHCPv6 equivalents. */
@@ -3297,9 +3316,6 @@
if (!(ifp->options->options & DHCPCD_DHCP6))
return 0;
- if (ifp->ctx->ipv6->dhcp_fd == -1 && dhcp6_open(ifp->ctx) == -1)
- return -1;
-
ifp->if_data[IF_DATA_DHCP6] = calloc(1, sizeof(*state));
state = D6_STATE(ifp);
if (state == NULL)
diff -r 1a2bff966c4d -r 39355ca4e794 external/bsd/dhcpcd/dist/dhcpcd.8.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.8.in Mon Aug 15 09:30:22 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.8.in Mon Aug 15 11:04:53 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dhcpcd.8.in,v 1.49 2016/07/29 10:07:57 roy Exp $
+.\" $NetBSD: dhcpcd.8.in,v 1.50 2016/08/15 11:04:53 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 July 27, 2016
+.Dd August 15, 2016
.Dt DHCPCD 8
.Os
.Sh NAME
@@ -636,7 +636,7 @@
Removes the
.Ar option
from the DHCP message before processing.
-.It Fl P , Fl FL printpidfile
+.It Fl P , Fl Fl printpidfile
Print the
.Pa pidfile
.Nm
diff -r 1a2bff966c4d -r 39355ca4e794 external/bsd/dhcpcd/dist/eloop.c
--- a/external/bsd/dhcpcd/dist/eloop.c Mon Aug 15 09:30:22 2016 +0000
+++ b/external/bsd/dhcpcd/dist/eloop.c Mon Aug 15 11:04:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: eloop.c,v 1.14 2016/05/09 10:15:59 roy Exp $");
+ __RCSID("$NetBSD: eloop.c,v 1.15 2016/08/15 11:04:53 roy Exp $");
/*
* eloop - portable event based main loop.
@@ -747,20 +747,20 @@
eloop_signal_mask(struct eloop *eloop, sigset_t *oldset)
{
sigset_t newset;
+ size_t i;
#ifndef HAVE_KQUEUE
- size_t i;
struct sigaction sa;
#endif
assert(eloop != NULL);
- sigfillset(&newset);
+ sigemptyset(&newset);
+ for (i = 0; i < eloop->signals_len; i++)
+ sigaddset(&newset, eloop->signals[i]);
if (sigprocmask(SIG_SETMASK, &newset, oldset) == -1)
return -1;
-#ifdef HAVE_KQUEUE
- UNUSED(eloop);
-#else
+#ifndef HAVE_KQUEUE
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = eloop_signal3;
sa.sa_flags = SA_SIGINFO;
diff -r 1a2bff966c4d -r 39355ca4e794 external/bsd/dhcpcd/dist/if-bsd.c
--- a/external/bsd/dhcpcd/dist/if-bsd.c Mon Aug 15 09:30:22 2016 +0000
+++ b/external/bsd/dhcpcd/dist/if-bsd.c Mon Aug 15 11:04:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: if-bsd.c,v 1.32 2016/07/29 10:07:58 roy Exp $");
+ __RCSID("$NetBSD: if-bsd.c,v 1.33 2016/08/15 11:04:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -912,6 +912,8 @@
struct in6_addr mask;
struct priv *priv;
+ priv = (struct priv *)ia->iface->ctx->priv;
+
memset(&ifa, 0, sizeof(ifa));
strlcpy(ifa.ifra_name, ia->iface->name, sizeof(ifa.ifra_name));
/*
@@ -941,11 +943,48 @@
ifa_scope(&ifa.ifra_addr, ia->iface->index);
ipv6_mask(&mask, ia->prefix_len);
ADDADDR(&ifa.ifra_prefixmask, &mask);
+
+#undef ADDADDR
+
+ /*
+ * Every BSD kernel wants to add the prefix of the address to it's
+ * list of RA received prefixes.
+ * THIS IS WRONG because there (as the comments in the kernel state)
+ * is no API for managing prefix lifetime and the kernel should not
+ * pretend it's from a RA either.
+ *
+ * The issue is that the very first assigned prefix will inherit the
+ * lifetime of the address, but any subsequent alteration of the
+ * address OR it's lifetime will not affect the prefix lifetime.
+ * As such, we cannot stop the prefix from timing out and then
+ * constantly removing the prefix route dhcpcd is capable of adding
+ * in it's absense.
+ *
+ * What we can do to mitigate the issue is to add the address with
+ * infinite lifetimes, so the prefix route will never time out.
+ * Once done, we can then set lifetimes on the address and all is good.
+ * The downside of this approach is that we need to manually remove
+ * the kernel route because it has no lifetime, but this is OK as
+ * dhcpcd will handle this too.
+ *
+ * This issue is discussed on the NetBSD mailing lists here:
+ * http://mail-index.netbsd.org/tech-net/2016/08/05/msg006044.html
+ *
+ * NOT fixed in NetBSD - patch under development
+ * NOT fixed in FreeBSD - bug 195197
+ * Fixed in OpenBSD-5.9
+ */
+#if !(defined(OpenBSD) && OpenBSD >= 201605)
+ if (cmd == RTM_NEWADDR && !(ia->flags & IPV6_AF_ADDED)) {
+ ifa.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
+ ifa.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
+ (void)ioctl(priv->pf_inet6_fd, SIOCAIFADDR_IN6, &ifa);
+ }
+#endif
+
ifa.ifra_lifetime.ia6t_vltime = ia->prefix_vltime;
ifa.ifra_lifetime.ia6t_pltime = ia->prefix_pltime;
-#undef ADDADDR
- priv = (struct priv *)ia->iface->ctx->priv;
return ioctl(priv->pf_inet6_fd,
cmd == RTM_DELADDR ? SIOCDIFADDR_IN6 : SIOCAIFADDR_IN6, &ifa);
}
@@ -1088,7 +1127,7 @@
#endif
addrs = RTA_NETMASK;
- flags = 0;
+ flags = (int)rt->flags;
#ifdef RTF_PINNED
if (cmd != RTM_ADD)
flags |= RTF_PINNED;
@@ -1109,8 +1148,10 @@
if (IN6_IS_ADDR_UNSPECIFIED(&rt->gate))
g = NULL;
- else
Home |
Main Index |
Thread Index |
Old Index