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/495cad3e796c
branches: trunk
changeset: 814805:495cad3e796c
user: roy <roy%NetBSD.org@localhost>
date: Sun Apr 10 21:00:53 2016 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/arp.c | 5 +-
external/bsd/dhcpcd/dist/common.c | 4 +-
external/bsd/dhcpcd/dist/common.h | 7 +-
external/bsd/dhcpcd/dist/config.h | 4 +-
external/bsd/dhcpcd/dist/control.c | 19 +-
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/dhcp-common.c | 80 +++--
external/bsd/dhcpcd/dist/dhcp.c | 11 +-
external/bsd/dhcpcd/dist/dhcp.h | 4 +-
external/bsd/dhcpcd/dist/dhcp6.c | 269 +++++++++++-------
external/bsd/dhcpcd/dist/dhcp6.h | 5 +-
external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in | 13 +-
external/bsd/dhcpcd/dist/dhcpcd.c | 181 ++++-------
external/bsd/dhcpcd/dist/dhcpcd.conf.5.in | 86 ++++-
external/bsd/dhcpcd/dist/dhcpcd.h | 17 +-
external/bsd/dhcpcd/dist/eloop.c | 366 +++++++++++++++++++------
external/bsd/dhcpcd/dist/eloop.h | 100 +------
external/bsd/dhcpcd/dist/if-bsd.c | 234 +++++++++++-----
external/bsd/dhcpcd/dist/if-options.c | 144 +++++++--
external/bsd/dhcpcd/dist/if-options.h | 8 +-
external/bsd/dhcpcd/dist/if.c | 105 ++++--
external/bsd/dhcpcd/dist/if.h | 19 +-
external/bsd/dhcpcd/dist/ipv4.c | 65 ++--
external/bsd/dhcpcd/dist/ipv4.h | 8 +-
external/bsd/dhcpcd/dist/ipv4ll.c | 28 +-
external/bsd/dhcpcd/dist/ipv4ll.h | 13 +-
external/bsd/dhcpcd/dist/ipv6.c | 385 +++++++++++++++++++-------
external/bsd/dhcpcd/dist/ipv6.h | 60 +++-
external/bsd/dhcpcd/dist/ipv6nd.c | 97 +-----
external/bsd/dhcpcd/dist/ipv6nd.h | 6 +-
external/bsd/dhcpcd/dist/script.c | 33 +-
31 files changed, 1487 insertions(+), 893 deletions(-)
diffs (truncated from 4790 to 300 lines):
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/arp.c
--- a/external/bsd/dhcpcd/dist/arp.c Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/arp.c Sun Apr 10 21:00:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: arp.c,v 1.16 2016/01/07 20:09:43 roy Exp $");
+ __RCSID("$NetBSD: arp.c,v 1.17 2016/04/10 21:00:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -204,8 +204,7 @@
__func__, ifp->name);
return;
}
- eloop_event_add(ifp->ctx->eloop, state->fd,
- arp_packet, ifp, NULL, NULL);
+ eloop_event_add(ifp->ctx->eloop, state->fd, arp_packet, ifp);
}
}
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/common.c
--- a/external/bsd/dhcpcd/dist/common.c Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/common.c Sun Apr 10 21:00:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: common.c,v 1.18 2016/01/07 20:09:43 roy Exp $");
+ __RCSID("$NetBSD: common.c,v 1.19 2016/04/10 21:00:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -72,7 +72,7 @@
warn("open: %s", ctx->logfile);
#ifndef O_CLOEXEC
else {
- if (fcntl(ctx->log_fd, F_GETFD, &f) == -1 ||
+ if ((f = fcntl(ctx->log_fd, F_GETFD)) == -1 ||
fcntl(ctx->log_fd, F_SETFD, f | FD_CLOEXEC) == -1)
warn("fcntl: %s", ctx->logfile);
}
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/common.h
--- a/external/bsd/dhcpcd/dist/common.h Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/common.h Sun Apr 10 21:00:53 2016 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: common.h,v 1.12 2015/11/30 16:33:00 roy Exp $ */
+/* $NetBSD: common.h,v 1.13 2016/04/10 21:00:53 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2015 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2016 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,9 @@
#define TOSTRING(a) STRINGIFY(a)
#define UNUSED(a) (void)(a)
+#define ROUNDUP4(a) (1 + (((a) - 1) | 3))
+#define ROUNDUP8(a) (1 + (((a) - 1) | 7))
+
#define USEC_PER_SEC 1000000L
#define USEC_PER_NSEC 1000L
#define NSEC_PER_SEC 1000000000L
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/config.h
--- a/external/bsd/dhcpcd/dist/config.h Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/config.h Sun Apr 10 21:00:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.9 2015/05/16 23:31:32 roy Exp $ */
+/* $NetBSD: config.h,v 1.10 2016/04/10 21:00:53 roy Exp $ */
/* netbsd */
#define SYSCONFDIR "/etc"
@@ -7,9 +7,11 @@
#define LIBEXECDIR "/libexec"
#define DBDIR "/var/db"
#define RUNDIR "/var/run"
+#define HAVE_UTIL_H
#define HAVE_SYS_QUEUE_H
#define HAVE_SPAWN_H
#define HAVE_KQUEUE
#define HAVE_KQUEUE1
+#define HAVE_SYS_BITOPS_H
#define HAVE_MD5_H
#define SHA2_H <sha2.h>
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/control.c
--- a/external/bsd/dhcpcd/dist/control.c Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/control.c Sun Apr 10 21:00:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: control.c,v 1.10 2015/08/21 10:39:00 roy Exp $");
+ __RCSID("$NetBSD: control.c,v 1.11 2016/04/10 21:00:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -184,8 +184,7 @@
TAILQ_INIT(&l->queue);
TAILQ_INIT(&l->free_queue);
TAILQ_INSERT_TAIL(&ctx->control_fds, l, next);
- eloop_event_add(ctx->eloop, l->fd,
- control_handle_data, l, NULL, NULL);
+ eloop_event_add(ctx->eloop, l->fd, control_handle_data, l);
} else
close(fd);
}
@@ -211,8 +210,10 @@
{
int fd;
- if ((fd = xsocket(AF_UNIX, SOCK_STREAM, 0, O_NONBLOCK|O_CLOEXEC)) == -1)
+#define SOCK_FLAGS SOCK_CLOEXEC | SOCK_NONBLOCK
+ if ((fd = xsocket(AF_UNIX, SOCK_STREAM, 0, SOCK_FLAGS)) == -1)
return -1;
+#undef SOCK_FLAGS
memset(sa, 0, sizeof(*sa));
sa->sun_family = AF_UNIX;
if (unpriv)
@@ -248,7 +249,7 @@
unlink(sa.sun_path);
return -1;
}
-
+
if ((fmode & S_UNPRIV) != S_UNPRIV)
strlcpy(ctx->control_sock, sa.sun_path,
sizeof(ctx->control_sock));
@@ -264,14 +265,13 @@
return -1;
ctx->control_fd = fd;
- eloop_event_add(ctx->eloop, fd, control_handle, ctx, NULL, NULL);
+ eloop_event_add(ctx->eloop, fd, control_handle, ctx);
if (ifname == NULL && (fd = control_start1(ctx, NULL, S_UNPRIV)) != -1){
/* We must be in master mode, so create an unpriviledged socket
* to allow normal users to learn the status of dhcpcd. */
ctx->control_unpriv_fd = fd;
- eloop_event_add(ctx->eloop, fd, control_handle_unpriv,
- ctx, NULL, NULL);
+ eloop_event_add(ctx->eloop, fd, control_handle_unpriv, ctx);
}
return ctx->control_fd;
}
@@ -411,8 +411,7 @@
d->data_len = data_len;
d->freeit = fit;
TAILQ_INSERT_TAIL(&fd->queue, d, next);
- eloop_event_add(fd->ctx->eloop, fd->fd,
- NULL, NULL, control_writeone, fd);
+ eloop_event_add_w(fd->ctx->eloop, fd->fd, control_writeone, fd);
return 0;
}
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Sun Apr 10 21:00:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.24 2016/01/20 19:42:33 roy Exp $ */
+/* $NetBSD: defs.h,v 1.25 2016/04/10 21:00:53 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "6.10.1"
+#define VERSION "6.10.2"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r 2d03985cba12 -r 495cad3e796c external/bsd/dhcpcd/dist/dhcp-common.c
--- a/external/bsd/dhcpcd/dist/dhcp-common.c Sun Apr 10 19:05:50 2016 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp-common.c Sun Apr 10 21:00:53 2016 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp-common.c,v 1.12 2016/01/07 20:09:43 roy Exp $");
+ __RCSID("$NetBSD: dhcp-common.c,v 1.13 2016/04/10 21:00:53 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -67,10 +67,10 @@
strlcpy(buf, ifo->hostname, buf_len);
/* Deny sending of these local hostnames */
- if (strcmp(buf, "(none)") == 0 ||
+ if (buf[0] == '\0' || buf[0] == '.' ||
+ strcmp(buf, "(none)") == 0 ||
strcmp(buf, "localhost") == 0 ||
- strncmp(buf, "localhost.", strlen("localhost.")) == 0 ||
- buf[0] == '.')
+ strncmp(buf, "localhost.", strlen("localhost.")) == 0)
return NULL;
/* Shorten the hostname if required */
@@ -621,6 +621,39 @@
return (ssize_t)sz;
}
+/* It's possible for DHCPv4 to contain an IPv6 address */
+static ssize_t
+ipv6_printaddr(char *s, size_t sl, const uint8_t *d, const char *ifname)
+{
+ char buf[INET6_ADDRSTRLEN];
+ const char *p;
+ size_t l;
+
+ p = inet_ntop(AF_INET6, d, buf, sizeof(buf));
+ if (p == NULL)
+ return -1;
+
+ l = strlen(p);
+ if (d[0] == 0xfe && (d[1] & 0xc0) == 0x80)
+ l += 1 + strlen(ifname);
+
+ if (s == NULL)
+ return (ssize_t)l;
+
+ if (sl < l) {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ s += strlcpy(s, p, sl);
+ if (d[0] == 0xfe && (d[1] & 0xc0) == 0x80) {
+ *s++ = '%';
+ s += strlcpy(s, ifname, sl);
+ }
+ *s = '\0';
+ return (ssize_t)l;
+}
+
static ssize_t
print_option(char *s, size_t len, const struct dhcp_opt *opt,
const uint8_t *data, size_t dl, const char *ifname)
@@ -635,10 +668,6 @@
size_t l;
char *tmp;
-#ifndef INET6
- UNUSED(ifname);
-#endif
-
if (opt->type & RFC1035) {
sl = decode_rfc1035(NULL, 0, data, dl);
if (sl == 0 || sl == -1)
@@ -719,23 +748,20 @@
} else if (opt->type & ADDRIPV4) {
l = 16;
dl /= 4;
- }
-#ifdef INET6
- else if (opt->type & ADDRIPV6) {
+ } else if (opt->type & ADDRIPV6) {
e = data + dl;
l = 0;
while (data < e) {
if (l)
l++; /* space */
sl = ipv6_printaddr(NULL, 0, data, ifname);
- if (sl != -1)
- l += (size_t)sl;
+ if (sl == -1)
+ return l == 0 ? -1 : (ssize_t)l;
+ l += (size_t)sl;
data += 16;
}
return (ssize_t)l;
- }
-#endif
- else {
+ } else {
errno = EINVAL;
return -1;
}
@@ -777,21 +803,15 @@
memcpy(&addr.s_addr, data, sizeof(addr.s_addr));
sl = snprintf(s, len, "%s", inet_ntoa(addr));
data += sizeof(addr.s_addr);
+ } else if (opt->type & ADDRIPV6) {
+ sl = ipv6_printaddr(s, len, data, ifname);
+ data += 16;
+ } else {
+ errno = EINVAL;
+ return -1;
}
-#ifdef INET6
- else if (opt->type & ADDRIPV6) {
- ssize_t r;
-
- r = ipv6_printaddr(s, len, data, ifname);
- if (r != -1)
- sl = r;
- else
- sl = 0;
- data += 16;
- }
-#endif
- else
- sl = 0;
+ if (sl == -1)
Home |
Main Index |
Thread Index |
Old Index