Commit Graph

5538 Commits

Author SHA1 Message Date
Roy Marples
3c36bfc83d IPv6: Be explicit that lifetime zero means no longer a default router
Fixes #244
2023-10-04 13:38:44 +01:00
Roy Marples
500cd81362 options: introduce the uri option as opposed to a string
Currently we don't attempt to validate a uri given, aside from
not allowing any space characters within.

If the option is `array uri` then the first two bytes are the
length of the uri in network order and the rest is a uri element.
The uri's are space separated for the variable because space is not
allowed within the uri.

This allows us to implement RFC 8572, Secure Zero Touch Provisioning.
2023-10-04 13:08:20 +01:00
Roy Marples
0b9d882529 options: andsf6 is DHCPv6, not DHCP 2023-10-02 11:01:39 +01:00
Roy Marples
dc96a61d14 Cast a compile warning away 2023-10-02 10:54:36 +01:00
Tobias Heider
cd34035851
compat: use OpenSSL RAND_priv_bytes() for entropy (#248)
* compat: use OpenSSL RAND_priv_bytes() for entropy

Use OpenSSL random number generator to seed arc4random() if available,
if it fails fall back to /dev/urandom.

* tests: link eloop-bench against LDADD lib

arc4random might depend on libcrypto so we need to link it.
2023-09-29 08:57:41 +01:00
Christian Tomahogh
f2bc729e55
Send correct amount of used buffer for prefix exclude option (#250)
The payload of the prefix exclude option was correctly created
but the amount of bytes to send in the DHCPv6 request was
always set to 0 which resulted in an invalid prefix exclude option

This patch fixes this behavior by calculating the correct amount
of bytes to send.
2023-09-29 00:04:37 +01:00
Roy Marples
dcaf729bca Guard against handling many SIGTERM/SIGINT.
Privsep has a mini-eloop for reading data from other processes.
This mini-eloop processes signals as well so we can reap children.
During teardown we don't want to process SIGTERM or SIGINT again,
as that could trigger memory issues.

Hopefully fixes #247.
2023-09-25 10:34:12 +01:00
Petr Gotthard
8ac0147364
Use a local variable instead of the optind (#86)
The optind get overwritten by reload_config(), so the reconf_reboot()
used a wrong argument count.

Signed-off-by: Petr Gotthard <petr.gotthard@centrum.cz>
2023-09-25 10:00:27 +01:00
Tobias Heider
8e316164a8
Support libcrypto for hmac and sha256 (#223)
* compat: Add OpenSSL libcrypto compatibility layer

Detect libcrypto in configure script.  Only fall back
to using libcrypto when /usr libs are allowed and no
other compatible implementation is available or when
--with-openssl is passed explicitly.
Make sure libcrypto and libmd are never linked at the
same time.

Add OpenSSL based SHA256 and HMAC compat shims in
compat/crypt_openssl. Depeding on version and build flags,
libcrypto ships with a compatible SHA256 API in
"openssl/sha.h".  OpenSSL 3 has deprecated the SHA API,
so if it is not detected we fall back to an EVP_DIGEST
based version.
Because the API might still be in use in OpenSSL internally,
the compatibility wrappers have a dhcpcd_ prefix to avoid
symbol conflicts.

* Add sha256 tests based on the existing hmac-md5 tests.
2023-09-25 09:49:00 +01:00
Ido Rosen
e0923934fc
Fix some grammar in README.md 2023-09-11 22:16:26 -07:00
Ido Rosen
4a3be174e4 Clarify persistent wording to address confusion.
When persistent is not specified, dhcpcd de-configures the interface at exit.
However, the default dhcpcd.conf example provided enables the option.
See https://github.com/NetworkConfiguration/dhcpcd/discussions/140
2023-09-08 23:41:45 -07:00
Ido Rosen
9aece11fb7 Ignore VSCode .vscode and macOS .DS_Store files 2023-09-08 23:02:35 -07:00
Tobias Heider
837d09e34c
compat: update arc4random() to newer chacha20 based version from OpenBSD (#227)
* compat: update arc4random() to newer chacha20 based version from OpenBSD

* arc4random: keep fd after first call to arc4random

privsep + chroot doesn't allow us to reopen /dev/urandom in
an unpriviledged process so we open the fd once and then
hold onto it.
2023-09-04 14:53:44 +01:00
Tobias Heider
da3c493d2c
ci: execute tests after successful build (#243) 2023-09-04 14:53:10 +01:00
Roy Marples
1e1268d2de linux: fix wireless roaming
Fixes #228.
2023-08-22 15:12:21 +01:00
Roy Marples
e30adeb939 privsep: Fix a FD leak when processes exit
Add commentary to say they are closed on receipt of SIGCHLD.
2023-08-22 12:59:23 +00:00
Tobias Heider
1bd8fc7d4b
privsep: fix strlcpy overflow in psp_ifname (#239)
When running our Ubuntu tests with libc6 and strlcpy overflow checks
enabled we found that the wrong size is passed to strlcpy resulting
in a crash because of an overflow.
2023-08-15 17:06:48 +01:00
Tobias Heider
f798bf23af
dhcpcd: Fix off-by-one overflow when read() writes full BUFSIZ (#236) 2023-08-12 20:59:21 +01:00
Tobias Heider
df3e2a1642
Add CI builds for Ubuntu, OpenBSD, FreeBSD and NetBSD (#229) 2023-08-04 18:00:26 +01:00
Petr Menšík
b7b7b656f8
Do not crash on dhcpcd test run (#231)
Check if state->bpf is allocated before attempting to write there.
2023-08-04 17:45:25 +01:00
Roy Marples
43c4b1b572 Fix --enable-secomp 2023-07-20 10:48:37 +01:00
Roy Marples
8b65e2d6c7 privsep: Allow diabling of SECCOMP on Linux
This allows a POSIX resource limited sandbox to be used at least
with privilege separation, which is better than just disabling
privilege separation entirely for when SECCOMP stops working due to
libc/kernel changes.
2023-07-20 10:33:51 +01:00
Roy Marples
d2fbde99cf Release dhcpcd-10.0.2 2023-07-19 14:34:04 +01:00
Roy Marples
4523393a82 Fix compile warning with rb.c sync 2023-07-19 13:46:08 +01:00
Tobias Heider
ca67bd26f5
compat sync (#226)
* compat: sync pidfile.c with netbsd v1.16

- fix typos in word "otherwise".
- s/sucess/success/ in comment.

* compat: sync rb.c with netbsd v1.16

- fix typos in word "successfully", mainly s/succesfully/successfully/.
- toolify

* compat: sync strlcpy.c with openbsd v1.16

- I am retiring my old email address;  replace it with my OpenBSD one.

* compat: sync arc4random_uniform.c with openbsd v1.3
2023-07-19 13:29:48 +01:00
Roy Marples
4f5c4999b6 linux: consider IFF_LOWER_UP and !IFF_DORMANT for LINK_UP 2023-07-19 13:23:09 +01:00
Roy Marples
13cce2c82e privsep: Send only what we have put in the buffer to script env
Rather then sending the whole buffer size.
If there is an error writing the last option, it may not be
NUL terminated correctly causing an assert.
Even so, we should not write the failed option to the environment
either as it would be a false positive for an empty option.
2023-07-19 12:42:49 +01:00
Roy Marples
b1c6074e43 common: Allow hwaddr_ntoa to print an empty string
This fixes #218 where we get a zero hardware address length in
an ARP packet or a length that overflows the string buffer.
2023-07-04 08:58:13 +01:00
Roy Marples
3d956701c4 common: Improve valid_domain and check correct return
Improvement for #218.
2023-07-03 12:52:19 +01:00
Roy Marples
327e19a5cc privsep: Only unlink control sockets if we created them
Fixes a segfault when trying to start dhcpcd as a non root user.
Closes #219 without an explicit test for being the root user.
2023-07-02 01:28:34 +01:00
Xea
f7035a2f3f
risc-v fix vendor error (#213)
* added mproc for risc-v

* make mproc arches alphabetically sorted again
2023-06-19 17:20:29 +01:00
Rob Gill
8c81ac3bef
Additional DHCP options (#214)
DDoS Open Threat Signaling (DOTS) Agent Discovery, RFC8973
DHCP option 147,147; DHCPv6 option 141,142

Captive Portal, RFC8910
DHCP option 114; DHCVv6 option 104

update to attribution for MUD URL - RFC8520

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2023-06-19 17:19:21 +01:00
Roy Marples
f77c5f131b privsep: Check if we have a root process before sending it stuff
Fixes #210
2023-06-19 17:04:03 +01:00
Roy Marples
45e441ada6 Linux: Improve learning IPv6 address flags
Rather than matching addresses during netlink message processing,
extract the local, address and flag parts.
Once done, then match local and address to the address we are
looking for and if equal apply the flags.

Fixes #201 and maybe #149.
2023-05-23 22:14:57 +01:00
frazar
6a369c6d7b
chore: Link to GitHub for the commit log and release announcements (#203)
Fixes one of the two rotten links reported in #202
2023-05-18 22:09:53 +01:00
Roy Marples
dccebe204f Linux: fix disabling of kernel RA autoconf
Well, that was a big whups leaving it turned on.
Thanks to Klaus Frank for the spot.
Fixes #176.
2023-05-18 12:27:10 +01:00
Roy Marples
1d19d4963f chore: Fix generation of dependency file 2023-05-18 12:15:49 +01:00
Roy Marples
838770a130 build: Remove suffix prerequisite rules
Just to silence GNU make.
This makes development slightly harder on BSDs, just have to
do a `make clean` when changing configuration options.

Fixes #197.
2023-05-18 11:40:55 +01:00
Roy Marples
b6a207dc6d chore: Document building a bit more
And the fact that configure is not GNU.
2023-05-18 11:40:19 +01:00
Roy Marples
a33c227105 options: Allow waitip to take space separated address families
This is easier than writing confusing documentation to clarify.
Fixes #206.
2023-05-18 10:41:56 +01:00
Roy Marples
521afc2296 dhcpcd: Fix waitip address family
Minor fix for #206.
2023-05-17 17:52:33 +01:00
Roy Marples
4a1d2dcded dhcpcd: support HANGUP of stderr cb 2023-05-17 17:39:27 +01:00
Roy Marples
567bd8cbf6 control: Ingore control not connected errors too
For FreeBSD.
Another one for #205.
2023-05-17 10:52:23 +01:00
Roy Marples
536115a002 control: ignore EPIPE errors on write
Other end has shutdown.
2023-05-17 09:45:34 +00:00
Roy Marples
41084f3462 control: deal with hangup better
Maybe fix #205
2023-05-17 03:08:45 +01:00
Roy Marples
8b29c0ddf0 privsep: Allow zero length messages through
They should be handled gracefully without privsep anyway.
Fix for #179.
2023-05-16 17:18:07 +01:00
Roy Marples
b9ac3021af DHCP: Don't enforce the message came port 67
RFC2131 and updates make no mention of what the source port
should or must be.

Update for #179.
2023-05-08 15:54:31 +01:00
J. Hannken-Illjes
681866a728 BSD: Fix non INET6 builds 2023-04-27 12:43:33 +01:00
Roy Marples
008121afd0 OpenBSD: Ensure if_afreq is correct initialised. 2023-04-26 14:29:46 +01:00
Roy Marples
27c0b01164 BSD: When we get RTM_NEWADDR the interface must have IFF_UP.
This is apparently historic behaviour.
It's not always mirrored in RTM_IFINFO either so we need to
replicate the behaviour if we had got it earlier.

This fixes dhcpcd requiring at least something to set the interface
up before starting on OpenBSD.
Other BSD are less impacted because it's a lot harder to get into
this state as we have more control over setting the IPv6 LL address.
2023-04-26 14:15:07 +01:00