]>
git.ipfire.org Git - thirdparty/dhcpcd.git/log
Roy Marples [Wed, 15 Jul 2026 15:59:24 +0000 (16:59 +0100)]
Fix eloop better
Roy Marples [Wed, 15 Jul 2026 15:25:13 +0000 (16:25 +0100)]
Apple: remove compile warnings
Roy Marples [Wed, 15 Jul 2026 15:06:48 +0000 (16:06 +0100)]
eloop: fix a compile issue on Dragonfly while here
Roy Marples [Wed, 15 Jul 2026 14:00:01 +0000 (15:00 +0100)]
Fix compat
Roy Marples [Wed, 15 Jul 2026 13:56:32 +0000 (14:56 +0100)]
Fix compile
Roy Marples [Wed, 15 Jul 2026 13:47:08 +0000 (14:47 +0100)]
compat: add getpeereid.c and move compat out of control.c
Roy Marples [Tue, 14 Jul 2026 23:02:51 +0000 (00:02 +0100)]
Fix compile on IllumOS
Roy Marples [Tue, 14 Jul 2026 14:37:19 +0000 (15:37 +0100)]
Format
Roy Marples [Tue, 14 Jul 2026 14:35:33 +0000 (15:35 +0100)]
recvmsg WAITALL
Roy Marples [Tue, 14 Jul 2026 14:25:08 +0000 (15:25 +0100)]
Bound the data length
Roy Marples [Tue, 14 Jul 2026 14:01:47 +0000 (15:01 +0100)]
Fix the control socket for dhcpcd-ui
Add --isprivileged to return either true or false so the
caller can work this out as we now just have the one socket.
Bump version for this.
Roy Marples [Sun, 5 Jul 2026 15:05:25 +0000 (16:05 +0100)]
Add compat for Ilumos
Roy Marples [Sun, 5 Jul 2026 15:01:13 +0000 (16:01 +0100)]
Fix compile on Linux
Roy Marples [Sun, 5 Jul 2026 14:15:57 +0000 (15:15 +0100)]
control: remove unprivileged socket
Instead workout credentials from the connected socket
by getpeereid(2).
Remove the limit of only one connected control client.
This needs some testing and is only expected to compile on the BSDs
right now.
Roy Marples [Tue, 30 Jun 2026 12:29:28 +0000 (13:29 +0100)]
Build all the targets on macos
* Build all the targets on macos
Roy Marples [Mon, 29 Jun 2026 21:41:39 +0000 (22:41 +0100)]
options: Introduce policy groups
Remove the old bitmask array which we used to store which
options to request, remove, require, etc and replace with a
more generic policy group.
The policy group structure holds an array of option numbers
in each list - request, remove, require, etc.
Add a suite of helper functions around this to allow adding,
removing, checking, walking, etc.
This allows a much easier use of this in DHCP processing but more
importantly allows us to remove or reject options we do not
have a definition for.
Roy Marples [Fri, 26 Jun 2026 13:43:25 +0000 (14:43 +0100)]
privsep: Fix compile without INET
Chris Patterson [Tue, 23 Jun 2026 19:30:57 +0000 (15:30 -0400)]
dhcp: add configurable backoff parameters for DHCPv4 (#593)
In cloud and virtual environments the DHCP service is typically
ready within hundreds of milliseconds of the interface coming up,
and once ready, responds within single-digit milliseconds. The
RFC 2131 defaults (4s initial interval, 64s backoff cap) are
designed for congested broadcast networks and are unnecessarily
conservative in this context.
Add three new configuration options to tune DHCPv4 retransmission:
initial_interval - initial retransmission interval (default 4s)
backoff_cutoff - exponential backoff cap (default 64s)
backoff_jitter - random jitter per retry (default ±1000ms)
Defaults match RFC 2131 so existing behaviour is unchanged.
Option naming aligns with dhclient (initial-interval, backoff-cutoff).
Minimum of 1 is enforced at parse time for interval and cutoff;
invalid values are logged and the default is used.
These options are DHCPv4-only; DHCPv6 retransmission follows
RFC 8415 constants and is not user-configurable.
Closes #406
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Roy Marples [Tue, 23 Jun 2026 13:06:47 +0000 (14:06 +0100)]
IPv4: uset old_ia when adding an address causes early removal
This is true for NOALIAS configurations or Linux.
Reported by NVIDIA Project Vanessa
Roy Marples [Tue, 23 Jun 2026 01:17:10 +0000 (02:17 +0100)]
DHCPv6: When deprecating addresses, restart on prefix deletions
As that might invalidate the next address to iterate on.
Reported-by: CuB3y0nd <root@cubeyond.net>
Roy Marples [Tue, 23 Jun 2026 01:06:55 +0000 (02:06 +0100)]
DHCPv6: Prefix exclude option can be 17 octets (#671)
Well that's a simple off by one error
Reported-by: CuB3y0nd <root@cubeyond.net>
Roy Marples [Mon, 22 Jun 2026 23:34:58 +0000 (00:34 +0100)]
IPv6ND: Free routeinfo when it expires (#670)
Reported-by: CuB3y0nd <root@cubeyond.net>
Roy Marples [Mon, 22 Jun 2026 22:41:53 +0000 (23:41 +0100)]
control: Avoid hangup in the recvdata path
Instead return an error and bubble it up where it can be
hangup / freed more cleanly.
Reported-by: CuB3y0nd <root@cubeyond.net>
Roy Marples [Mon, 22 Jun 2026 20:14:11 +0000 (21:14 +0100)]
script: Fix buffer over and under flows in script_buftoenv
Enforce we have a buffer and it is terminated.
Rework code so that we no longer assert.
Reported by NVIDIA Project Vanessa
Roy Marples [Mon, 22 Jun 2026 19:56:18 +0000 (20:56 +0100)]
capsicum: Avoid some overflow issues in privsep sysctl
Limit olen to SIZE_MAX - sizeof(olen).
Ensure our buffer holds is big enough for olen AND newlen
AND is zeroed out as the following sysctl call might return
less data.
Reported by NVIDIA Project Vanessa
Roy Marples [Mon, 22 Jun 2026 18:25:48 +0000 (19:25 +0100)]
IPv6: Fix numerous issues extending temporary address times
Fix a potential integer underflow if pltime is less than
aquisition time.
Fix potential time truncation to uint32_t.
Reported by NVIDIA Project Vanessa
Roy Marples [Mon, 22 Jun 2026 17:06:35 +0000 (18:06 +0100)]
DHCP6: Fix configuring the suffix to delegated prefixes (#665)
Depending on the delegated prefix length and the user
configured suffix length, some parts of the suffix would be lost.
Reported by NVIDIA Project Vanessa
Roy Marples [Mon, 22 Jun 2026 15:24:10 +0000 (16:24 +0100)]
vsio: Allow zero length options
The spec allows it and this is an oversight.
Roy Marples [Mon, 22 Jun 2026 14:47:22 +0000 (15:47 +0100)]
eloop: Fix compile warning where UTIME_MAX is a calculation
And does not have correct parenthesis
Roy Marples [Mon, 22 Jun 2026 14:20:06 +0000 (15:20 +0100)]
workflows: limit to read only
Roy Marples [Mon, 22 Jun 2026 14:15:41 +0000 (15:15 +0100)]
eloop: Improve timespecdiff
Avoid signed integer overflow.
Fix a potential wrap around issue on 32-bit platforms.
Correctly use nanoseconds when adding a timespec timeout.
Reported by NVIDIA Project Vanessa
Roy Marples [Mon, 22 Jun 2026 10:21:17 +0000 (11:21 +0100)]
configure: Don't define _BSD_SOURCE for explicit_zero()
As newer glibc complains it should no longer be used.
Sigh.
Luckily _GNU_SOURCE still works and newer muscl works with that.
Roy Marples [Mon, 22 Jun 2026 09:19:31 +0000 (10:19 +0100)]
ipv6: Only regen temp addrs with sufficent pltime
If pltime is smaller then REGEN_ADVANCE then the address
would be regnerated way after pltime and vltime expired.
Reported by NVIDIA Project Vanessa
Roy Marples [Mon, 22 Jun 2026 08:40:13 +0000 (09:40 +0100)]
hooks: don't read past truncated ip6 address starting fe
We want to append the interface name to link-local addresses.
But we might get a truncated address as well and an attacker
could just supply the fe part. In this case, ensure we have
enough of the address to read the next byte otherwise don't
append the interface name.
Reported by NVIDIA Project Vanessa
Roy Marples [Sun, 21 Jun 2026 22:00:02 +0000 (23:00 +0100)]
auth: Ensure remaining dlen matches hash digest length
It's invalid otherwise.
Reported by NVIDIA Project Vanessa
Roy Marples [Sun, 21 Jun 2026 15:40:51 +0000 (16:40 +0100)]
auth: clear keys with memset_explicit
Supply compat/memset_explicit for platforms which lack it.
Adpat compat/arc4random.c for it.
Reported by NVIDIA Project Vanessa
Roy Marples [Sun, 21 Jun 2026 12:29:41 +0000 (13:29 +0100)]
privsep: Check data is terminated when a string
Reported by NVIDIA Project Vanessa
Roy Marples [Sun, 21 Jun 2026 11:15:37 +0000 (12:15 +0100)]
ARP: Iterate over states safely as the cb could remove ours
Reported by NVIDIA Project Vanessa
Roy Marples [Sun, 21 Jun 2026 10:13:53 +0000 (11:13 +0100)]
DHCP: Sanitise messages from servers for output
They could contain anything!
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 22:25:23 +0000 (23:25 +0100)]
Fix CI build
Roy Marples [Sat, 20 Jun 2026 22:00:57 +0000 (23:00 +0100)]
udev: Ensure we have a subsystem, action and ifname
As udev could return NULL for them.
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 21:33:32 +0000 (22:33 +0100)]
hooks: Quote assignment of compat vars correctly
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 20:57:45 +0000 (21:57 +0100)]
ARP: check we have enough to read the frame header
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 20:31:15 +0000 (21:31 +0100)]
ND: Enforce require and reject policy
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 17:14:30 +0000 (18:14 +0100)]
DHCP6: Ensure IA_PD Prefix Length is valid
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 16:39:45 +0000 (17:39 +0100)]
ND6: fix OOB reject mask for an undefined option
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 13:14:43 +0000 (14:14 +0100)]
options: Fix userclass boundary
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 11:16:51 +0000 (12:16 +0100)]
linux: Ensure NLA data boundaries are valid
Reported by NVIDIA Project Vanessa
Roy Marples [Sat, 20 Jun 2026 08:49:44 +0000 (09:49 +0100)]
privsep: ps_root_readfile should return the real file size
readfile NUL terminates the buffer to make things easy.
We need to transmit this over IPC just ensure the receiver has
a big enough buffer, again to make things easy.
So on success, we need to trim the NUL from the returned length
so the actual file size is accurate.
Roy Marples [Fri, 19 Jun 2026 08:07:36 +0000 (09:07 +0100)]
timezone: disallow directory traversal
Don't allow a timezone definition to go outside of it's directory
Reported by Hu Xinyao and NVIDIA Project Vanessa
Roy Marples [Thu, 18 Jun 2026 22:33:34 +0000 (23:33 +0100)]
privsep: Simplify readerror
And while here fix reading large DHCPv6 leases as well as exiting on stream error.
Roy Marples [Thu, 18 Jun 2026 14:39:22 +0000 (15:39 +0100)]
privsep: Remove PS_BUFLEN
We always send a header with the expected lengths.
So use malloced buffers to send and receive using this
knowledge.
Cezar Craciunoiu [Wed, 17 Jun 2026 09:14:04 +0000 (12:14 +0300)]
script: Use correct buffer length variable (#641)
Final call to the control queue used the wrong 'buflen'
variable. Change so the function stays consistent.
Signed-off-by: Cezar Craciunoiu <cezar@unikraft.io>
Roy Marples [Tue, 16 Jun 2026 22:13:45 +0000 (23:13 +0100)]
sun: Enable building for privsep
privsep has never worked on Sun.
To be fair, it's not any better because all processes
run as root, outside a chroot and without limits.
So why do this?
So we can eventually remove all non privsep code from dhcpcd, to
reduce complexity and provide a more secure platform for other OS.
Roy Marples [Tue, 16 Jun 2026 21:50:52 +0000 (22:50 +0100)]
privsep: Don't open PF_INET socket for each ioctl
Because we already have it open ....
Roy Marples [Thu, 11 Jun 2026 20:02:55 +0000 (20:02 +0000)]
BPF: fix libpcap compile
Roy Marples [Mon, 8 Jun 2026 21:14:34 +0000 (22:14 +0100)]
DHCP6: guard against an interface delegated too disappearing
This is very unlikely in the real world because you don't
delegate to interfaces which are removable.
In my testing the guard is not needed as things are cleaned up
correctly but this guard still helps to make sure.
Roy Marples [Mon, 8 Jun 2026 17:15:05 +0000 (17:15 +0000)]
options: Remove some const to fix compile warnings
I mean we do modify the data...
Roy Marples [Mon, 8 Jun 2026 17:00:55 +0000 (18:00 +0100)]
privsep: guard setproctitle and only use compat on linux
Roy Marples [Mon, 8 Jun 2026 16:51:29 +0000 (17:51 +0100)]
privsep: avoid a compile warning on systems without setproctitle
Roy Marples [Mon, 8 Jun 2026 15:23:17 +0000 (15:23 +0000)]
DHCP: Don't add a trailing : on vendor if no machine arch
Roy Marples [Mon, 8 Jun 2026 14:24:31 +0000 (15:24 +0100)]
DHCP: Don't really expire the lease when testing
Roy Marples [Mon, 8 Jun 2026 12:02:42 +0000 (13:02 +0100)]
privsep: Add ps_root_gethostname
For those OS who need it in a chroot.
Roy Marples [Sun, 7 Jun 2026 13:57:59 +0000 (14:57 +0100)]
privsep: Always seed arc4random
Some libc implementations will cache what random resource it
needs.
For those that don't .... good luck!
Roy Marples [Sun, 7 Jun 2026 11:19:31 +0000 (12:19 +0100)]
if: if_init inits the interface from the kernel
if_init_os inits the OS from the interface
Roy Marples [Sun, 7 Jun 2026 09:23:30 +0000 (10:23 +0100)]
privsep: Test defines for all ioctls
Roy Marples [Sun, 7 Jun 2026 09:08:46 +0000 (10:08 +0100)]
route: Use HAVE_RT_MISSFILTER rather than a generic BSD define
Roy Marples [Sun, 7 Jun 2026 09:00:01 +0000 (10:00 +0100)]
time.h always pulls in struct timespec
Roy Marples [Sun, 7 Jun 2026 00:22:39 +0000 (01:22 +0100)]
script: add ifxname as the escaped string
$interface is used for creating files.
$ifxname is used to reference the interace directly.
This is an important distinction for OS who can put
path separators or invalid path characters into the
interface name.
Roy Marples [Sat, 6 Jun 2026 07:20:41 +0000 (08:20 +0100)]
privsep: smaller buffer size without INET6
Roy Marples [Sat, 6 Jun 2026 06:57:23 +0000 (07:57 +0100)]
dhcp-common: Escape ifname for lease file
It's possible a characters allowed in an interface name
aren't shell or human readable on some OS.
While here, fix some formatting issues and ensure all PR's are formatted correctly.
Roy Marples [Wed, 3 Jun 2026 14:35:34 +0000 (15:35 +0100)]
privsep: Don't abort if we don't need a fdwaiter
Roy Marples [Wed, 3 Jun 2026 12:28:53 +0000 (13:28 +0100)]
dhcpcd: Don't add a link_fd if we don't have one.
Roy Marples [Wed, 3 Jun 2026 10:27:09 +0000 (11:27 +0100)]
route: Rework rt structure so sockaddrs are pointers (#621)
For each sockaddr, put a sockaddr_storage in the rt and
reference it.
This removes the need of a union and the macro dance
around it.
Roy Marples [Tue, 2 Jun 2026 12:26:28 +0000 (13:26 +0100)]
compat: Add support for getprogname(3)
Removes all inlined variations into a common single one.
Only supports Linux (which is all we did anyway), but now adds detection for program_invocation_short_name in libc and will use that OR package name.
All Linux libc should support this.
Roy Marples [Mon, 1 Jun 2026 21:07:06 +0000 (22:07 +0100)]
script: Don't assume AF_PACKET of if not AF_LINK
Roy Marples [Mon, 1 Jun 2026 20:20:01 +0000 (21:20 +0100)]
BPF: Improve headers
Roy Marples [Mon, 1 Jun 2026 19:35:30 +0000 (20:35 +0100)]
eloop: mark eloop as UNUSED for waitfd and ppoll
Roy Marples [Mon, 1 Jun 2026 18:43:11 +0000 (19:43 +0100)]
Adapt codebase for new pidfile
Roy Marples [Mon, 1 Jun 2026 18:42:11 +0000 (19:42 +0100)]
pidfile: Import latest from NetBSD
Features improved chroot and sandbox support.
Roy Marples [Wed, 27 May 2026 13:59:45 +0000 (14:59 +0100)]
eloop: set errno = EBADF rather than calling close if waitfd == -1
This avoids valgrind complaining.
Roy Marples [Sun, 24 May 2026 15:19:01 +0000 (16:19 +0100)]
Darwin: Add initial support for macOS (#613)
Apple route(4) has some limitations as does getifaddrs(3).
Basically there is no means of being notified of carrier state
because Apple only reports this via media state which is an ioctl.
The good news is that we can build macOS on github so we
can get some BSD traceability at least.
Fixes #524
Roy Marples [Thu, 21 May 2026 23:36:42 +0000 (00:36 +0100)]
eloop: fix USE_PPOLL define
Roy Marples [Thu, 21 May 2026 22:58:56 +0000 (23:58 +0100)]
privsep: Adapt to new eloop_waitfd()
Roy Marples [Thu, 21 May 2026 22:48:45 +0000 (23:48 +0100)]
eloop: Add eloop_openfdwaiter() and eloop_closefdwaiter()
Use kqueue or epoll for eloop_waitfd().
This requires opening a new kqueue or epoll to handle this as
this is a one shot event we don't want to touch the eloop events.
This works with RLIMIT_NOFILE = 0.
Roy Marples [Thu, 21 May 2026 07:43:58 +0000 (08:43 +0100)]
DHCP6: Delete the eloop event before closing an ia listener socket
This only happens when dhcpcd is running on a specific interface
and can trigger erroneous logs deleting the socket from
kqueue/epoll.
With the prior eloop it could also trigger ia events from a
non related fd if re-used.
Hopefully fixes #596.
Roy Marples [Thu, 21 May 2026 07:39:55 +0000 (08:39 +0100)]
eloop: always remove event from list on delete
Event if kevent or epoll return an error from the operation.
We still return the error so the caller can log a diagnostic.
Thanks to Graham Northup for the hint.
May help with #596.
Roy Marples [Tue, 19 May 2026 16:15:56 +0000 (17:15 +0100)]
Merge pull request #610 from NetworkConfiguration/esc_ifname
hooks: Escape interface names and use printf
Joan Lledó [Tue, 19 May 2026 14:21:54 +0000 (15:21 +0100)]
hooks: Escape interface names and use printf
In the Hurd, interface names can include invalid characters like `/`.
So those must be escaped.
Roy Marples [Tue, 19 May 2026 12:04:22 +0000 (13:04 +0100)]
Merge pull request #607 from NetworkConfiguration/bpf
BPF: Split OS specific code out into own files and add libpcap support
Roy Marples [Tue, 19 May 2026 11:37:27 +0000 (12:37 +0100)]
BPF: Correct libpcap warning
Roy Marples [Tue, 19 May 2026 11:31:04 +0000 (12:31 +0100)]
BPF: Add a DLPI interface
This works alongside the BSD interface.
We use the BSD interface for receiving and the DLPI interface
for sending.
Roy Marples [Tue, 19 May 2026 11:23:59 +0000 (12:23 +0100)]
BPF: Test for pcap_set_immediate_mode()
Roy Marples [Tue, 19 May 2026 10:59:43 +0000 (11:59 +0100)]
BPF: harden libpcap on BSD
It's unlikely that pcap_setwritefilter() and pcap_lockfilter()
will make it into a release, so harden a pcap without these ourself
for the time being.
Roy Marples [Sun, 17 May 2026 15:38:22 +0000 (16:38 +0100)]
BPF: Use pcap_setwritefilter() and pcap_lockfilter()
If available.
Upstream PR: https://github.com/the-tcpdump-group/libpcap/pull/1683
Roy Marples [Sun, 17 May 2026 12:12:23 +0000 (13:12 +0100)]
BPF: Address review comments
Joan Lledó [Fri, 15 May 2026 09:30:24 +0000 (10:30 +0100)]
BPF: Add support for libpcap
This makes it easier to support OS's where we don't have kernel
support for any BPF ourselves, such as GNU/Hurd.
Roy Marples [Fri, 15 May 2026 08:57:34 +0000 (09:57 +0100)]
BPF: Fixup comment to indicate this could be used outside of dhcpcd
Roy Marples [Thu, 14 May 2026 20:36:09 +0000 (21:36 +0100)]
BPF: Simplify by splitting OS specifics into own files
Roy Marples [Sat, 9 May 2026 12:13:56 +0000 (13:13 +0100)]
privsep: Change IPC to use SOCK_STREAM (#604)
macOS does not support SOCK_SEQPACKET.
All our messages use a fixed header which includes the
lengths of all parts sent.
We can use these limits with MSG_WAITALL on blocking sockets
in place of MSG_EOR to get the same effect.
Start of the work for #524.