Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/ROY]: src/external/bsd/dhcpcd/dist Update to dhcpcd-9.0.0 with the follo...



details:   https://anonhg.NetBSD.org/src/rev/c094e683ef0b
branches:  ROY
changeset: 746487:c094e683ef0b
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/20-resolv.conf        |    4 +-
 external/bsd/dhcpcd/dist/hooks/30-hostname.in        |  158 +++
 external/bsd/dhcpcd/dist/hooks/50-ntp.conf           |    2 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in |   15 +-
 external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in   |    2 +-
 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.c                   |  139 ++-
 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.c                  |  671 +++++++++-------
 external/bsd/dhcpcd/dist/src/dhcp.h                  |   10 +-
 external/bsd/dhcpcd/dist/src/dhcp6.c                 |  770 +++++++++---------
 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.8.in             |   32 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.c                |  637 ++++++++++-----
 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-bsd.c                |  349 ++++++-
 external/bsd/dhcpcd/dist/src/if-options.c            |  133 ++-
 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/ipv6.c                  |  174 ++--
 external/bsd/dhcpcd/dist/src/ipv6.h                  |   11 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.c                |  392 ++++++---
 external/bsd/dhcpcd/dist/src/ipv6nd.h                |   14 +-
 external/bsd/dhcpcd/dist/src/logerr.c                |   54 +-
 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.c                |  255 ++++--
 external/bsd/dhcpcd/dist/src/script.h                |    8 +-
 66 files changed, 5980 insertions(+), 1810 deletions(-)

diffs (truncated from 12194 to 300 lines):

diff -r fa267b802683 -r c094e683ef0b external/bsd/dhcpcd/dist/LICENSE
--- a/external/bsd/dhcpcd/dist/LICENSE  Mon Jan 27 21:11:12 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 fa267b802683 -r c094e683ef0b external/bsd/dhcpcd/dist/README.md
--- a/external/bsd/dhcpcd/dist/README.md        Mon Jan 27 21:11:12 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 fa267b802683 -r c094e683ef0b 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 fa267b802683 -r c094e683ef0b external/bsd/dhcpcd/dist/hooks/20-resolv.conf
--- a/external/bsd/dhcpcd/dist/hooks/20-resolv.conf     Mon Jan 27 21:11:12 2020 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/20-resolv.conf     Thu Apr 02 12:38:54 2020 +0000
@@ -42,7 +42,7 @@
                # Build the nameserver list
                srvs=$(cd "$resolv_conf_dir"; \
                        key_get_value "nameserver " ${interfaces})
-               for x in $(uniqify ${srvs}); do
+               for x in $(uniqify $srvs); do
                        servers="${servers}nameserver $x$NL"
                done
        fi
@@ -152,6 +152,7 @@
                fi
        fi
        if [ -n "$new_domain_search" ]; then
+               new_domain_search=$(uniqify $new_domain_search)
                if valid_domainname_list $new_domain_search; then
                        conf="${conf}search $new_domain_search$NL"
                elif ! $warn; then
@@ -159,6 +160,7 @@
                            "$new_domain_search"
                fi
        fi
+       new_domain_name_servers=$(uniqify $new_domain_name_servers)
        for x in ${new_domain_name_servers}; do
                conf="${conf}nameserver $x$NL"
        done
diff -r fa267b802683 -r c094e683ef0b 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 fa267b802683 -r c094e683ef0b external/bsd/dhcpcd/dist/hooks/50-ntp.conf
--- a/external/bsd/dhcpcd/dist/hooks/50-ntp.conf        Mon Jan 27 21:11:12 2020 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/50-ntp.conf        Thu Apr 02 12:38:54 2020 +0000
@@ -41,7 +41,7 @@
        esac
 fi
 
-# Debian has a seperate file for DHCP config to avoid stamping on
+# Debian has a separate file for DHCP config to avoid stamping on
 # the master.
 if [ "$ntp_service" = ntpd ] && type invoke-rc.d >/dev/null 2>&1; then
        [ -e /var/lib/ntp ] || mkdir /var/lib/ntp
diff -r fa267b802683 -r c094e683ef0b external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in      Mon Jan 27 21:11:12 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.



Home | Main Index | Thread Index | Old Index