]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
4 months agoBSD: Fix compile on some BSD OS mtu
Roy Marples [Sun, 9 Mar 2025 16:11:38 +0000 (16:11 +0000)] 
BSD: Fix compile on some BSD OS

if_mtu is a macro in these headers which conflicts with our function

5 months agoRelease dhcpcd-10.2.2 v10.2.2
Roy Marples [Tue, 25 Feb 2025 12:37:57 +0000 (12:37 +0000)] 
Release dhcpcd-10.2.2

5 months agorelease: Default to gpg2 to avoid SHA1 signatures
Roy Marples [Tue, 25 Feb 2025 11:54:01 +0000 (11:54 +0000)] 
release: Default to gpg2 to avoid SHA1 signatures

Fixes #457

5 months agooptions: Allow interface block to be pattern matching
Roy Marples [Mon, 24 Feb 2025 16:31:23 +0000 (16:31 +0000)] 
options: Allow interface block to be pattern matching

Fixes #473

5 months agoDHCP6: Fix dhcpcd vendor class option
Roy Marples [Fri, 21 Feb 2025 22:48:42 +0000 (22:48 +0000)] 
DHCP6: Fix dhcpcd vendor class option

5 months agoRelease dhcpcd-10.2.1 v10.2.1
Roy Marples [Sun, 23 Feb 2025 20:38:43 +0000 (20:38 +0000)] 
Release dhcpcd-10.2.1

5 months agoWelcome to 2025.
Roy Marples [Sun, 23 Feb 2025 20:37:52 +0000 (20:37 +0000)] 
Welcome to 2025.

5 months agoAdd nosyslog
Roy Marples [Sun, 23 Feb 2025 20:23:45 +0000 (20:23 +0000)] 
Add nosyslog

Fixes #472.

5 months agoRemove accidently added debug
Roy Marples [Sun, 23 Feb 2025 16:37:41 +0000 (16:37 +0000)] 
Remove accidently added debug

5 months agoOnly drop IPv4 LL addresses if configured to handle them (#464)
Colin McInnes [Sat, 22 Feb 2025 13:37:59 +0000 (07:37 -0600)] 
Only drop IPv4 LL addresses if configured to handle them (#464)

5 months agoroute lifetime behaviour should mirror other lifetimes
Roy Marples [Sat, 22 Feb 2025 13:21:17 +0000 (13:21 +0000)] 
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.

5 months agoDHCP6: RENEW/REBIND if T1/T2 have passed at CONFIRM
Roy Marples [Fri, 21 Feb 2025 09:47:25 +0000 (09:47 +0000)] 
DHCP6: RENEW/REBIND if T1/T2 have passed at CONFIRM

5 months agoBSD: Loop when pulling routes into our buffer if no memory
Roy Marples [Thu, 20 Feb 2025 13:41:34 +0000 (13:41 +0000)] 
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.

5 months agoOpenBSD: fetching MTU works with privsep again
Roy Marples [Wed, 19 Feb 2025 17:49:20 +0000 (17:49 +0000)] 
OpenBSD: fetching MTU works with privsep again

5 months agoBSD: Fix netmask family and length for incoming route msgs
Roy Marples [Tue, 18 Feb 2025 09:48:19 +0000 (09:48 +0000)] 
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.

5 months agoFor route MTU comparison allow zero MTU to match interface MTU
Roy Marples [Mon, 17 Feb 2025 15:01:45 +0000 (15:01 +0000)] 
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.

5 months agodhcpcd: Don't leak an interface on link overflow
Roy Marples [Mon, 17 Feb 2025 14:18:11 +0000 (14:18 +0000)] 
dhcpcd: Don't leak an interface on link overflow

5 months agoFix building with different options
Roy Marples [Thu, 13 Feb 2025 11:05:10 +0000 (11:05 +0000)] 
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.

5 months agoRefuse to import-src without being configured
Roy Marples [Wed, 12 Feb 2025 18:48:35 +0000 (18:48 +0000)] 
Refuse to import-src without being configured

5 months agoRelease dhcpcd-10.2.0 v10.2.0
Roy Marples [Wed, 12 Feb 2025 15:31:36 +0000 (15:31 +0000)] 
Release dhcpcd-10.2.0

5 months agoUpdate build.yml to fix BSD builds (#456)
Martin-Éric RACINE [Wed, 12 Feb 2025 15:39:27 +0000 (17:39 +0200)] 
Update build.yml to fix BSD builds (#456)

5 months agoIncrease max IPv4 clientid. (#442)
Gilad Naaman [Wed, 12 Feb 2025 15:29:39 +0000 (17:29 +0200)] 
Increase max IPv4 clientid. (#442)

Remove arbitrary limit, raising to the maximum representable by uint8

Co-authored-by: Roy Marples <roy@marples.name>
5 months agoDHCP6: Apply SOL and INF MAX_RT to REPLY messages too.
Jon Franklin [Wed, 12 Feb 2025 15:05:33 +0000 (15:05 +0000)] 
DHCP6: Apply SOL and INF MAX_RT to REPLY messages too.

5 months agoDHCP6: Implement USE_MULTICAST
Jon Franklin [Wed, 12 Feb 2025 12:46:50 +0000 (12:46 +0000)] 
DHCP6: Implement USE_MULTICAST

5 months agoDHCP6: Align MAX_RC values with RFC 8415
Jon Franklin [Wed, 12 Feb 2025 12:45:17 +0000 (12:45 +0000)] 
DHCP6: Align MAX_RC values with RFC 8415

5 months agoDHCP: Align the BPF buffer to sizeof(struct ip *)
Roy Marples [Wed, 12 Feb 2025 12:02:53 +0000 (12:02 +0000)] 
DHCP: Align the BPF buffer to sizeof(struct ip *)

This is for non privsep only and should fix Sparc64.
Fixes #430.

5 months agoDHCP: Fix crash when someone deletes our address
Roy Marples [Wed, 5 Feb 2025 18:06:01 +0000 (18:06 +0000)] 
DHCP: Fix crash when someone deletes our address

Fixes #455

5 months agoDHCP: Remove a compile warning
Roy Marples [Wed, 12 Feb 2025 11:24:07 +0000 (11:24 +0000)] 
DHCP: Remove a compile warning

5 months agoillumos: always mark routes as static
Roy Marples [Wed, 12 Feb 2025 10:51:26 +0000 (10:51 +0000)] 
illumos: always mark routes as static

Otherwise in.routed will delete the default route on OmniOS!

5 months agollumos: detect closefrom(3c)
Roy Marples [Wed, 12 Feb 2025 09:53:25 +0000 (09:53 +0000)] 
llumos: detect closefrom(3c)

5 months agoDHCP: when ifa sees the bound address, always add it to state
Roy Marples [Wed, 16 Oct 2024 09:04:57 +0000 (10:04 +0100)] 
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>
5 months agoIPv6: Abort ND when roaming
Roy Marples [Fri, 7 Feb 2025 12:08:31 +0000 (12:08 +0000)] 
IPv6: Abort ND when roaming

5 months agoDHCP6: Fix --rebind on the control socket to really rebind
Roy Marples [Fri, 7 Feb 2025 12:04:43 +0000 (12:04 +0000)] 
DHCP6: Fix --rebind on the control socket to really rebind

Rather than start a REBIND and then change straight to CONFIRM.
Fixes #437.

5 months agoBSD: Improve NEWADDR == IFF_UP handling
Roy Marples [Fri, 7 Feb 2025 11:47:01 +0000 (11:47 +0000)] 
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.

5 months agoAlways send req for InfoRefreshTime option on Inform-Req (#446)
Colin McInnes [Wed, 5 Feb 2025 19:38:55 +0000 (13:38 -0600)] 
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.

5 months agoDHCP: shrink code a little
Roy Marples [Wed, 5 Feb 2025 18:04:00 +0000 (18:04 +0000)] 
DHCP: shrink code a little

5 months agoprivsep: ASAN now works
Roy Marples [Wed, 5 Feb 2025 18:01:34 +0000 (18:01 +0000)] 
privsep: ASAN now works

On Linux at least, Fedora-41 tested.
`./configure --sanitize` sets it all up.

5 months agoUpdate route if lifetime needs changing (#441)
Colin McInnes [Wed, 5 Feb 2025 14:06:10 +0000 (08:06 -0600)] 
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.

5 months agoprivsep: Exit cleanly when built for address sanitization on Linux
Roy Marples [Wed, 5 Feb 2025 13:35:49 +0000 (13:35 +0000)] 
privsep: Exit cleanly when built for address sanitization on Linux

6 months agoFix using multiple enterprise IDs with vendclass (Option 124 DHCP / Option 16 DHCPv6)
Stipe [Sat, 18 Jan 2025 11:46:20 +0000 (12:46 +0100)] 
Fix using multiple enterprise IDs with vendclass (Option 124 DHCP / Option 16 DHCPv6)

Fixes #328

6 months agoIPv6: Use lifetime_left function to reduce code size
Roy Marples [Wed, 15 Jan 2025 20:30:24 +0000 (20:30 +0000)] 
IPv6: Use lifetime_left function to reduce code size

No functional change intended.

6 months agoBSD: FreeBSD allows RTA_IFP correctly.
Roy Marples [Wed, 15 Jan 2025 19:06:52 +0000 (19:06 +0000)] 
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

6 months agoBSD: Note that to replicate prior we can't have a default route
Roy Marples [Wed, 15 Jan 2025 18:51:46 +0000 (18:51 +0000)] 
BSD: Note that to replicate prior we can't have a default route

Add a comment for #425

6 months agorevert e3c5de1 (#425)
philomathic_life [Wed, 15 Jan 2025 10:30:03 +0000 (10:30 +0000)] 
revert e3c5de1 (#425)

6 months agoAdd route lifetime from Router Advertisement (#429)
Colin McInnes [Wed, 15 Jan 2025 10:29:14 +0000 (04:29 -0600)] 
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.

7 months agoExit the timesyncd hook if not on systemd and not executable (#398) (#403)
Martin-Éric RACINE [Sun, 8 Dec 2024 09:49:44 +0000 (11:49 +0200)] 
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.

7 months agolinux: Allow the __NR_rt_sigprocmask syscall
Scott Shambarger [Sat, 7 Dec 2024 16:37:28 +0000 (16:37 +0000)] 
linux: Allow the __NR_rt_sigprocmask syscall

Fixes recent glibc changes to getrandom() used by arc4random().
Fixes #421.

7 months agoIPv6: Discard NA packets with a zero length option
Roy Marples [Sat, 7 Dec 2024 10:25:44 +0000 (10:25 +0000)] 
IPv6: Discard NA packets with a zero length option

As per RFC 4861 4.6.

Fixes #415.

7 months agoDHCP: reduce buflen by 2 when creating a new RFC 3396 option
Billie Alsup [Sat, 7 Dec 2024 07:42:38 +0000 (07:42 +0000)] 
DHCP: reduce buflen by 2 when creating a new RFC 3396 option

Fixes #418 and potential buffer overflow.

8 months agoDHCPv6: Add support for sending Option 17 (VSIO) (#383) 378/head
spoljak-ent [Thu, 7 Nov 2024 13:15:49 +0000 (14:15 +0100)] 
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>
8 months agologerr: use LOG_NDELAY for openlog
Roy Marples [Thu, 31 Oct 2024 10:40:46 +0000 (10:40 +0000)] 
logerr: use LOG_NDELAY for openlog

This ensures openlog gets a fd so logging of errors can occur
within privsep where no log was written before entering privsep.
Also ensures that closelog does not close -1 on some platforms
where no logging took place.

9 months agoIPv6: Avoid uninitialized ifp state when adding address (#395)
Ken Simon [Tue, 29 Oct 2024 23:11:54 +0000 (19:11 -0400)] 
IPv6: Avoid uninitialized ifp state when adding address (#395)

In certain instances, `ifp->if_data[IF_DATA_IPV6]` was not yet
initialized when ipv6_addaddr adds the address to the state, and a
segfault would ensue. Mitigate this by ensuring the state is initialized
when adding the addresses.

fixes #394

9 months agoDon't set RLIMIT_FSIZE when dumping lease (#389)
Colin McInnes [Tue, 29 Oct 2024 15:30:59 +0000 (09:30 -0600)] 
Don't set RLIMIT_FSIZE when dumping lease (#389)

Check if output is a tty
If dumping lease, check stdout otherwise check stderr.

---------

Co-authored-by: Roy Marples <roy@marples.name>
9 months agoDHCP6: lastlease behavior after Confirm non-response (#387)
Jon Franklin [Tue, 29 Oct 2024 07:53:51 +0000 (02:53 -0500)] 
DHCP6: lastlease behavior after Confirm non-response (#387)

If lastlease is enabled, and dhcpcd is unable to confirm its prior
lease, after timeout, bind the lease and move to the REBIND state.
Confine lastlease behavior to the CONFIRM and REBIND states.

Co-authored-by: Jon Franklin <jon_franklin@dell.com>
9 months agolinux: ignore source-based routes (#372)
Scott Shambarger [Tue, 29 Oct 2024 07:52:45 +0000 (00:52 -0700)] 
linux: ignore source-based routes (#372)

Since source-based routes aren't used by dhcpcd, it's best if they
are ignored so that they aren't confused with default routes.

9 months agoIPv6: Improve comments on prior global for default route change
Roy Marples [Mon, 14 Oct 2024 17:03:18 +0000 (18:03 +0100)] 
IPv6: Improve comments on prior global for default route change

9 months agoApply lastlease behavior to DHCPv6 (#384)
Jon Franklin [Mon, 14 Oct 2024 12:58:24 +0000 (07:58 -0500)] 
Apply lastlease behavior to DHCPv6 (#384)

If no response is received to Confirm messages, instead of failing, go
ahead and use the lease, as recommended by RFC 8415 18.2.3.

9 months agoIPv6: allow any global address for default route
Roy Marples [Mon, 14 Oct 2024 09:48:23 +0000 (10:48 +0100)] 
IPv6: allow any global address for default route

Regardless if we are a router or not.
BSD IPv6 source address selection does really matter for this.

This fixes FreeBSD systes where the forwarding sysctl is set
by the routing script which starts late in the day where
dhcpcd is already running and won't get the default route applied
until another RA comes in which could be a while.

9 months agoDHCP6: add preference as a defined option
Roy Marples [Fri, 11 Oct 2024 17:16:26 +0000 (18:16 +0100)] 
DHCP6: add preference as a defined option

9 months agoFix help text formatting (#379)
jvfranklin [Thu, 10 Oct 2024 13:52:49 +0000 (08:52 -0500)] 
Fix help text formatting (#379)

9 months agolinux: Support old kernels by not including linux/if.h
Roy Marples [Thu, 10 Oct 2024 13:19:46 +0000 (14:19 +0100)] 
linux: Support old kernels by not including linux/if.h

I wish the linux team used #defines rather than enums, but heh ho.
Ensure we can test IFF_LOWER_UP, IFF_DORMANT and IFA_FLAGS
based on nearest matching #defines available when the respective
feature was comitted.

Fixes #373.

9 months agohooks: Document if_configured
Roy Marples [Thu, 10 Oct 2024 10:59:04 +0000 (11:59 +0100)] 
hooks: Document if_configured

Fixes #353

9 months agodhcpcd: stdout output sometimes empty when redirected to a file (#364)
Diego Santa cruz [Thu, 10 Oct 2024 10:45:34 +0000 (12:45 +0200)] 
dhcpcd: stdout output sometimes empty when redirected to a file (#364)

Running dhpcd --dumplease with input from stdin and redirecting stdout
to a file outputs nothing to the output. The reason is that printf /
fprintf is used to write the output but it is not explicitly flushed
when done, or before exiting, and stdout to files is fully buffered by
default while stdout to terminals is line buffered by default.

This adds calls to fflush() at the end of dhcp_print_option_encoding()
and script_dump(), plus one just before exiting dhcpcd.

Signed-off-by: Diego Santa Cruz <diego.santacruz@spinetix.com>
9 months agoIPv6: Mark Route Information Routes as from RA 374/head
Roy Marples [Thu, 10 Oct 2024 10:10:11 +0000 (11:10 +0100)] 
IPv6: Mark Route Information Routes as from RA

9 months agoIPv6: Don't set IN6_IFF_TENTATIVE when the address exists
Roy Marples [Wed, 9 Oct 2024 10:19:56 +0000 (11:19 +0100)] 
IPv6: Don't set IN6_IFF_TENTATIVE when the address exists

We can only work it out when we know the address, not beforehand.

9 months agoDHCP6: Discard less preferred ADVERTISMENTs until IRT
Roy Marples [Tue, 8 Oct 2024 13:34:02 +0000 (14:34 +0100)] 
DHCP6: Discard less preferred ADVERTISMENTs until IRT

If we get a preference value of 255 then request immediately.
More RFC 8415 18.2.1 support, inspired by #376.

9 months agodhcp6: start request when advertise received after IRT (#376)
Scott Shambarger [Tue, 8 Oct 2024 13:26:04 +0000 (06:26 -0700)] 
dhcp6: start request when advertise received after IRT (#376)

After the initial solicit timeout, any received advertisements trigger
a request.  However, after the timeout, any advertisements will
never result in a request, and the client sends solicits forever.

This patch adds sends a request in response to an advertise if the
initial timeout has expired.

Cleanup: removes a check for an impossible state.

9 months agoBSD: Remove IPv6 sharing warning
Roy Marples [Mon, 7 Oct 2024 11:10:11 +0000 (12:10 +0100)] 
BSD: Remove IPv6 sharing warning

This doesn't seem to be needed for on recent FreeBSD and OpenBSD.

9 months agoRelease dhcpcd-10.1.0 v10.1.0
Roy Marples [Fri, 4 Oct 2024 21:22:24 +0000 (22:22 +0100)] 
Release dhcpcd-10.1.0

9 months agoFinal fix for prior
Roy Marples [Fri, 4 Oct 2024 16:35:09 +0000 (17:35 +0100)] 
Final fix for prior

9 months agoAnother fix for prior
Roy Marples [Fri, 4 Oct 2024 16:24:43 +0000 (16:24 +0000)] 
Another fix for prior

9 months agominor fix for prior
Roy Marples [Fri, 4 Oct 2024 16:11:26 +0000 (17:11 +0100)] 
minor fix for prior

9 months agodhcpcd: remove advertisement of addresses
Roy Marples [Fri, 4 Oct 2024 15:36:01 +0000 (15:36 +0000)] 
dhcpcd: remove advertisement of addresses

Address advertisemnt was used to allow IP address sharing to work.
It also required the DHCP server to allow the same IP for many
hosts, which modern DHCP servers deny you from doing.
Lastly, there are niggles with the implementation that are
impossible to fully fix due to how the various protocols work,
especially ARP.

All platforms dhcpcd supports allow better ways of doing this,
such as bonding (Linux), trunk(4) (OpenBSD), lagg(4) (Other BSDs).

ARP advertisements will only be made when addresses are added
OR defended against for kernels without RFC 5227 support.

9 months agoDHCP: Fix checksum validation
Roy Marples [Wed, 2 Oct 2024 06:49:36 +0000 (07:49 +0100)] 
DHCP: Fix checksum validation

in_cksum falls over with struct ip in a union of uint16_t with
some compilers.

The fix is to create a smaller pseudo header, fill in the bits
we need and then copy this to a uint8_t array which we then
send to in_cksum.

Tested on Debian-12 with clang-15 and CFLAGS=-Os

While here, just check that the UDP checksum check is zero
rather than zeroing it out and checking it matches.

Co-authored-by: Zikai Chen <chenzikai@google.com>
9 months agolinux: Only include linux/if.h if libc does not define IFF_DORMANT
Roy Marples [Tue, 1 Oct 2024 09:05:32 +0000 (10:05 +0100)] 
linux: Only include linux/if.h if libc does not define IFF_DORMANT

Hopefully fixes #373.

9 months agoImprove formatting of error
Roy Marples [Sat, 4 May 2024 14:03:00 +0000 (15:03 +0100)] 
Improve formatting of error

10 months agoInclude frame header in buffer length (#371)
acst1223 [Thu, 26 Sep 2024 07:56:28 +0000 (16:56 +0900)] 
Include frame header in buffer length (#371)

Since we are capturing packets at L2 we should not be using ETH_DATA_LEN
but ETH_FRAME_LEN to include also dst/src MAC and EtherType.

Co-authored-by: Andrzej Ostruszka <amo@semihalf.com>
10 months agoIPv6: DNSSL is an array of domains
Roy Marples [Mon, 23 Sep 2024 14:34:15 +0000 (14:34 +0000)] 
IPv6: DNSSL is an array of domains

As per RFC 8106 section 5.2.
Fixes #367

Thanks to Scott Shambarger.

10 months agoDHCP: Fix deleting expired leased addresses
Roy Marples [Wed, 11 Sep 2024 10:47:22 +0000 (11:47 +0100)] 
DHCP: Fix deleting expired leased addresses

10 months agoIPv6: Only advertise addresses when needed
Roy Marples [Wed, 11 Sep 2024 09:28:58 +0000 (10:28 +0100)] 
IPv6: Only advertise addresses when needed

Remember when we have advertised an address.
If we want to advertise it again, check this first.
If we still want to advertise it, clear this flag for all other
matching addresses.
Clear advertised flags from all addresses on carrier up.

This reduces needless NA spam from dhcpcd when the IPv6 Router
is needlessly chatty with RA.

10 months agoDHCP6: Fix INFO_REFRESH_TIME option
Roy Marples [Thu, 5 Sep 2024 13:22:53 +0000 (14:22 +0100)] 
DHCP6: Fix INFO_REFRESH_TIME option

Fixes #329 thanks to jvfranklin.

10 months agodhcp: get_option_uint* only accept options with correct len (#357)
taoyl-g [Thu, 5 Sep 2024 13:14:25 +0000 (22:14 +0900)] 
dhcp: get_option_uint* only accept options with correct len (#357)

RFC8925 mentions "The client MUST ignore the IPv6-Only Preferred option
if the length field value is not 4."

10 months agoIPv6: Return errors from ip6_forwarding
Roy Marples [Wed, 4 Sep 2024 11:18:10 +0000 (12:18 +0100)] 
IPv6: Return errors from ip6_forwarding

On all OS 0 is disabled and >0 is enabled.
So return -1 on any error which is returned to the main process so
we could log a diagnostic in the future.

While where allow privsep to actually get the sysctl for Capsicum.

10 months agoIPv6ND: Don't warn about no global addresses for default route
Roy Marples [Wed, 4 Sep 2024 10:48:46 +0000 (11:48 +0100)] 
IPv6ND: Don't warn about no global addresses for default route

If we are not installing a default route.

10 months agoprivsep: Capsicum needs root to access ipv6 forwarding sysctl
Roy Marples [Tue, 3 Sep 2024 08:37:47 +0000 (09:37 +0100)] 
privsep: Capsicum needs root to access ipv6 forwarding sysctl

Optimise the flow so that if we do have a global address on the
source interface we avoid the sysctl via the privileged process.

Generally the only time we don't is when we de-configure an
interface or we are configuring an interface where there is
no autoconf prefix from the RA and the only globals come
from a DHCPv6 Prefix Delegation to other interfaces which
requires us to be a router.

10 months agoIPv6: Ignore loopback address for any global consideration
Roy Marples [Sun, 1 Sep 2024 15:42:29 +0000 (16:42 +0100)] 
IPv6: Ignore loopback address for any global consideration

11 months agoDHCP6: IPV6_AF_DELEGATEDPFX -> IPV6_AF_PFXDELEGATION
Roy Marples [Fri, 30 Aug 2024 14:09:17 +0000 (15:09 +0100)] 
DHCP6: IPV6_AF_DELEGATEDPFX -> IPV6_AF_PFXDELEGATION

This is easier to see the difference with IPV6_AF_DELEGAGTED.

11 months agoDHCP6: Mark everything excpept delegated addresses as stale
Roy Marples [Fri, 30 Aug 2024 08:37:36 +0000 (09:37 +0100)] 
DHCP6: Mark everything excpept delegated addresses as stale

When parsing a lease.
A Prefix Delegation is part of a lease and should follow the same
rules for being stale as an address.

11 months agoDHCP6: Fix Prefix Delegation pltime and vltime
Roy Marples [Thu, 29 Aug 2024 10:13:41 +0000 (11:13 +0100)] 
DHCP6: Fix Prefix Delegation pltime and vltime

While here fix deleting non exteneded deprecated addresses

11 months agoIPv6: Add the added address to state
Roy Marples [Wed, 28 Aug 2024 18:04:53 +0000 (19:04 +0100)] 
IPv6: Add the added address to state

We used to rely on route(4) adding it to state based on RTM_NEWADDR
but the message could get lost if the socket overflows.
Work around this by always adding the address to the state.

11 months agoRelease dhcpcd-10.0.10 v10.0.10
Roy Marples [Wed, 21 Aug 2024 15:04:53 +0000 (16:04 +0100)] 
Release dhcpcd-10.0.10

11 months agoRevert d49db34 and add a comment as to why it's needed.
Roy Marples [Wed, 21 Aug 2024 15:02:27 +0000 (16:02 +0100)] 
Revert d49db34 and add a comment as to why it's needed.

Fixes #352

11 months agoRelease dhcpcd-10.0.9 v10.0.9
Roy Marples [Wed, 21 Aug 2024 10:51:59 +0000 (11:51 +0100)] 
Release dhcpcd-10.0.9

11 months agoWell, changes were made in 2024!
Roy Marples [Wed, 21 Aug 2024 10:51:24 +0000 (11:51 +0100)] 
Well, changes were made in 2024!

11 months agolinux: make if_getnetworknamespace static
Roy Marples [Wed, 21 Aug 2024 10:30:51 +0000 (11:30 +0100)] 
linux: make if_getnetworknamespace static

11 months agoUpdate privsep-linux.c to allow statx (#349)
Jabrwock [Wed, 21 Aug 2024 10:38:58 +0000 (04:38 -0600)] 
Update privsep-linux.c to allow statx (#349)

Add statx to SECCOMP_ALLOW

11 months agoDHCP6: Remove the dhcp6_pd_addr packed struct
Roy Marples [Thu, 1 Aug 2024 17:03:39 +0000 (18:03 +0100)] 
DHCP6: Remove the dhcp6_pd_addr packed struct

Some compilers just don't support this.
We need to manually copy this in and out.

Fixes #347.

11 months agoIPv4LL: Harden the noconfigure option.
Roy Marples [Thu, 1 Aug 2024 22:57:39 +0000 (23:57 +0100)] 
IPv4LL: Harden the noconfigure option.

This path should not be hit with the prior patch, but just in-case
harden the logic incase we don't have the address added.

11 months agoIPv4LL: If we are not configuring, abort if address does not exist
Roy Marples [Thu, 1 Aug 2024 16:06:51 +0000 (17:06 +0100)] 
IPv4LL: If we are not configuring, abort if address does not exist

Fixes a segfault as we would not add the address and we would
expect to find it.

12 months agoDHCP: No longer set interface mtu (#346)
Roy Marples [Mon, 29 Jul 2024 15:17:08 +0000 (16:17 +0100)] 
DHCP: No longer set interface mtu (#346)

We've been enforcing an interface MTU that is slightly larger
than the minimum for some time.
Instead, log an error than the MTU is smaller than the minimum
to send a BOOTP message.

The DHCP MTU is only used when adding routes as setting the
interface MTU can cause a PHY reset which is bad.

Fixes #345