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 Update to dhcpcd-9.0.0 with the fol...
details: https://anonhg.NetBSD.org/src/rev/78c86114c860
branches: trunk
changeset: 1008754:78c86114c860
user: roy <roy%NetBSD.org@localhost>
date: Thu Apr 02 12:38:54 2020 +0000
description:
Update to dhcpcd-9.0.0 with the following changes:
* Decode interface complex interface names eth0.100:2 eth0i100:2.
This allows us to ignore some virtual interfaces by default
* ARP: Report L2 header address on conflict for more clarity
* DHCP: Support jumbo frames (untested)
* DHCP6: Clean up old lease on failure to confirm/rebind, etc
* RA: Prefer older routers
* INET6: Obscure prefixes are now calculated correctly
* Privilege Separation
* default hostname is now a blank string rather than localhost
* Leases are now dumped over the control socket - you get RA's now as well.
* Better support for many IPv6 routers
* RTM_MISS filtering
* RA: Deprecate stale addresses by setting pltime 0
* DHCP6: Deprecate stale addresses by setting pltime 0
diffstat:
external/bsd/dhcpcd/dist/LICENSE | 2 +-
external/bsd/dhcpcd/dist/README.md | 10 +-
external/bsd/dhcpcd/dist/hooks/00-linux | 11 +
external/bsd/dhcpcd/dist/hooks/30-hostname.in | 158 ++++
external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in | 15 +-
external/bsd/dhcpcd/dist/src/arp.c | 166 +++-
external/bsd/dhcpcd/dist/src/arp.h | 12 +-
external/bsd/dhcpcd/dist/src/auth.c | 2 +-
external/bsd/dhcpcd/dist/src/auth.h | 2 +-
external/bsd/dhcpcd/dist/src/bpf.h | 4 +-
external/bsd/dhcpcd/dist/src/common.c | 5 +-
external/bsd/dhcpcd/dist/src/common.h | 71 +-
external/bsd/dhcpcd/dist/src/control.c | 57 +-
external/bsd/dhcpcd/dist/src/control.h | 5 +-
external/bsd/dhcpcd/dist/src/defs.h | 14 +-
external/bsd/dhcpcd/dist/src/dev.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcp-common.c | 2 +-
external/bsd/dhcpcd/dist/src/dhcp-common.h | 5 +-
external/bsd/dhcpcd/dist/src/dhcp.h | 10 +-
external/bsd/dhcpcd/dist/src/dhcp6.h | 27 +-
external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c | 12 +-
external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in | 42 +-
external/bsd/dhcpcd/dist/src/dhcpcd.h | 28 +-
external/bsd/dhcpcd/dist/src/duid.c | 26 +-
external/bsd/dhcpcd/dist/src/duid.h | 6 +-
external/bsd/dhcpcd/dist/src/eloop.c | 337 +++++--
external/bsd/dhcpcd/dist/src/eloop.h | 44 +-
external/bsd/dhcpcd/dist/src/if-options.h | 12 +-
external/bsd/dhcpcd/dist/src/if.c | 137 ++-
external/bsd/dhcpcd/dist/src/if.h | 41 +-
external/bsd/dhcpcd/dist/src/ipv4.c | 3 +-
external/bsd/dhcpcd/dist/src/ipv4.h | 2 +-
external/bsd/dhcpcd/dist/src/ipv4ll.c | 6 +-
external/bsd/dhcpcd/dist/src/ipv4ll.h | 2 +-
external/bsd/dhcpcd/dist/src/ipv6nd.h | 14 +-
external/bsd/dhcpcd/dist/src/logerr.h | 48 +-
external/bsd/dhcpcd/dist/src/privsep-bpf.c | 374 +++++++++
external/bsd/dhcpcd/dist/src/privsep-bpf.h | 51 +
external/bsd/dhcpcd/dist/src/privsep-bsd.c | 123 +++
external/bsd/dhcpcd/dist/src/privsep-inet.c | 622 ++++++++++++++++
external/bsd/dhcpcd/dist/src/privsep-inet.h | 58 +
external/bsd/dhcpcd/dist/src/privsep-root.c | 589 +++++++++++++++
external/bsd/dhcpcd/dist/src/privsep-root.h | 54 +
external/bsd/dhcpcd/dist/src/privsep.c | 736 +++++++++++++++++++
external/bsd/dhcpcd/dist/src/privsep.h | 171 ++++
external/bsd/dhcpcd/dist/src/route.c | 31 +-
external/bsd/dhcpcd/dist/src/route.h | 2 +-
external/bsd/dhcpcd/dist/src/sa.c | 2 +-
external/bsd/dhcpcd/dist/src/sa.h | 2 +-
external/bsd/dhcpcd/dist/src/script.h | 8 +-
51 files changed, 3753 insertions(+), 412 deletions(-)
diffs (truncated from 5594 to 300 lines):
diff -r c0b1b2698122 -r 78c86114c860 external/bsd/dhcpcd/dist/LICENSE
--- a/external/bsd/dhcpcd/dist/LICENSE Thu Apr 02 12:35:13 2020 +0000
+++ b/external/bsd/dhcpcd/dist/LICENSE Thu Apr 02 12:38:54 2020 +0000
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
+Copyright (c) 2006-2020 Roy Marples <roy%marples.name@localhost>
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff -r c0b1b2698122 -r 78c86114c860 external/bsd/dhcpcd/dist/README.md
--- a/external/bsd/dhcpcd/dist/README.md Thu Apr 02 12:35:13 2020 +0000
+++ b/external/bsd/dhcpcd/dist/README.md Thu Apr 02 12:38:54 2020 +0000
@@ -89,11 +89,19 @@
dhcpcd-7 defaults the database directory to `/var/db/dhcpcd` instead of
`/var/db` and now stores dhcpcd.duid and dhcpcd.secret in there instead of
in /etc.
+dhcpcd-9 requires this directory and contents to be writeable by the
+unprivileged user (default _dhcpcd).
The Makefile `_confinstall` target will attempt to move the files correctly from
the old locations to the new locations.
-Of course this won't work if dhcpcd-7 is packaged up, so packagers will need to
+
+Of course this won't work if dhcpcd is packaged up, so packagers will need to
install similar logic into their dhcpcd package.
+dhcpcd-9 defaults the run directory to `/var/run/dhcpcd` instead of
+`/var/run` and the prefix of dhcpcd has been removed from the files.
+dhcpcd-9 may also run in a chroot, `/var/chroot/dhcpcd` so all the files
+could be relative to that.
+
## ChangeLog
We no longer supply a ChangeLog.
However, you're more than welcome to read the
diff -r c0b1b2698122 -r 78c86114c860 external/bsd/dhcpcd/dist/hooks/00-linux
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/00-linux Thu Apr 02 12:38:54 2020 +0000
@@ -0,0 +1,11 @@
+# setup chroot mounts
+
+if [ "$reason" = CHROOT ] && [ -n "$chroot" ]; then
+ for d in /dev /proc /sys /run/udev; do
+ [ -d "$d" ] || continue
+ if ! mountpoint -q "$chroot$d"; then
+ mkdir -p "$chroot$d"
+ mount --bind $d "$chroot$d"
+ fi
+ done
+fi
diff -r c0b1b2698122 -r 78c86114c860 external/bsd/dhcpcd/dist/hooks/30-hostname.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/30-hostname.in Thu Apr 02 12:38:54 2020 +0000
@@ -0,0 +1,158 @@
+# Set the hostname from DHCP data if required
+
+# A hostname can either be a short hostname or a FQDN.
+# hostname_fqdn=true
+# hostname_fqdn=false
+# hostname_fqdn=server
+
+# A value of server means just what the server says, don't manipulate it.
+# This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
+# where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
+# DHCPv6 has no hostname option.
+# RFC4702 section 3.1 says FQDN should be prefered over hostname.
+#
+# As such, the default is hostname_fqdn=true so that a consistent hostname
+# is always assigned.
+: ${hostname_fqdn:=true}
+
+# If we used to set the hostname, but relinquish control of it, we should
+# reset to the default value.
+: ${hostname_default=@DEFAULT_HOSTNAME@}
+
+# Some systems don't have hostname(1)
+_hostname()
+{
+ if [ -z "${1+x}" ]; then
+ if [ -r /proc/sys/kernel/hostname ]; then
+ read name </proc/sys/kernel/hostname && echo "$name"
+ elif type hostname >/dev/null 2>/dev/null; then
+ hostname
+ elif sysctl kern.hostname >/dev/null 2>&1; then
+ sysctl -n kern.hostname
+ elif sysctl kernel.hostname >/dev/null 2>&1; then
+ sysctl -n kernel.hostname
+ else
+ return 1
+ fi
+ return $?
+ fi
+
+ if [ -w /proc/sys/kernel/hostname ]; then
+ echo "$1" >/proc/sys/kernel/hostname
+ elif [ -n "$1" ] && type hostname >/dev/null 2>&1; then
+ hostname "$1"
+ elif sysctl kern.hostname >/dev/null 2>&1; then
+ sysctl -w "kern.hostname=$1" >/dev/null
+ elif sysctl kernel.hostname >/dev/null 2>&1; then
+ sysctl -w "kernel.hostname=$1" >/dev/null
+ else
+ # May fail to set a blank hostname
+ hostname "$1"
+ fi
+}
+
+is_default_hostname()
+{
+ case "$1" in
+ ""|"$hostname_default"|localhost|localhost.localdomain)
+ return 0;;
+ esac
+ return 1
+}
+
+need_hostname()
+{
+ # Always load the hostname variable for future use
+ hostname="$(_hostname)"
+ is_default_hostname "$hostname" && return 0
+
+ case "$force_hostname" in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;;
+ esac
+
+ if [ -n "$old_fqdn" ]; then
+ if ${hfqdn} || ! ${hshort}; then
+ [ "$hostname" = "$old_fqdn" ]
+ else
+ [ "$hostname" = "${old_fqdn%%.*}" ]
+ fi
+ elif [ -n "$old_host_name" ]; then
+ if ${hfqdn}; then
+ if [ -n "$old_domain_name" ] &&
+ [ "$old_host_name" = "${old_host_name#*.}" ]
+ then
+ [ "$hostname" = \
+ "$old_host_name.$old_domain_name" ]
+ else
+ [ "$hostname" = "$old_host_name" ]
+ fi
+ elif ${hshort}; then
+ [ "$hostname" = "${old_host_name%%.*}" ]
+ else
+ [ "$hostname" = "$old_host_name" ]
+ fi
+ else
+ # No old hostname
+ false
+ fi
+}
+
+try_hostname()
+{
+ [ "$hostname" = "$1" ] && return 0
+ if valid_domainname "$1"; then
+ syslog info "Setting hostname: $1"
+ _hostname "$1"
+ else
+ syslog err "Invalid hostname: $1"
+ fi
+}
+
+set_hostname()
+{
+ hfqdn=false
+ hshort=false
+ case "$hostname_fqdn" in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) hfqdn=true;;
+ ""|[Ss][Ee][Rr][Vv][Ee][Rr]) ;;
+ *) hshort=true;;
+ esac
+
+ need_hostname || return
+
+ if [ -n "$new_fqdn" ]; then
+ if ${hfqdn} || ! ${hshort}; then
+ try_hostname "$new_fqdn"
+ else
+ try_hostname "${new_fqdn%%.*}"
+ fi
+ elif [ -n "$new_host_name" ]; then
+ if ${hfqdn}; then
+ if [ -n "$new_domain_name" ] &&
+ [ "$new_host_name" = "${new_host_name#*.}" ]
+ then
+ try_hostname "$new_host_name.$new_domain_name"
+ else
+ try_hostname "$new_host_name"
+ fi
+ elif ${hshort}; then
+ try_hostname "${new_host_name%%.*}"
+ else
+ try_hostname "$new_host_name"
+ fi
+ elif ! is_default_hostname "$hostname"; then
+ try_hostname "$hostname_default"
+ fi
+}
+
+# For ease of use, map DHCP6 names onto our DHCP4 names
+case "$reason" in
+BOUND6|RENEW6|REBIND6|REBOOT6|INFORM6)
+ new_fqdn="$new_dhcp6_fqdn"
+ old_fqdn="$old_dhcp6_fqdn"
+ ;;
+esac
+
+if $if_up; then
+ set_hostname
+fi
diff -r c0b1b2698122 -r 78c86114c860 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in Thu Apr 02 12:35:13 2020 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in Thu Apr 02 12:38:54 2020 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2006-2018 Roy Marples
+.\" Copyright (c) 2006-2020 Roy Marples
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 20, 2018
+.Dd January 21, 2020
.Dt DHCPCD-RUN-HOOKS 8
.Os
.Sh NAME
@@ -69,6 +69,7 @@
is run on and
.Ev $reason
is to the reason why
+q
.Nm
was invoked.
DHCP information to be configured is held in variables starting with the word
@@ -83,6 +84,8 @@
.Nm
could be invoked:
.Bl -tag -width EXPIREXXXEXPIRE6
+.It Dv CHROOT
+dhcpcd is starting up and needs to configure a chroot environment.
.It Dv PREINIT
dhcpcd is starting up and any pre-initialisation should be done.
.It Dv CARRIER
@@ -144,12 +147,14 @@
.Sh ENVIRONMENT
.Nm dhcpcd
will clear the environment variables aside from
-.Ev $PATH
-and
-.Ev $RC_SVCNAME .
+.Ev $PATH .
The following variables will then be set, along with any protocol supplied
ones.
.Bl -tag -width xnew_delegated_dhcp6_prefix
+.It Ev $chroot
+the directory where
+.Nm dhcpcd
+is chrooted.
.It Ev $interface
the name of the interface.
.It Ev $protocol
diff -r c0b1b2698122 -r 78c86114c860 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c Thu Apr 02 12:35:13 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c Thu Apr 02 12:38:54 2020 +0000
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* dhcpcd - ARP handler
- * Copyright (c) 2006-2019 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2020 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
#include <string.h>
#include <unistd.h>
-#define ELOOP_QUEUE 5
+#define ELOOP_QUEUE ELOOP_ARP
#include "config.h"
#include "arp.h"
#include "bpf.h"
@@ -53,10 +53,12 @@
#include "if-options.h"
#include "ipv4ll.h"
#include "logerr.h"
+#include "privsep.h"
#if defined(ARP)
-#define ARP_LEN \
- (sizeof(struct arphdr) + (2 * sizeof(uint32_t)) + (2 * HWADDR_LEN))
+#define ARP_LEN \
+ (FRAMEHDRLEN_MAX + \
+ sizeof(struct arphdr) + (2 * sizeof(uint32_t)) + (2 * HWADDR_LEN))
/* ARP debugging can be quite noisy. Enable this for more noise! */
//#define ARP_DEBUG
@@ -103,7 +105,13 @@
Home |
Main Index |
Thread Index |
Old Index