]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
27 hours agoFix eloop better control 680/head
Roy Marples [Wed, 15 Jul 2026 15:59:24 +0000 (16:59 +0100)] 
Fix eloop better

28 hours agoApple: remove compile warnings
Roy Marples [Wed, 15 Jul 2026 15:25:13 +0000 (16:25 +0100)] 
Apple: remove compile warnings

28 hours agoeloop: fix a compile issue on Dragonfly while here
Roy Marples [Wed, 15 Jul 2026 15:06:48 +0000 (16:06 +0100)] 
eloop: fix a compile issue on Dragonfly while here

29 hours agoFix compat
Roy Marples [Wed, 15 Jul 2026 14:00:01 +0000 (15:00 +0100)] 
Fix compat

30 hours agoFix compile
Roy Marples [Wed, 15 Jul 2026 13:56:32 +0000 (14:56 +0100)] 
Fix compile

30 hours agocompat: add getpeereid.c and move compat out of control.c
Roy Marples [Wed, 15 Jul 2026 13:47:08 +0000 (14:47 +0100)] 
compat: add getpeereid.c and move compat out of control.c

44 hours agoFix compile on IllumOS
Roy Marples [Tue, 14 Jul 2026 23:02:51 +0000 (00:02 +0100)] 
Fix compile on IllumOS

2 days agoFormat
Roy Marples [Tue, 14 Jul 2026 14:37:19 +0000 (15:37 +0100)] 
Format

2 days agorecvmsg WAITALL
Roy Marples [Tue, 14 Jul 2026 14:35:33 +0000 (15:35 +0100)] 
recvmsg WAITALL

2 days agoBound the data length
Roy Marples [Tue, 14 Jul 2026 14:25:08 +0000 (15:25 +0100)] 
Bound the data length

2 days agoFix the control socket for dhcpcd-ui
Roy Marples [Tue, 14 Jul 2026 14:01:47 +0000 (15:01 +0100)] 
Fix the control socket for dhcpcd-ui

Add --isprivileged to return either true or false so the
caller can work this out as we now just have the one socket.
Bump version for this.

11 days agoAdd compat for Ilumos
Roy Marples [Sun, 5 Jul 2026 15:05:25 +0000 (16:05 +0100)] 
Add compat for Ilumos

11 days agoFix compile on Linux
Roy Marples [Sun, 5 Jul 2026 15:01:13 +0000 (16:01 +0100)] 
Fix compile on Linux

11 days agocontrol: remove unprivileged socket
Roy Marples [Sun, 5 Jul 2026 14:15:57 +0000 (15:15 +0100)] 
control: remove unprivileged socket

Instead workout credentials from the connected socket
by getpeereid(2).
Remove the limit of only one connected control client.

This needs some testing and is only expected to compile on the BSDs
right now.

2 weeks agoBuild all the targets on macos master
Roy Marples [Tue, 30 Jun 2026 12:29:28 +0000 (13:29 +0100)] 
Build all the targets on macos

* Build all the targets on macos

2 weeks agooptions: Introduce policy groups
Roy Marples [Mon, 29 Jun 2026 21:41:39 +0000 (22:41 +0100)] 
options: Introduce policy groups

Remove the old bitmask array which we used to store which
options to request, remove, require, etc and replace with a
more generic policy group.

The policy group structure holds an array of option numbers
in each list - request, remove, require, etc.
Add a suite of helper functions around this to allow adding,
removing, checking, walking, etc.

This allows a much easier use of this in DHCP processing but more
importantly allows us to remove or reject options we do not
have a definition for.

2 weeks agoprivsep: Fix compile without INET
Roy Marples [Fri, 26 Jun 2026 13:43:25 +0000 (14:43 +0100)] 
privsep: Fix compile without INET

3 weeks agodhcp: add configurable backoff parameters for DHCPv4 (#593)
Chris Patterson [Tue, 23 Jun 2026 19:30:57 +0000 (15:30 -0400)] 
dhcp: add configurable backoff parameters for DHCPv4 (#593)

In cloud and virtual environments the DHCP service is typically
ready within hundreds of milliseconds of the interface coming up,
and once ready, responds within single-digit milliseconds.  The
RFC 2131 defaults (4s initial interval, 64s backoff cap) are
designed for congested broadcast networks and are unnecessarily
conservative in this context.

Add three new configuration options to tune DHCPv4 retransmission:

  initial_interval  - initial retransmission interval (default 4s)
  backoff_cutoff    - exponential backoff cap (default 64s)
  backoff_jitter    - random jitter per retry (default ±1000ms)

Defaults match RFC 2131 so existing behaviour is unchanged.
Option naming aligns with dhclient (initial-interval, backoff-cutoff).
Minimum of 1 is enforced at parse time for interval and cutoff;
invalid values are logged and the default is used.

These options are DHCPv4-only; DHCPv6 retransmission follows
RFC 8415 constants and is not user-configurable.

Closes #406

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
3 weeks agoIPv4: uset old_ia when adding an address causes early removal
Roy Marples [Tue, 23 Jun 2026 13:06:47 +0000 (14:06 +0100)] 
IPv4: uset old_ia when adding an address causes early removal

This is true for NOALIAS configurations or Linux.

Reported by NVIDIA Project Vanessa

3 weeks agoDHCPv6: When deprecating addresses, restart on prefix deletions
Roy Marples [Tue, 23 Jun 2026 01:17:10 +0000 (02:17 +0100)] 
DHCPv6: When deprecating addresses, restart on prefix deletions

As that might invalidate the next address to iterate on.

Reported-by: CuB3y0nd <root@cubeyond.net>
3 weeks agoDHCPv6: Prefix exclude option can be 17 octets (#671)
Roy Marples [Tue, 23 Jun 2026 01:06:55 +0000 (02:06 +0100)] 
DHCPv6: Prefix exclude option can be 17 octets (#671)

Well that's a simple off by one error

Reported-by: CuB3y0nd <root@cubeyond.net>
3 weeks agoIPv6ND: Free routeinfo when it expires (#670)
Roy Marples [Mon, 22 Jun 2026 23:34:58 +0000 (00:34 +0100)] 
IPv6ND: Free routeinfo when it expires (#670)

Reported-by: CuB3y0nd <root@cubeyond.net>
3 weeks agocontrol: Avoid hangup in the recvdata path
Roy Marples [Mon, 22 Jun 2026 22:41:53 +0000 (23:41 +0100)] 
control: Avoid hangup in the recvdata path

Instead return an error and bubble it up where it can be
hangup / freed more cleanly.

Reported-by: CuB3y0nd <root@cubeyond.net>
3 weeks agoscript: Fix buffer over and under flows in script_buftoenv
Roy Marples [Mon, 22 Jun 2026 20:14:11 +0000 (21:14 +0100)] 
script: Fix buffer over and under flows in script_buftoenv

Enforce we have a buffer and it is terminated.
Rework code so that we no longer assert.

Reported by NVIDIA Project Vanessa

3 weeks agocapsicum: Avoid some overflow issues in privsep sysctl
Roy Marples [Mon, 22 Jun 2026 19:56:18 +0000 (20:56 +0100)] 
capsicum: Avoid some overflow issues in privsep sysctl

Limit olen to SIZE_MAX - sizeof(olen).

Ensure our buffer holds is big enough for olen AND newlen
AND is zeroed out as the following sysctl call might return
less data.

Reported by NVIDIA Project Vanessa

3 weeks agoIPv6: Fix numerous issues extending temporary address times
Roy Marples [Mon, 22 Jun 2026 18:25:48 +0000 (19:25 +0100)] 
IPv6: Fix numerous issues extending temporary address times

Fix a potential integer underflow if pltime is less than
aquisition time.
Fix potential time truncation to uint32_t.

Reported by NVIDIA Project Vanessa

3 weeks agoDHCP6: Fix configuring the suffix to delegated prefixes (#665)
Roy Marples [Mon, 22 Jun 2026 17:06:35 +0000 (18:06 +0100)] 
DHCP6: Fix configuring the suffix to delegated prefixes (#665)

Depending on the delegated prefix length and the user
configured suffix length, some parts of the suffix would be lost.

Reported by NVIDIA Project Vanessa

3 weeks agovsio: Allow zero length options
Roy Marples [Mon, 22 Jun 2026 15:24:10 +0000 (16:24 +0100)] 
vsio: Allow zero length options

The spec allows it and this is an oversight.

3 weeks agoeloop: Fix compile warning where UTIME_MAX is a calculation
Roy Marples [Mon, 22 Jun 2026 14:47:22 +0000 (15:47 +0100)] 
eloop: Fix compile warning where UTIME_MAX is a calculation

And does not have correct parenthesis

3 weeks agoworkflows: limit to read only
Roy Marples [Mon, 22 Jun 2026 14:20:06 +0000 (15:20 +0100)] 
workflows: limit to read only

3 weeks agoeloop: Improve timespecdiff
Roy Marples [Mon, 22 Jun 2026 14:15:41 +0000 (15:15 +0100)] 
eloop: Improve timespecdiff

Avoid signed integer overflow.
Fix a potential wrap around issue on 32-bit platforms.
Correctly use nanoseconds when adding a timespec timeout.

Reported by NVIDIA Project Vanessa

3 weeks agoconfigure: Don't define _BSD_SOURCE for explicit_zero()
Roy Marples [Mon, 22 Jun 2026 10:21:17 +0000 (11:21 +0100)] 
configure: Don't define _BSD_SOURCE for explicit_zero()

As newer glibc complains it should no longer be used.
Sigh.
Luckily _GNU_SOURCE still works and newer muscl works with that.

3 weeks agoipv6: Only regen temp addrs with sufficent pltime
Roy Marples [Mon, 22 Jun 2026 09:19:31 +0000 (10:19 +0100)] 
ipv6: Only regen temp addrs with sufficent pltime

If pltime is smaller then REGEN_ADVANCE then the address
would be regnerated way after pltime and vltime expired.

Reported by NVIDIA Project Vanessa

3 weeks agohooks: don't read past truncated ip6 address starting fe
Roy Marples [Mon, 22 Jun 2026 08:40:13 +0000 (09:40 +0100)] 
hooks: don't read past truncated ip6 address starting fe

We want to append the interface name to link-local addresses.
But we might get a truncated address as well and an attacker
could just supply the fe part. In this case, ensure we have
enough of the address to read the next byte otherwise don't
append the interface name.

Reported by NVIDIA Project Vanessa

3 weeks agoauth: Ensure remaining dlen matches hash digest length
Roy Marples [Sun, 21 Jun 2026 22:00:02 +0000 (23:00 +0100)] 
auth: Ensure remaining dlen matches hash digest length

It's invalid otherwise.

Reported by NVIDIA Project Vanessa

3 weeks agoauth: clear keys with memset_explicit
Roy Marples [Sun, 21 Jun 2026 15:40:51 +0000 (16:40 +0100)] 
auth: clear keys with memset_explicit

Supply compat/memset_explicit for platforms which lack it.
Adpat compat/arc4random.c for it.

Reported by NVIDIA Project Vanessa

3 weeks agoprivsep: Check data is terminated when a string
Roy Marples [Sun, 21 Jun 2026 12:29:41 +0000 (13:29 +0100)] 
privsep: Check data is terminated when a string

Reported by NVIDIA Project Vanessa

3 weeks agoARP: Iterate over states safely as the cb could remove ours
Roy Marples [Sun, 21 Jun 2026 11:15:37 +0000 (12:15 +0100)] 
ARP: Iterate over states safely as the cb could remove ours

Reported by NVIDIA Project Vanessa

3 weeks agoDHCP: Sanitise messages from servers for output
Roy Marples [Sun, 21 Jun 2026 10:13:53 +0000 (11:13 +0100)] 
DHCP: Sanitise messages from servers for output

They could contain anything!

Reported by NVIDIA Project Vanessa

3 weeks agoFix CI build
Roy Marples [Sat, 20 Jun 2026 22:25:23 +0000 (23:25 +0100)] 
Fix CI build

3 weeks agoudev: Ensure we have a subsystem, action and ifname
Roy Marples [Sat, 20 Jun 2026 22:00:57 +0000 (23:00 +0100)] 
udev: Ensure we have a subsystem, action and ifname

As udev could return NULL for them.

Reported by NVIDIA Project Vanessa

3 weeks agohooks: Quote assignment of compat vars correctly
Roy Marples [Sat, 20 Jun 2026 21:33:32 +0000 (22:33 +0100)] 
hooks: Quote assignment of compat vars correctly

Reported by NVIDIA Project Vanessa

3 weeks agoARP: check we have enough to read the frame header
Roy Marples [Sat, 20 Jun 2026 20:57:45 +0000 (21:57 +0100)] 
ARP: check we have enough to read the frame header

Reported by NVIDIA Project Vanessa

3 weeks agoND: Enforce require and reject policy
Roy Marples [Sat, 20 Jun 2026 20:31:15 +0000 (21:31 +0100)] 
ND: Enforce require and reject policy

Reported by NVIDIA Project Vanessa

3 weeks agoDHCP6: Ensure IA_PD Prefix Length is valid
Roy Marples [Sat, 20 Jun 2026 17:14:30 +0000 (18:14 +0100)] 
DHCP6: Ensure IA_PD Prefix Length is valid

Reported by NVIDIA Project Vanessa

3 weeks agoND6: fix OOB reject mask for an undefined option
Roy Marples [Sat, 20 Jun 2026 16:39:45 +0000 (17:39 +0100)] 
ND6: fix OOB reject mask for an undefined option

Reported by NVIDIA Project Vanessa

3 weeks agooptions: Fix userclass boundary
Roy Marples [Sat, 20 Jun 2026 13:14:43 +0000 (14:14 +0100)] 
options: Fix userclass boundary

Reported by NVIDIA Project Vanessa

3 weeks agolinux: Ensure NLA data boundaries are valid
Roy Marples [Sat, 20 Jun 2026 11:16:51 +0000 (12:16 +0100)] 
linux: Ensure NLA data boundaries are valid

Reported by NVIDIA Project Vanessa

3 weeks agoprivsep: ps_root_readfile should return the real file size
Roy Marples [Sat, 20 Jun 2026 08:49:44 +0000 (09:49 +0100)] 
privsep: ps_root_readfile should return the real file size

readfile NUL terminates the buffer to make things easy.
We need to transmit this over IPC just ensure the receiver has
a big enough buffer, again to make things easy.
So on success, we need to trim the NUL from the returned length
so the actual file size is accurate.

3 weeks agotimezone: disallow directory traversal
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

3 weeks 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.

4 weeks 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.

4 weeks 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>
4 weeks 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.

4 weeks 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 ....

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

5 weeks 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.

5 weeks 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...

5 weeks 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

5 weeks 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

5 weeks 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

5 weeks 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

5 weeks 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.

5 weeks 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!

5 weeks 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

5 weeks 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

5 weeks 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

5 weeks 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

5 weeks 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.

5 weeks 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

5 weeks 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.

6 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

6 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.

6 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.

6 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.

6 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

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

6 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

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

6 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.

7 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.

7 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

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

7 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()

7 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.

8 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.

8 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.

8 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

8 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.

8 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

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

8 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.

8 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()

8 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.

8 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

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

2 months 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.

2 months 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

2 months 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

2 months 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.