5715 Commits

Author SHA1 Message Date
Roy Marples
733a4733e5 BSD: Fix compile on some BSD OS
if_mtu is a macro in these headers which conflicts with our function
2025-03-09 16:11:38 +00:00
Roy Marples
f6983c18db Release dhcpcd-10.2.2 v10.2.2 2025-02-25 12:37:57 +00:00
Roy Marples
685a9714f2 release: Default to gpg2 to avoid SHA1 signatures
Fixes #457
2025-02-25 11:54:01 +00:00
Roy Marples
2669fb715f options: Allow interface block to be pattern matching
Fixes #473
2025-02-24 16:31:23 +00:00
Roy Marples
4d224188b2 DHCP6: Fix dhcpcd vendor class option 2025-02-24 10:16:39 +00:00
Roy Marples
c5c74d5613 Release dhcpcd-10.2.1 v10.2.1 2025-02-23 20:38:43 +00:00
Roy Marples
e143ee18f4 Welcome to 2025. 2025-02-23 20:37:52 +00:00
Roy Marples
572c3e1a58 Add nosyslog
Fixes #472.
2025-02-23 20:23:45 +00:00
Roy Marples
3425b8f762 Remove accidently added debug 2025-02-23 16:37:41 +00:00
Colin McInnes
0a38e02a89
Only drop IPv4 LL addresses if configured to handle them (#464) 2025-02-22 13:37:59 +00:00
Roy Marples
e7f90918a1 route lifetime behaviour should mirror other lifetimes
Each lifetime has a an aquistion time so we can compare to
now to know how much of the lifetime is left.
Apply the difference when adding/changing the route just as we
do for addresses.

This allow us to work out better when we need to update the
route lifetime from a newer aquisition.

Fixes #465.
2025-02-22 13:21:17 +00:00
Roy Marples
ef74ffdaff DHCP6: RENEW/REBIND if T1/T2 have passed at CONFIRM 2025-02-21 09:47:25 +00:00
Roy Marples
f7a6397be0 BSD: Loop when pulling routes into our buffer if no memory
We need to make two sysctls to pull the route table from the kernel.
The first one works out the size of the buffer required and the
second one populates it.
It's possible for more routes to be added between these two calls
causing the second call to fail with ENOMEM.
If this happens, just re-query the size needed and try again.

Fixes #466.
2025-02-20 13:41:34 +00:00
Roy Marples
b7105e1982 OpenBSD: fetching MTU works with privsep again 2025-02-19 17:49:20 +00:00
Roy Marples
f608e853a1 BSD: Fix netmask family and length for incoming route msgs
Netmask family and length are ignored by traditional
userland tools such as route and netstat and are assumed
to match the destination sockaddr.
This is fortunate because BSD kernels use a radix tree
to store routes which adjusts the netmask at the point
of insertion where this information is lost.
We can just sub in the values from the destination address.

This is currently true for all BSD kernels.
2025-02-18 09:48:19 +00:00
Roy Marples
ab2d7cdfa4 For route MTU comparison allow zero MTU to match interface MTU
Because some OS put the interface MTU into the route MTU if the
route does not define its own.
2025-02-17 15:01:45 +00:00
Roy Marples
b1a52d8d91 dhcpcd: Don't leak an interface on link overflow 2025-02-17 14:18:11 +00:00
Roy Marples
491cc3eebf
Fix building with different options
Fixes #458.

Add many build options to the NetBSD target
Set any warnings to be errors as NetBSD should build without
any warnings. DragonFly as well, but we don't have a target for that.
2025-02-13 11:05:10 +00:00
Roy Marples
4d583c4f41 Refuse to import-src without being configured 2025-02-12 18:48:35 +00:00
Roy Marples
8beb42b626 Release dhcpcd-10.2.0 v10.2.0 2025-02-12 15:40:59 +00:00
Martin-Éric RACINE
57054fe527
Update build.yml to fix BSD builds (#456) 2025-02-12 15:39:27 +00:00
Gilad Naaman
7e82f1c5eb
Increase max IPv4 clientid. (#442)
Remove arbitrary limit, raising to the maximum representable by uint8

Co-authored-by: Roy Marples <roy@marples.name>
2025-02-12 15:29:39 +00:00
Jon Franklin
01049027ca DHCP6: Apply SOL and INF MAX_RT to REPLY messages too. 2025-02-12 15:05:33 +00:00
Jon Franklin
1b840e0c23 DHCP6: Implement USE_MULTICAST 2025-02-12 12:46:50 +00:00
Jon Franklin
da364b33fd DHCP6: Align MAX_RC values with RFC 8415 2025-02-12 12:45:17 +00:00
Roy Marples
07a5fdd7d3 DHCP: Align the BPF buffer to sizeof(struct ip *)
This is for non privsep only and should fix Sparc64.
Fixes #430.
2025-02-12 12:02:53 +00:00
Roy Marples
eac7152ec0 DHCP: Fix crash when someone deletes our address
Fixes #455
2025-02-12 11:39:13 +00:00
Roy Marples
68deb69d0e DHCP: Remove a compile warning 2025-02-12 11:24:07 +00:00
Roy Marples
7c458d9926 illumos: always mark routes as static
Otherwise in.routed will delete the default route on OmniOS!
2025-02-12 10:51:26 +00:00
Roy Marples
cebeec0887 llumos: detect closefrom(3c) 2025-02-12 09:53:25 +00:00
Roy Marples
850f93bef3 DHCP: when ifa sees the bound address, always add it to state
This should fix dhcpcd sending the correct DHCP message type
when entering the RENEW or REBIND state.

Fixes #355.

Co-authored-by: Zikai Chen <chenzikai@google.com>
2025-02-09 16:19:49 +00:00
Roy Marples
846fb4a4d2 IPv6: Abort ND when roaming 2025-02-07 12:08:31 +00:00
Roy Marples
ff0b34168f DHCP6: Fix --rebind on the control socket to really rebind
Rather than start a REBIND and then change straight to CONFIRM.
Fixes #437.
2025-02-07 12:04:43 +00:00
Roy Marples
66fb5a777b BSD: Improve NEWADDR == IFF_UP handling
On BSD when an address is added, the interface is automatically
brought up.
We can detect this by RTM_NEWADDR, but that lacks the IFF_UP flag.
We really want to stay in sync with RTM messages for flags, but
here we need to check the interface for IFF_UP if we think it's
not there. Only set that.

This fixes NEWADDR announcements for state transitions when
the interface is currently down.
2025-02-07 11:47:01 +00:00
Colin McInnes
e1ce523597
Always send req for InfoRefreshTime option on Inform-Req (#446)
RFC8415 says client must always request Information Request refresh time
option 32.
Client has other logic for handling if server does not include this in
the reply.

Resolves #445.
2025-02-05 19:38:55 +00:00
Roy Marples
84f3264856 DHCP: shrink code a little 2025-02-05 18:04:00 +00:00
Roy Marples
6ea879d71f privsep: ASAN now works
On Linux at least, Fedora-41 tested.
`./configure --sanitize` sets it all up.
2025-02-05 18:01:34 +00:00
Colin McInnes
46822c2ef9
Update route if lifetime needs changing (#441)
Everything about IPv6 is lifetime, not expiry.
Only linux routes have an expiry.

OK, this is not consistent at all!
In the kernel RTA_EXPIRES is only set for IPv4 multicast routes
when emitting route changes and only read for IPv6 routes when
userland makes route changes.
We cannot set this for non IPv6 routes currently.

To make it worse, we set a UINT32 for IPv6 routes but read a
UINT64 for IPv4 multicast routes.

To make this even more totally bonkers, the expiry we set for
the IPv6 route can be read back via RTA_CACHEINE rta_expires
but we need to convert to divide it by hz. 

Now we can read kernel route lifetime correctly, we can compare this to what we think it should be when building the routing table (allowing for some deviation due to processing time) and update if needed.

Fixes #428.
2025-02-05 14:06:10 +00:00
Roy Marples
958505ef3e privsep: Exit cleanly when built for address sanitization on Linux 2025-02-05 13:35:49 +00:00
Stipe
58498b21bb
Fix using multiple enterprise IDs with vendclass (Option 124 DHCP / Option 16 DHCPv6)
Fixes #328
2025-01-18 11:46:20 +00:00
Roy Marples
7b94a2e6e0 IPv6: Use lifetime_left function to reduce code size
No functional change intended.
2025-01-15 20:30:24 +00:00
Roy Marples
1481407c6c BSD: FreeBSD allows RTA_IFP correctly.
Not that it allows the same IPv6 address on different interfaces
on the same network still, but that's a FreeBSD issue to fix later.

The last for #407
2025-01-15 19:06:52 +00:00
Roy Marples
5905fbd66d BSD: Note that to replicate prior we can't have a default route
Add a comment for #425
2025-01-15 18:52:25 +00:00
philomathic_life
6d4b19d6a2
revert e3c5de1 (#425) 2025-01-15 10:30:03 +00:00
Colin McInnes
7745034dda
Add route lifetime from Router Advertisement (#429)
Currently this is only for Linux and is fairly cosmetic as dhcpcd will
clean up expired routes itself as other OS's don't support route lifetimes.
2025-01-15 10:29:14 +00:00
Martin-Éric RACINE
25689325f8
Exit the timesyncd hook if not on systemd and not executable (#398) (#403)
Exit the timesyncd hook immediately if not running on a systemd host AND timesyncd is not executable.
2024-12-08 09:49:44 +00:00
Scott Shambarger
e9e4040000 linux: Allow the __NR_rt_sigprocmask syscall
Fixes recent glibc changes to getrandom() used by arc4random().
Fixes #421.
2024-12-07 16:37:28 +00:00
Roy Marples
75289ca542 IPv6: Discard NA packets with a zero length option
As per RFC 4861 4.6.

Fixes #415.
2024-12-07 10:25:44 +00:00
Billie Alsup
0f303ab474 DHCP: reduce buflen by 2 when creating a new RFC 3396 option
Fixes #418 and potential buffer overflow.
2024-12-07 07:42:38 +00:00
spoljak-ent
371c7c69bc
DHCPv6: Add support for sending Option 17 (VSIO) (#383)
* DHCP: Add support for sending DHCP option 125 and DHCPv6 Option 17 (VSIO)

Note wireshark doesn't decode option 125 correctly when the it needs to be split into more options if it exceeds 255 bytes.
---------

Signed-off-by: Stipe Poljak (EXT) <stipe.poljak.ext@ericsson.com>
Co-authored-by: Roy Marples <roy@marples.name>
2024-11-07 13:15:49 +00:00