5767 Commits

Author SHA1 Message Date
Roy Marples
e35e6c8d74 Fix eloop test 2025-10-31 07:38:38 +00:00
Roy Marples
3b187a7fcc privsep: Fix reading results from root process
Should be the final fallout from the new eloop.
2025-10-31 07:29:10 +00:00
Roy Marples
760a3d27f7 Fix compile with rbtree and queue on Linux 2025-10-31 07:28:53 +00:00
Roy Marples
da32038b02 eloop: Fix a memory leak 2025-10-31 07:27:33 +00:00
Roy Marples
d5536a344f Fix some fallout from prior 2025-10-30 19:08:32 +00:00
Roy Marples
60594cd12a Adjust for new eloop.
Needs more testing.
2025-10-30 14:09:28 +00:00
Roy Marples
c4d6af24d3 eloop: Import latest from dhcpsd
Finally have kqueue and epoll working for a multi-process
setup.
The secret sauce was that after forking the fd for polling
is invalid and as such should not be closed blindly.
2025-10-30 14:07:54 +00:00
Roy Marples
e13bfe32b9 Use rbtree from vendor
It is unexpected for this to exist on anything other than NetBSD.
2025-10-30 13:55:08 +00:00
Roy Marples
b65a54c7a6 Merge branch 'vendor/RBTREE' 2025-10-30 11:53:06 +00:00
Roy Marples
64f653bba5 Use queue.h from vendor area rather than system supplied
It just makes things easier really than working it out all the
time for differing OS's.
2025-10-30 11:35:32 +00:00
Roy Marples
f5b6f55272 Merge branch 'vendor/QUEUE' 2025-10-30 11:30:58 +00:00
Roy Marples
078c042eab Import rbtree.c v1.2 and rbtree.h v1.14 from NetBSD 2025-10-30 11:22:30 +00:00
Roy Marples
aa96ab1516 Import queue.h v1.77 from NetBSD 2025-10-30 11:19:40 +00:00
Roy Marples
6fc45c222d Add vendor area 2025-10-30 11:16:29 +00:00
Roy Marples
2e3b0e548a When stopping all interfaces at exit and releasing, remove persistance. 2025-09-30 17:19:43 +01:00
Roy Marples
6e0483302b ipv6: respect slaac hwaddr to really use the hwaddr
If the interface has one, otherwise it will fall back to using
the first ipv6 link-local address as before.
2025-09-30 13:52:33 +01:00
Roy Marples
593c0a3353 Add a .clangd file to aid lsp. 2025-09-30 09:43:04 +01:00
Roy Marples
195e8bdc38 route: Don't change them when exiting with persistence.
If an interface stops, it might affect the routing priority.
When dhcpcd is exiting we want to avoid this behaviour to keep
the system running as best as.
2025-09-30 09:42:11 +01:00
Gleb Smirnoff
b709538cbb
privsep: enforce message boundaries with MSG_EOR on our messages (#533)
privsep: enforce message boundaries with MSG_EOR on our messages

The nature of the SOCK_SEQPACKET, that privsep modules uses, is stream.
See:

https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_10_06

To guarantee that a reader will never read two messages in one read
operation, the writer shall put end of record markers.

The problem exposed itself in FreeBSD 15.0 that started to follow the
specification better than before.

Other SOCK_SEQPACKET usage considerations: a) as long as our reader
provides a receive buffer that would fit the largest message our writer
would ever send, we are good with regards to not a reading a partial
message b) as long as our writer always write full messages with one
write, we don't need use of MSG_WAITALL in reader.

Fixes #530

Co-authored-by: Roy Marples <roy@marples.name>
2025-09-30 08:54:35 +01:00
Roy Marples
6dcb1569fc ND Route Information Option prefix is optional
As the length could be zero and is RFC compliant.
Fixes #527.
2025-09-13 12:45:50 +01:00
Roy Marples
4b7065a78f DHCP: Put the message type option first
There is no ordering requirement from any RFC other than the
recommendations in RFC 7844.
But it seems some DHCP servers really want the message type as
the first option.

Fixes #522.
2025-09-02 15:40:10 +01:00
Roy Marples
4dd7ebedbe DHCP6: Don't exit if using DHCP4 INFORM in non manager mode
Fixes #514.
2025-07-05 09:20:34 +01:00
Roy Marples
226a68edb9 DHCP: Request static_routes from dhcpcd.conf
Rather than being requested by default in the dhcpcd binary.
This matches classless_static_routes.
2025-06-16 23:54:31 +01:00
Roy Marples
1d88866d50 DHCP: Don't request a lease time
RFC 2131 4.3.1 says lease time MUST be included in OFFER and ACK
so there is no need to request it.
2025-06-16 23:45:17 +01:00
Roy Marples
f9fbe9420d Add truncate to defintions
This indicates an option might be truncated from it's natural
length and will be zero padded on expansion.
Only supported for the ip6address option.

While here, support 1 as a bitflag to just print the bit.

Fixes #508.
2025-06-16 22:00:35 +01:00
Roy Marples
b1c17c30ad DHCP: Don't request T1 and T2
RFC2131 4.4.5 says:
The server SHOULD return T1 and T2.

Other DHCP clients don't request them by default and we can save two
bytes in the message size by not sending them.
2025-06-15 22:23:13 +01:00
Roy Marples
93df2b254c Release dhcpcd-10.2.4 v10.2.4 2025-06-01 19:40:28 +01:00
Roy Marples
46b6a361bb compat: use timingsafe_bcmp if available
Its return value is the opposite of consttime_memequal.
This function is available all modern BSD's except for NetBSD where
we have consttime_memequal.
2025-06-01 16:55:48 +01:00
Roy Marples
16d65603a8 IPv6ND: Sort routers by reachability correctly.
Related to #492.
2025-05-21 00:54:58 +01:00
Roy Marples
f7dab17411 defintions: define ND Route Information option
We can't express a 2-bit integer at a 3 bit offset yet
so just print the reserved value.

Also allows this option to be excluded, fixing #506.
2025-05-20 23:59:31 +01:00
Roy Marples
a35afcd891 IPv6: Clear previous address RA flags on receipt of a RA.
This allows a prefix gateway to transition from onlink to
not on link.

Fixes #506.
2025-05-20 22:10:41 +01:00
Roy Marples
6851f338dc route: return false for rt_add on failure rather than garbage 2025-05-20 20:28:08 +01:00
Roy Marples
e20185bc09 Release dhcpcd-10.2.3 v10.2.3 2025-05-16 13:30:35 +01:00
Roy Marples
c5cd8d3206 Fix prior for FreeBSD and OpenBSD 2025-05-16 13:19:31 +01:00
Roy Marples
b697f37ad7 IPv6: store the destination address
We need to match this address on BSD and Illumos as it might be
the gateway address for a route to find the interface it belongs to.
2025-05-16 13:12:22 +01:00
Roy Marples
410bf77064 Fix a cast warning on DragonflyBSD 2025-05-09 12:56:33 +01:00
Roy Marples
9f94e9c7aa Bump for prior. 2025-05-09 09:09:57 +01:00
Roy Marples
9e4a4f3fcf dhcpcd: fork to background on initial timeout
Unless the -1, --oneshot option is given.
dhcpcd should keep on trying to configure the interface.
Fixes #423
2025-05-09 09:09:57 +01:00
Roy Marples
109861c52f dhcpcd: Fix -b --background
It's been broken for a while... just the 11 years ago in 1d5d236
Initial fix for #423
2025-05-09 09:09:57 +01:00
Quang Anh
6299f1f1ca
linux: stop old interface name instead of new one (#505) 2025-04-26 18:15:35 +01:00
Doug Nazar
67af1dbe9d
Restore logic on when to open an address specific socket (#502)
850f93b changed the logic while moving things around. Restore
the original logic so we open a socket even if the address is the
same, so long as it's the first time.
2025-04-25 20:37:54 +01:00
Roy Marples
882614ab07 cast pid_t to int when used in format strings
Silences warnings on Solaris
2025-04-15 14:28:10 +01:00
Roy Marples
1893f35105 sun: fix compile for if_mtu 2025-04-15 14:16:46 +01:00
Roy Marples
7ae45ed281 duid: document we don't create a duid from system uuid by default
Fixes #496
2025-04-15 11:46:35 +01:00
Roy Marples
dabdf5728e resolv: Fix processing more DNSSL options than RDNSS 2025-04-15 11:03:37 +01:00
Roy Marples
79c195b92f dhcpcd: Remove option rapid_commit from dhcpcd.conf
Apparently some ISPs report they support it by sending the option
back, but the reality is they don't.

Fixes #499.
2025-04-15 10:45:19 +01:00
Roy Marples
0f62fdd014 privsep: Fix valgrind and hardened-malloc on Linux with SECCOMP
Valgrind will still error by default at exit as the syscall to
unlink the pipe files is denied.
This can be avoided by compiling with -DVALGRIND.
The pipe files still won't be removed as dhcpcd has
already dropped to the non root user.
This is a Vagrind issue really.

hardened-malloc should now run as well as their documented syscalls
are now allowed by default.

Fixes #497.
2025-04-15 10:29:11 +01:00
Roy Marples
4db8dddf51 route: Don't spam route changes for lifetime
Fixes #459
2025-04-01 10:17:13 +01:00
Roy Marples
44e4ac6e36 dhcpcd: ignore ENXIO on handlelink 2025-04-01 10:03:42 +01:00
Roy Marples
958279d631 Linux: Fix build for kernels without RTA_EXPIRES
Fixes #493.
2025-03-26 10:21:19 +00:00