]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
21 hours agotimezone: disallow directory traversal master
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

31 hours agoprivsep: Simplify readerror
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.

38 hours agoprivsep: Remove PS_BUFLEN
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.

2 days agoscript: Use correct buffer length variable (#641)
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>
3 days agosun: Enable building for privsep
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.

3 days agoprivsep: Don't open PF_INET socket for each ioctl
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 ....

8 days agoBPF: fix libpcap compile
Roy Marples [Thu, 11 Jun 2026 20:02:55 +0000 (20:02 +0000)] 
BPF: fix libpcap compile

11 days agoDHCP6: guard against an interface delegated too disappearing
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.

11 days agooptions: Remove some const to fix compile warnings
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...

11 days agoprivsep: guard setproctitle and only use compat on linux
Roy Marples [Mon, 8 Jun 2026 17:00:55 +0000 (18:00 +0100)] 
privsep: guard setproctitle and only use compat on linux

11 days agoprivsep: avoid a compile warning on systems without setproctitle
Roy Marples [Mon, 8 Jun 2026 16:51:29 +0000 (17:51 +0100)] 
privsep: avoid a compile warning on systems without setproctitle

11 days agoDHCP: Don't add a trailing : on vendor if no machine arch
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

11 days agoDHCP: Don't really expire the lease when testing
Roy Marples [Mon, 8 Jun 2026 14:24:31 +0000 (15:24 +0100)] 
DHCP: Don't really expire the lease when testing

11 days agoprivsep: Add ps_root_gethostname
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.

12 days agoprivsep: Always seed arc4random
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!

12 days agoif: if_init inits the interface from the kernel
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

12 days agoprivsep: Test defines for all ioctls
Roy Marples [Sun, 7 Jun 2026 09:23:30 +0000 (10:23 +0100)] 
privsep: Test defines for all ioctls

12 days agoroute: Use HAVE_RT_MISSFILTER rather than a generic BSD define
Roy Marples [Sun, 7 Jun 2026 09:08:46 +0000 (10:08 +0100)] 
route: Use HAVE_RT_MISSFILTER rather than a generic BSD define

12 days agotime.h always pulls in struct timespec
Roy Marples [Sun, 7 Jun 2026 09:00:01 +0000 (10:00 +0100)] 
time.h always pulls in struct timespec

13 days agoscript: add ifxname as the escaped string
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.

13 days agoprivsep: smaller buffer size without INET6
Roy Marples [Sat, 6 Jun 2026 07:20:41 +0000 (08:20 +0100)] 
privsep: smaller buffer size without INET6

13 days agodhcp-common: Escape ifname for lease file
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.

2 weeks agoprivsep: Don't abort if we don't need a fdwaiter
Roy Marples [Wed, 3 Jun 2026 14:35:34 +0000 (15:35 +0100)] 
privsep: Don't abort if we don't need a fdwaiter

2 weeks agodhcpcd: Don't add a link_fd if we don't have one.
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.

2 weeks agoroute: Rework rt structure so sockaddrs are pointers (#621)
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.

2 weeks agocompat: Add support for getprogname(3)
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.

2 weeks agoscript: Don't assume AF_PACKET of if not AF_LINK
Roy Marples [Mon, 1 Jun 2026 21:07:06 +0000 (22:07 +0100)] 
script: Don't assume AF_PACKET of if not AF_LINK

2 weeks agoBPF: Improve headers
Roy Marples [Mon, 1 Jun 2026 20:20:01 +0000 (21:20 +0100)] 
BPF: Improve headers

2 weeks agoeloop: mark eloop as UNUSED for waitfd and ppoll
Roy Marples [Mon, 1 Jun 2026 19:35:30 +0000 (20:35 +0100)] 
eloop: mark eloop as UNUSED for waitfd and ppoll

2 weeks agoAdapt codebase for new pidfile
Roy Marples [Mon, 1 Jun 2026 18:43:11 +0000 (19:43 +0100)] 
Adapt codebase for new pidfile

2 weeks agopidfile: Import latest from NetBSD
Roy Marples [Mon, 1 Jun 2026 18:42:11 +0000 (19:42 +0100)] 
pidfile: Import latest from NetBSD

Features improved chroot and sandbox support.

3 weeks agoeloop: set errno = EBADF rather than calling close if waitfd == -1
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.

3 weeks agoDarwin: Add initial support for macOS (#613)
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

4 weeks agoeloop: fix USE_PPOLL define
Roy Marples [Thu, 21 May 2026 23:36:42 +0000 (00:36 +0100)] 
eloop: fix USE_PPOLL define

4 weeks agoprivsep: Adapt to new eloop_waitfd()
Roy Marples [Thu, 21 May 2026 22:58:56 +0000 (23:58 +0100)] 
privsep: Adapt to new eloop_waitfd()

4 weeks agoeloop: Add eloop_openfdwaiter() and eloop_closefdwaiter()
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.

4 weeks agoDHCP6: Delete the eloop event before closing an ia listener socket
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.

4 weeks agoeloop: always remove event from list on delete
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.

4 weeks agoMerge pull request #610 from NetworkConfiguration/esc_ifname
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

4 weeks agohooks: Escape interface names and use printf 610/head
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.

4 weeks agoMerge pull request #607 from NetworkConfiguration/bpf
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

4 weeks agoBPF: Correct libpcap warning 607/head
Roy Marples [Tue, 19 May 2026 11:37:27 +0000 (12:37 +0100)] 
BPF: Correct libpcap warning

4 weeks agoBPF: Add a DLPI interface
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.

4 weeks agoBPF: Test for pcap_set_immediate_mode()
Roy Marples [Tue, 19 May 2026 11:23:59 +0000 (12:23 +0100)] 
BPF: Test for pcap_set_immediate_mode()

4 weeks agoBPF: harden libpcap on BSD
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.

4 weeks agoBPF: Use pcap_setwritefilter() and pcap_lockfilter()
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

4 weeks agoBPF: Address review comments
Roy Marples [Sun, 17 May 2026 12:12:23 +0000 (13:12 +0100)] 
BPF: Address review comments

5 weeks agoBPF: Add support for libpcap
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.

5 weeks agoBPF: Fixup comment to indicate this could be used outside of dhcpcd
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

5 weeks agoBPF: Simplify by splitting OS specifics into own files
Roy Marples [Thu, 14 May 2026 20:36:09 +0000 (21:36 +0100)] 
BPF: Simplify by splitting OS specifics into own files

5 weeks agoprivsep: Change IPC to use SOCK_STREAM (#604)
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.

6 weeks agoformat: Ensure <netinet/icmp6.h> comes before <netinet/in.h>
Roy Marples [Tue, 5 May 2026 13:37:29 +0000 (14:37 +0100)] 
format: Ensure <netinet/icmp6.h> comes before <netinet/in.h>

6 weeks agoeloop: Bring in updated from dhcpsd
Roy Marples [Tue, 5 May 2026 09:56:30 +0000 (10:56 +0100)] 
eloop: Bring in updated from dhcpsd

* Initial Darwin/macOS support
* Close epoll fd on fork
* Use poll as ppoll may not be available when waiting for a fd

7 weeks agoFormat code with clang-format v19 (#601)
Roy Marples [Thu, 30 Apr 2026 16:44:47 +0000 (17:44 +0100)] 
Format code with clang-format v19 (#601)

Using a template taken from FreeBSD
Add a github action to enforce this

7 weeks agoAdd missing SPDX-License tags (#591)
Colin McInnes [Thu, 30 Apr 2026 16:42:43 +0000 (10:42 -0600)] 
Add missing SPDX-License tags (#591)

* Add missing SPDX-License tags

If copyright block is present, add missing SPDX-License tag

If copyright block is not present, add one. Use BSD-3-Clause and infer author list from git blame.

Resolves #570

* Ensure all non-copyrighted files are BSD-2

Overall project is BSD-2, not 3, so ensure any new license header was BSD-2.

General formatting cleanup.

* Update md5.h to put SPDX copyright in correct place

Brain fart, I put it right before the line containing "copyright" but that was in the middle of a sentence.

7 weeks agoRelease dhcpcd-10.3.2 v10.3.2
Roy Marples [Thu, 30 Apr 2026 13:38:32 +0000 (14:38 +0100)] 
Release dhcpcd-10.3.2

2 months agoDHCP: free the state when dropping on state NONE
Roy Marples [Mon, 23 Mar 2026 15:31:01 +0000 (15:31 +0000)] 
DHCP: free the state when dropping on state NONE

Fixes an issue when dhcpcd tries to release when the carrier
is down.

Fixes #560

3 months agoDHCP: Don't run double EXPIRE hooks on carrier loss
Roy Marples [Thu, 19 Mar 2026 11:39:40 +0000 (11:39 +0000)] 
DHCP: Don't run double EXPIRE hooks on carrier loss

Fixes #587.

3 months agoRelease dhcpcd-10.3.1 v10.3.1
Roy Marples [Mon, 16 Mar 2026 12:03:38 +0000 (12:03 +0000)] 
Release dhcpcd-10.3.1

3 months agoFix guards for prior
Roy Marples [Mon, 16 Mar 2026 11:45:01 +0000 (11:45 +0000)] 
Fix guards for prior

3 months agoBSD: don't send uninitialised memory using ps_root_indirectioctl
Roy Marples [Fri, 6 Mar 2026 23:02:36 +0000 (23:02 +0000)] 
BSD: don't send uninitialised memory using ps_root_indirectioctl

This will affect FreeBSD and OpenBSD.
Use sendmsg to send the length of the interface name, then the
interface name and then the data rather than just sending
IFNAMSIZ which may have uninitialised bytes at the end.

Opimise ps_sendcmdmsg while here.
Hopefully helps #565 but I'm not hopeful.

3 months agomanager: Fix loosing iface options on CARRIER
Daniel Gröber [Fri, 6 Mar 2026 22:47:42 +0000 (22:47 +0000)] 
manager: Fix loosing iface options on CARRIER

When an interface (re-)gains carrier dhcpcd_handlecarrier() runs
dhcpcd_initstate() to kick off profile re-selection. Previously this used
args originally passed when starting the manager (ctx->argv).

However interfaces started via the manager control
interface (dhcpcd_initstate1() in dhcpcd_handleargs()) may be started with
different args.

For example if we start a manager with

    dhcpcd -M --inactive

and then start only IPv4 on an interface with

    dhcpcd -4 iface0

a subsequent CARRIER event will reset the interface to what amounts to
"default config + `-M --inactive`" which in this case will enable ipv6
also!

To fix this we keep a copy of the arguments used to start an interface in
the manager (dhcpcd_handleargs()) code path around around (ifp->argv).

In the current implementation args passed for renew following the initial
interface start will not be persisted. This causes the interface to reset
to a state of "defaults + config + profile + start-cmdline".

For example (continuing the scenario above) after enabling ipv6 with -n:

    $ dhcpcd -6 -n iface0

A subsequent CARRIER event will disable ipv6 again as the effective
arguments remain `-4 iface0` as passed during interface start.

Note the per-interface daemon code path wasn't affected as ctx->args
already contains the interface start args.

3 months agontp: Build new_ntp_servers without superfluous spaces
Roy Marples [Fri, 6 Mar 2026 11:48:30 +0000 (11:48 +0000)] 
ntp: Build new_ntp_servers without superfluous spaces

Fixes #582.

3 months agoroute: fix a bogus uninitialised check from clang
Roy Marples [Thu, 26 Feb 2026 23:06:38 +0000 (23:06 +0000)] 
route: fix a bogus uninitialised check from clang

3 months agoipv6nd: empty IPV6RA_EXPIRE eloop queue when dropping
Roy Marples [Thu, 26 Feb 2026 17:58:42 +0000 (17:58 +0000)] 
ipv6nd: empty IPV6RA_EXPIRE eloop queue when dropping

Fixes #584

Helps #566

3 months agoDHCP: Add parentheses to macro definitions
acst1223 [Thu, 26 Feb 2026 08:35:12 +0000 (17:35 +0900)] 
DHCP: Add parentheses to macro definitions

Missing parentheses in IP_UDP_SIZE caused wrong computation of MSZ
(option57). When mtu is 1500, current MSZ value is 1488=1500-20+8, while
the correct value should be 1472=1500-(20+8).

Also added parentheses for BOOTP_MIN_MTU.

4 months agoprivsep: Ensure we recv for real after a successful recv MSG_PEEK
Roy Marples [Tue, 17 Feb 2026 12:48:55 +0000 (12:48 +0000)] 
privsep: Ensure we recv for real after a successful recv MSG_PEEK

* privsep: Ensure we recv for real after a successful recv MSG_PEEK

Adjust the code flow so that the same errors would be caught
after the final recv.
This ensures we read what is really meant for us and not
something silly.

Return EBADMSG on recvmsg len mismatch.

5 months agocommon: Cast via uintptr_t rather than unsigned long in UNCONST (#581)
Jessica Clarke [Fri, 9 Jan 2026 21:56:25 +0000 (21:56 +0000)] 
common: Cast via uintptr_t rather than unsigned long in UNCONST (#581)

On ILP32 and LP64 systems, unsigned long is sufficient to round-trip
pointers, but on LLP64 systems it is too small, and on systems like
CHERI where pointers are capabilities, it does not propagate capability
metadata, and casting back to a pointer to yield a pointer that cannot
be dereferenced.

Instead, cast via uintptr_t to ensure we always use an integral type
that can losslessly round-trip pointers.

5 months agooptions: Don't assume vsio options have an argument (#578)
Roy Marples [Wed, 31 Dec 2025 10:12:24 +0000 (10:12 +0000)] 
options: Don't assume vsio options have an argument (#578)

* options: Don't assume vsio options have an argument

Should fix #577.

5 months agooptions: Ensure that an overly long bitflag string does not crash (#576)
Roy Marples [Tue, 30 Dec 2025 21:36:24 +0000 (21:36 +0000)] 
options: Ensure that an overly long bitflag string does not crash (#576)

Fixes #573.

5 months agoroute: Routes may not have an interface assinged (#572)
Roy Marples [Tue, 30 Dec 2025 07:28:00 +0000 (07:28 +0000)] 
route: Routes may not have an interface assinged (#572)

As such, we cannot access dhcpcd_ctx so we can't use the free
route list.
Fixes #571.

5 months agooptions: Ensure ldop is not NULL dereferenced (#568)
Roy Marples [Sun, 21 Dec 2025 08:31:52 +0000 (08:31 +0000)] 
options: Ensure ldop is not NULL dereferenced (#568)

ldop itself cannot be non NULL as it points to the location.
but *ldop CAN be NULL.

Fixes #567.

6 months agoIPv4: Ignore DHCP state when building routes (#557)
Roy Marples [Thu, 4 Dec 2025 09:26:57 +0000 (09:26 +0000)] 
IPv4: Ignore DHCP state when building routes (#557)

* IPv4: Ignore DHCP state when building routes

As this will change periodically.
We only care if the state (address) has been added.

Fixes #440 thanks to JognSmit.

6 months agoFix fallback_time option (#562)
Colin McInnes [Wed, 3 Dec 2025 09:41:04 +0000 (03:41 -0600)] 
Fix fallback_time option (#562)

Fallback time option was updating request_time instead of fallback_time.

Resolves #561

7 months agoDHCP6: Don't restart INFORM timers on subsequent failure.
Roy Marples [Tue, 18 Nov 2025 12:08:26 +0000 (12:08 +0000)] 
DHCP6: Don't restart INFORM timers on subsequent failure.

7 months agoRelease dhcpcd-10.3.0 v10.3.0
Roy Marples [Fri, 14 Nov 2025 15:38:04 +0000 (15:38 +0000)] 
Release dhcpcd-10.3.0

7 months agoeloop: remove epoll_pwait2 support
Roy Marples [Fri, 14 Nov 2025 15:34:51 +0000 (15:34 +0000)] 
eloop: remove epoll_pwait2 support

It's just not there on musl, detecting it at compile time
is hit and miss on glibc due to mismatched kernel headers.

7 months agoeloop: Simplify ppoll a little
Roy Marples [Fri, 14 Nov 2025 15:05:39 +0000 (15:05 +0000)] 
eloop: Simplify ppoll a little

7 months agoinstall queue.h
Roy Marples [Fri, 14 Nov 2025 14:52:33 +0000 (14:52 +0000)] 
install queue.h

7 months agoeloop: Work with fortified compilers
Roy Marples [Fri, 14 Nov 2025 14:52:19 +0000 (14:52 +0000)] 
eloop: Work with fortified compilers

7 months agoAdapt to new eloop.
Roy Marples [Fri, 14 Nov 2025 13:08:58 +0000 (13:08 +0000)] 
Adapt to new eloop.

7 months agoeloop: Replace the inner eloop concept with waitfd
Roy Marples [Fri, 14 Nov 2025 13:08:21 +0000 (13:08 +0000)] 
eloop: Replace the inner eloop concept with waitfd

This is what we really want and saves the massive headache of
managing two loops.

7 months agoBSD: Reject routes are not cloned/connected routes
Roy Marples [Thu, 13 Nov 2025 14:40:02 +0000 (14:40 +0000)] 
BSD: Reject routes are not cloned/connected routes

Likewise, if we change from a reject to a non reject route
we need to remove it rather than changing it as some BSD
kernels preserve the RTF_GATEWAY flag.

7 months agoscript: STOP should not set if_down=true
Roy Marples [Thu, 13 Nov 2025 11:19:38 +0000 (11:19 +0000)] 
script: STOP should not set if_down=true

7 months agoeloop: formatting
Roy Marples [Tue, 11 Nov 2025 13:18:39 +0000 (13:18 +0000)] 
eloop: formatting

7 months agoProtocols will notify when dhcpcd can exit (#536)
Roy Marples [Tue, 11 Nov 2025 13:13:03 +0000 (13:13 +0000)] 
Protocols will notify when dhcpcd can exit (#536)

* Protocols will notify when dhcpcd can exit

DHCPv6 RELEASE requires the addresses to be dropped before
a RELEASE message is sent.
We now wait for an acknowledgement or a timeout before notifying
that DHCPv6 has stopped for the interface.

DHCPv4 RELEASE is the other way around, there is no acknowledgement.
So we wait for 1 second after sending the message before removing
the address and notifying DHCP has stopped for the interface.

If we are not releasing then we notify dhcpcd that the protocol has
stopped right away when we drop the lease.

dhcpcd will exit once there are no running protocols for the
interfaces.

Fixes #513.
Hopefully #535, #519 and #509 as well.

Co-authored-by: Sime Zupanovic (EXT) <sime.zupanovic.ext@ericsson.com>
7 months agoeloop: Try and fix clean compile on all BSD
Roy Marples [Tue, 11 Nov 2025 11:32:12 +0000 (11:32 +0000)] 
eloop: Try and fix clean compile on all BSD

7 months agoeloop: Fix epoll for prior
Roy Marples [Tue, 11 Nov 2025 11:20:31 +0000 (11:20 +0000)] 
eloop: Fix epoll for prior

7 months agoeloop: Simplify kqueue implementation
Roy Marples [Tue, 11 Nov 2025 11:07:21 +0000 (11:07 +0000)] 
eloop: Simplify kqueue implementation

Easier to read, reduces binary size at a small cost of
more kevents when forking and keeping fd's which
is acceptable.

7 months agodhcpcd: log error on eloop_signal_set_cb failure
Roy Marples [Tue, 11 Nov 2025 10:36:36 +0000 (10:36 +0000)] 
dhcpcd: log error on eloop_signal_set_cb failure

7 months agoprivsep: we might not have a root process
Roy Marples [Tue, 11 Nov 2025 07:21:09 +0000 (07:21 +0000)] 
privsep: we might not have a root process

7 months agoeloop: Fix kqueue on FreeBSD
Roy Marples [Mon, 10 Nov 2025 22:22:02 +0000 (22:22 +0000)] 
eloop: Fix kqueue on FreeBSD

7 months agocompat: Fix sha256 on Dragonfly at least
Roy Marples [Mon, 10 Nov 2025 22:02:49 +0000 (22:02 +0000)] 
compat: Fix sha256 on Dragonfly at least

7 months agoeloop: exit all eloops when stopping on signals
Roy Marples [Mon, 10 Nov 2025 20:00:20 +0000 (20:00 +0000)] 
eloop: exit all eloops when stopping on signals

7 months agoeloop: for kqueue and epoll, grow the receiving event list as needed.
Roy Marples [Mon, 10 Nov 2025 19:44:01 +0000 (19:44 +0000)] 
eloop: for kqueue and epoll, grow the receiving event list as needed.

7 months agoprivsep: Drain the log when the root process is exiting
Roy Marples [Wed, 5 Nov 2025 10:00:55 +0000 (10:00 +0000)] 
privsep: Drain the log when the root process is exiting

So we stand a better chance of printing the exit messages.

7 months agoeloop: total events to listen to is nfds, not nevents
Roy Marples [Mon, 3 Nov 2025 09:44:55 +0000 (09:44 +0000)] 
eloop: total events to listen to is nfds, not nevents

Only important for kqueue when there are only signals and timeouts
in play.

7 months agoNetBSD: Delete RTF_CONNECTED route when changing it.
Roy Marples [Sun, 2 Nov 2025 06:44:27 +0000 (06:44 +0000)] 
NetBSD: Delete RTF_CONNECTED route when changing it.

We need to flush anything dynamically created.

7 months agoFix compile on Alpine linux
Roy Marples [Fri, 31 Oct 2025 08:18:55 +0000 (08:18 +0000)] 
Fix compile on Alpine linux

7 months agoFix eloop test
Roy Marples [Fri, 31 Oct 2025 07:38:38 +0000 (07:38 +0000)] 
Fix eloop test