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-10.0.1 with the fo...
details: https://anonhg.NetBSD.org/src/rev/34009324c0bb
branches: trunk
changeset: 374365:34009324c0bb
user: roy <roy%NetBSD.org@localhost>
date: Fri Apr 21 16:52:28 2023 +0000
description:
Update to dhcpcd-10.0.1 with the following changes:
* privsep: keep resources open rather than open/close
* dhcp6: OPTION_NTP_SERVER is now preferred over OPTION_SNTP_SERVER
* Misc bug fixes mainly around privsep for many platforms.
* Fix for reading the some BSD routing table entries.
* Fix reading authtokens from config.
Big new release, mainly around better privsep process management
which allows us to detect when they exit unexpectedly.
diffstat:
external/bsd/dhcpcd/dist/LICENSE | 2 +-
external/bsd/dhcpcd/dist/README.md | 10 +-
external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant | 4 +-
external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks | 18 +-
external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8 | 29 +-
external/bsd/dhcpcd/dist/src/arp.c | 34 +-
external/bsd/dhcpcd/dist/src/arp.h | 2 +-
external/bsd/dhcpcd/dist/src/auth.c | 2 +-
external/bsd/dhcpcd/dist/src/auth.h | 2 +-
external/bsd/dhcpcd/dist/src/bpf.h | 2 +-
external/bsd/dhcpcd/dist/src/common.c | 2 +-
external/bsd/dhcpcd/dist/src/common.h | 2 +-
external/bsd/dhcpcd/dist/src/control.c | 198 ++--
external/bsd/dhcpcd/dist/src/control.h | 2 +-
external/bsd/dhcpcd/dist/src/defs.h | 4 +-
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 | 2 +-
external/bsd/dhcpcd/dist/src/dhcp.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcp6.h | 3 +-
external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c | 2 +-
external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h | 2 +-
external/bsd/dhcpcd/dist/src/dhcpcd.8 | 22 +-
external/bsd/dhcpcd/dist/src/dhcpcd.conf.5 | 30 +-
external/bsd/dhcpcd/dist/src/dhcpcd.h | 19 +-
external/bsd/dhcpcd/dist/src/duid.c | 13 +-
external/bsd/dhcpcd/dist/src/duid.h | 2 +-
external/bsd/dhcpcd/dist/src/eloop.c | 943 ++++++++++++++++-----
external/bsd/dhcpcd/dist/src/eloop.h | 33 +-
external/bsd/dhcpcd/dist/src/if-options.h | 5 +-
external/bsd/dhcpcd/dist/src/if.c | 13 +-
external/bsd/dhcpcd/dist/src/if.h | 31 +-
external/bsd/dhcpcd/dist/src/ipv4.c | 2 +-
external/bsd/dhcpcd/dist/src/ipv4.h | 2 +-
external/bsd/dhcpcd/dist/src/ipv4ll.c | 2 +-
external/bsd/dhcpcd/dist/src/ipv4ll.h | 2 +-
external/bsd/dhcpcd/dist/src/ipv6nd.h | 4 +-
external/bsd/dhcpcd/dist/src/logerr.h | 2 +-
external/bsd/dhcpcd/dist/src/privsep-bpf.c | 41 +-
external/bsd/dhcpcd/dist/src/privsep-bpf.h | 2 +-
external/bsd/dhcpcd/dist/src/privsep-bsd.c | 221 ++++-
external/bsd/dhcpcd/dist/src/privsep-control.c | 81 +-
external/bsd/dhcpcd/dist/src/privsep-control.h | 2 +-
external/bsd/dhcpcd/dist/src/privsep-inet.c | 188 ++-
external/bsd/dhcpcd/dist/src/privsep-inet.h | 2 +-
external/bsd/dhcpcd/dist/src/privsep-root.c | 288 ++++-
external/bsd/dhcpcd/dist/src/privsep-root.h | 9 +-
external/bsd/dhcpcd/dist/src/privsep.h | 56 +-
external/bsd/dhcpcd/dist/src/route.c | 5 +-
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 | 2 +-
53 files changed, 1633 insertions(+), 723 deletions(-)
diffs (truncated from 4607 to 300 lines):
diff -r 713728938e59 -r 34009324c0bb external/bsd/dhcpcd/dist/LICENSE
--- a/external/bsd/dhcpcd/dist/LICENSE Fri Apr 21 16:12:53 2023 +0000
+++ b/external/bsd/dhcpcd/dist/LICENSE Fri Apr 21 16:52:28 2023 +0000
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2021 Roy Marples <roy%marples.name@localhost>
+Copyright (c) 2006-2023 Roy Marples <roy%marples.name@localhost>
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff -r 713728938e59 -r 34009324c0bb external/bsd/dhcpcd/dist/README.md
--- a/external/bsd/dhcpcd/dist/README.md Fri Apr 21 16:12:53 2023 +0000
+++ b/external/bsd/dhcpcd/dist/README.md Fri Apr 21 16:52:28 2023 +0000
@@ -1,11 +1,11 @@
# dhcpcd
dhcpcd is a
-[DHCP](http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol) and a
-[DHCPv6](http://en.wikipedia.org/wiki/DHCPv6) client.
-It's also an IPv4LL (aka [ZeroConf](http://en.wikipedia.org/wiki/Zeroconf))
+[DHCP](https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol) and a
+[DHCPv6](https://en.wikipedia.org/wiki/DHCPv6) client.
+It's also an IPv4LL (aka [ZeroConf](https://en.wikipedia.org/wiki/Zeroconf))
client.
-In layman's terms, dhcpcd runs on your machine and silently configures your
+In layperson's terms, dhcpcd runs on your machine and silently configures your
computer to work on the attached networks without trouble and mostly without
configuration.
@@ -93,4 +93,4 @@ dhcpcd-9 defaults the run directory to `
We no longer supply a ChangeLog.
However, you're more than welcome to read the
[commit log](https://roy.marples.name/git/dhcpcd/log) and
-[archived release announcements](http://roy.marples.name/archives/dhcpcd-discuss/).
+[archived release announcements](https://roy.marples.name/archives/dhcpcd-discuss/).
diff -r 713728938e59 -r 34009324c0bb external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
--- a/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant Fri Apr 21 16:12:53 2023 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant Fri Apr 21 16:52:28 2023 +0000
@@ -102,8 +102,8 @@ wpa_supplicant_stop()
}
if [ "$ifwireless" = "1" ] && \
- type wpa_supplicant >/dev/null 2>&1 && \
- type wpa_cli >/dev/null 2>&1
+ command -v wpa_supplicant >/dev/null 2>&1 && \
+ command -v wpa_cli >/dev/null 2>&1
then
case "$reason" in
PREINIT) wpa_supplicant_start;;
diff -r 713728938e59 -r 34009324c0bb external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks Fri Apr 21 16:12:53 2023 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks Fri Apr 21 16:52:28 2023 +0000
@@ -67,7 +67,7 @@ key_get_value()
key="$1"
shift
- if type sed >/dev/null 2>&1; then
+ if command -v sed >/dev/null 2>&1; then
sed -n "s/^$key//p" $@
else
for x do
@@ -89,7 +89,7 @@ remove_markers()
in_marker=0
shift; shift
- if type sed >/dev/null 2>&1; then
+ if command -v sed >/dev/null 2>&1; then
sed "/^$m1/,/^$m2/d" $@
else
for x do
@@ -109,9 +109,9 @@ comp_file()
{
[ -e "$1" ] && [ -e "$2" ] || return 1
- if type cmp >/dev/null 2>&1; then
+ if command -v cmp >/dev/null 2>&1; then
cmp -s "$1" "$2"
- elif type diff >/dev/null 2>&1; then
+ elif command -v diff >/dev/null 2>&1; then
diff -q "$1" "$2" >/dev/null
else
# Hopefully we're only working on small text files ...
@@ -178,7 +178,7 @@ syslog()
err|error) echo "$interface: $*" >&2;;
*) echo "$interface: $*";;
esac
- if type logger >/dev/null 2>&1; then
+ if command -v logger >/dev/null 2>&1; then
logger -i -p daemon."$lvl" -t dhcpcd-run-hooks "$interface: $*"
fi
}
@@ -234,11 +234,11 @@ detect_init()
if [ -x /bin/systemctl ] && [ -S /run/systemd/private ]; then
_service_exists="/bin/systemctl --quiet is-enabled \$1.service"
_service_status="/bin/systemctl --quiet is-active \$1.service"
- _service_cmd="/bin/systemctl \$2 \$1.service"
+ _service_cmd="/bin/systemctl \$2 --no-block \$1.service"
elif [ -x /usr/bin/systemctl ] && [ -S /run/systemd/private ]; then
_service_exists="/usr/bin/systemctl --quiet is-enabled \$1.service"
_service_status="/usr/bin/systemctl --quiet is-active \$1.service"
- _service_cmd="/usr/bin/systemctl \$2 \$1.service"
+ _service_cmd="/usr/bin/systemctl \$2 --no-block \$1.service"
elif [ -x /sbin/rc-service ] &&
{ [ -s /libexec/rc/init.d/softlevel ] ||
[ -s /run/openrc/softlevel ]; }
@@ -338,9 +338,11 @@ for hook in \
/libexec/dhcpcd-hooks/* \
/etc/dhcpcd.exit-hook
do
+ case "$hook" in
+ */*~) continue;;
+ esac
for skip in $skip_hooks; do
case "$hook" in
- */*~) continue 2;;
*/"$skip") continue 2;;
*/[0-9][0-9]"-$skip") continue 2;;
*/[0-9][0-9]"-$skip.sh") continue 2;;
diff -r 713728938e59 -r 34009324c0bb external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8
--- a/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8 Fri Apr 21 16:12:53 2023 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8 Fri Apr 21 16:52:28 2023 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2006-2021 Roy Marples
+.\" Copyright (c) 2006-2023 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 December 27, 2020
+.Dd August 31, 2022
.Dt DHCPCD-RUN-HOOKS 8
.Os
.Sh NAME
@@ -68,15 +68,14 @@ is set to the interface that
.Nm dhcpcd
is run on and
.Ev $reason
-is to the reason why
-q
+is set to the reason why
.Nm
was invoked.
DHCP information to be configured is held in variables starting with the word
new_ and old DHCP information to be removed is held in variables starting with
the word old_.
.Nm dhcpcd
-can display the full list of variables it knows how about by using the
+can display the full list of variables it knows about by using the
.Fl V , -variables
argument.
.Pp
@@ -85,7 +84,7 @@ Here's a list of reasons why
could be invoked:
.Bl -tag -width EXPIREXXXEXPIRE6
.It Dv PREINIT
-dhcpcd is starting up and any pre-initialisation should be done.
+dhcpcd is starting up and any pre-initialisation required should be performed now.
.It Dv CARRIER
dhcpcd has detected the carrier is up.
This is generally just a notification and no action need be taken.
@@ -94,14 +93,14 @@ dhcpcd lost the carrier.
The cable may have been unplugged or association to the wireless point lost.
.It Dv NOCARRIER_ROAMING
dhcpcd lost the carrier but the interface configuration is persisted.
-The OS has to support wireless roaming or IP Persistance for this to happen.
+The OS has to support wireless roaming or IP Persistence for this to happen.
.It Dv INFORM | Dv INFORM6
dhcpcd informed a DHCP server about its address and obtained other
configuration details.
.It Dv BOUND | Dv BOUND6
dhcpcd obtained a new lease from a DHCP server.
.It Dv RENEW | Dv RENEW6
-dhcpcd renewed it's lease.
+dhcpcd renewed its lease.
.It Dv REBIND | Dv REBIND6
dhcpcd has rebound to a new DHCP server.
.It Dv REBOOT | Dv REBOOT6
@@ -181,7 +180,7 @@ flags.
.Ev $interface
MTU.
.It Ev $ifssid
-the name of the SSID the
+the SSID the
.Ev interface
is connected to.
.It Ev $interface_order
@@ -207,24 +206,24 @@ Address family waiting for, as defined i
the name of the profile selected from
.Xr dhcpcd.conf 5 .
.It Ev $new_delegated_dhcp6_prefix
-space separated list of delegated prefixes.
+space-separated list of delegated prefixes.
.El
.Sh FILES
When
.Nm
runs, it loads
-.Pa /etc/dhcpcd.enter-hook
-and any scripts found in
+.Pa /etc/dhcpcd.enter-hook ,
+any scripts found in
.Pa /libexec/dhcpcd-hooks
-in a lexical order and then finally
-.Pa /etc/dhcpcd.exit-hook
+in lexical order, then finally
+.Pa /etc/dhcpcd.exit-hook .
.Sh SEE ALSO
.Xr dhcpcd 8
.Sh AUTHORS
.An Roy Marples Aq Mt roy%marples.name@localhost
.Sh BUGS
Please report them to
-.Lk http://roy.marples.name/projects/dhcpcd
+.Lk https://roy.marples.name/projects/dhcpcd
.Sh SECURITY CONSIDERATIONS
.Nm dhcpcd
will validate the content of each option against its encoding.
diff -r 713728938e59 -r 34009324c0bb external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c Fri Apr 21 16:12:53 2023 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c Fri Apr 21 16:52:28 2023 +0000
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* dhcpcd - ARP handler
- * Copyright (c) 2006-2021 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2023 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -232,6 +232,9 @@ arp_packet(struct interface *ifp, uint8_
const struct iarp_state *state;
struct arp_state *astate, *astaten;
uint8_t *hw_s, *hw_t;
+#ifndef KERNEL_RFC5227
+ bool is_probe;
+#endif /* KERNEL_RFC5227 */
/* Copy the frame header source and destination out */
memset(&arm, 0, sizeof(arm));
@@ -284,6 +287,23 @@ arp_packet(struct interface *ifp, uint8_
memcpy(&arm.tha, hw_t, ar.ar_hln);
memcpy(&arm.tip.s_addr, hw_t + ar.ar_hln, ar.ar_pln);
+#ifndef KERNEL_RFC5227
+ /* During ARP probe the 'sender hardware address' MUST contain the hardware
+ * address of the interface sending the packet. RFC5227, 1.1 */
+ is_probe = ar.ar_op == htons(ARPOP_REQUEST) && IN_IS_ADDR_UNSPECIFIED(&arm.sip) &&
+ bpf_flags & BPF_BCAST;
+ if (is_probe && falen > 0 && (falen != ar.ar_hln ||
+ memcmp(&arm.sha, &arm.fsha, ar.ar_hln))) {
+ char abuf[HWADDR_LEN * 3];
+ char fbuf[HWADDR_LEN * 3];
+ hwaddr_ntoa(&arm.sha, ar.ar_hln, abuf, sizeof(abuf));
+ hwaddr_ntoa(&arm.fsha, falen, fbuf, sizeof(fbuf));
+ logwarnx("%s: invalid ARP probe, sender hw address mismatch (%s, %s)",
+ ifp->name, abuf, fbuf);
+ return;
+ }
+#endif /* KERNEL_RFC5227 */
+
/* Match the ARP probe to our states.
* Ignore Unicast Poll, RFC1122. */
state = ARP_CSTATE(ifp);
@@ -299,7 +319,7 @@ arp_packet(struct interface *ifp, uint8_
}
static void
-arp_read(void *arg)
+arp_read(void *arg, unsigned short events)
{
struct arp_state *astate = arg;
struct bpf *bpf = astate->bpf;
@@ -308,6 +328,9 @@ arp_read(void *arg)
ssize_t bytes;
struct in_addr addr = astate->addr;
+ if (events != ELE_READ)
+ logerrx("%s: unexpected event 0x%04x", __func__, events);
+
/* Some RAW mechanisms are generic file descriptors, not sockets.
* This means we have no kernel call to just get one packet,
* so we have to process the entire buffer. */
@@ -532,7 +555,7 @@ arp_new(struct interface *ifp, const str
struct arp_state *astate;
if ((state = ARP_STATE(ifp)) == NULL) {
- ifp->if_data[IF_DATA_ARP] = malloc(sizeof(*state));
+ ifp->if_data[IF_DATA_ARP] = malloc(sizeof(*state));
state = ARP_STATE(ifp);
if (state == NULL) {
logerr(__func__);
@@ -567,8 +590,9 @@ arp_new(struct interface *ifp, const str
free(astate);
return NULL;
}
- eloop_event_add(ifp->ctx->eloop, astate->bpf->bpf_fd,
- arp_read, astate);
+ if (eloop_event_add(ifp->ctx->eloop, astate->bpf->bpf_fd, ELE_READ,
Home |
Main Index |
Thread Index |
Old Index