]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
5 years agoARP: gc stale function arp_cancel
Roy Marples [Fri, 5 Jun 2020 13:52:35 +0000 (14:52 +0100)] 
ARP: gc stale function arp_cancel

5 years agoBSD: In privsep with no GIFALIAS support? getifaddrs over privsep
Roy Marples [Fri, 5 Jun 2020 13:39:06 +0000 (14:39 +0100)] 
BSD: In privsep with no GIFALIAS support? getifaddrs over privsep

This makes the heavy weight call even more heavy weight :(

5 years agoLinux: more freeifaddrs
Roy Marples [Fri, 5 Jun 2020 13:28:27 +0000 (14:28 +0100)] 
Linux: more freeifaddrs

5 years agoprivsep: Only use freeifaddrs if not using privsep
Roy Marples [Fri, 5 Jun 2020 13:20:55 +0000 (14:20 +0100)] 
privsep: Only use freeifaddrs if not using privsep

5 years agoLinux: make resource limits work by using getifaddrs over privsep
Roy Marples [Fri, 5 Jun 2020 13:12:23 +0000 (14:12 +0100)] 
Linux: make resource limits work by using getifaddrs over privsep

5 years agoLinux: resource limits don't easily work here either....
Roy Marples [Fri, 5 Jun 2020 12:51:51 +0000 (13:51 +0100)] 
Linux: resource limits don't easily work here either....

5 years agoFreeBSD: Fix prior for capsicum as well.
Roy Marples [Fri, 5 Jun 2020 12:15:51 +0000 (13:15 +0100)] 
FreeBSD: Fix prior for capsicum as well.

5 years agoOpenBSD: disable setting resource limits as we have pledge.
Roy Marples [Fri, 5 Jun 2020 12:02:32 +0000 (13:02 +0100)] 
OpenBSD: disable setting resource limits as we have pledge.

5 years agoprivsep: Set resource limits when dropping privs
Roy Marples [Fri, 5 Jun 2020 11:24:44 +0000 (12:24 +0100)] 
privsep: Set resource limits when dropping privs

Disables forking, new files, sockets and writing large files.

5 years agoif: Keep the PF_LINK socket open throughout
Roy Marples [Fri, 5 Jun 2020 11:23:51 +0000 (12:23 +0100)] 
if: Keep the PF_LINK socket open throughout

Saves opening it and closing it each time we discover interfaces.

5 years agoprivsep: Remove pledges inet and dns from the master process
Roy Marples [Fri, 5 Jun 2020 10:12:21 +0000 (11:12 +0100)] 
privsep: Remove pledges inet and dns from the master process

Achieved by adding IPC to ignore interfaces names based on
the interface group.

This means every process just pledges stdio for IPC which the
exception of the master process which also pledges route so it
can access the routing table.

5 years agoFix installing the embedded config as a file.
Roy Marples [Thu, 4 Jun 2020 20:49:37 +0000 (21:49 +0100)] 
Fix installing the embedded config as a file.

5 years agoRelease dhcpcd-9.1.1 v9.1.1
Roy Marples [Thu, 4 Jun 2020 12:35:46 +0000 (13:35 +0100)] 
Release dhcpcd-9.1.1

5 years agoprivsep: Remove this error masking as well.
Roy Marples [Thu, 4 Jun 2020 11:36:10 +0000 (12:36 +0100)] 
privsep: Remove this error masking as well.

5 years agoprivsep: Log ECONNRESET errors again
Roy Marples [Thu, 4 Jun 2020 11:31:24 +0000 (12:31 +0100)] 
privsep: Log ECONNRESET errors again

Now that we've improved the robustness of the IPC this is important.

5 years agoprivsep: Set buffer sizes before setting rights.
Roy Marples [Thu, 4 Jun 2020 11:22:40 +0000 (12:22 +0100)] 
privsep: Set buffer sizes before setting rights.

5 years agoprivsep: Don't wait for the process to finish when stopping it
Roy Marples [Thu, 4 Jun 2020 11:15:20 +0000 (12:15 +0100)] 
privsep: Don't wait for the process to finish when stopping it

Instead, wait on receipt of SIGCHLD so we're not blocked.

5 years agoFix warning for prior on Linux
Roy Marples [Thu, 4 Jun 2020 10:30:20 +0000 (11:30 +0100)] 
Fix warning for prior on Linux

5 years agoprivsep: Fix returning indirect ioctl data
Roy Marples [Thu, 4 Jun 2020 10:25:11 +0000 (11:25 +0100)] 
privsep: Fix returning indirect ioctl data

5 years agoeloop: Just use ppoll(2)
Roy Marples [Wed, 3 Jun 2020 22:30:08 +0000 (23:30 +0100)] 
eloop: Just use ppoll(2)

epoll and kqueue are really too heavy weight.
With privsep, we now favour more processes for BPF and per address sockets.
As such, the number of fds to monitor will always be quite small.

All modern OS now have ppoll(2) (NetBSD has pollts, which is the same)
which works perfectly for us.
If neither are present, the a wrapper around pselect(2) is provided,
which can be found on all POSIX systems.

This makes the code a lot smaller and easier to follow.
The reduced binary size and memory usage is a nice win here.

5 years agoauth: Fix warning for non privsep builds
Roy Marples [Wed, 3 Jun 2020 22:12:59 +0000 (23:12 +0100)] 
auth: Fix warning for non privsep builds

5 years agoprivsep: Access the RDM monotic file via IPC
Roy Marples [Tue, 2 Jun 2020 16:48:34 +0000 (17:48 +0100)] 
privsep: Access the RDM monotic file via IPC

As we can't get at it in the chroot.
While here, harden the file.

5 years agoBSD: Ignore fwip(4)
Roy Marples [Tue, 2 Jun 2020 16:07:12 +0000 (17:07 +0100)] 
BSD: Ignore fwip(4)

5 years agoprivsep: harden process handling
Roy Marples [Tue, 2 Jun 2020 14:50:17 +0000 (15:50 +0100)] 
privsep: harden process handling

If eloop is exited, only allow explicit re-entry.
Only exit on read/write error if a forked process and not root.
If the root process fails to read/write to a sub-process,
stop the sub-process.

5 years agoifaces could be NULL here
Roy Marples [Tue, 2 Jun 2020 13:51:20 +0000 (14:51 +0100)] 
ifaces could be NULL here

5 years agoARP: call arp_announced when cancelling it
Roy Marples [Tue, 2 Jun 2020 10:48:35 +0000 (11:48 +0100)] 
ARP: call arp_announced when cancelling it

This signals that the announcement has finished and any BPF process
can then be closed off.

5 years agoauth: Only accept RECONFIGURE messages from LL hosts
Roy Marples [Tue, 2 Jun 2020 02:01:37 +0000 (03:01 +0100)] 
auth: Only accept RECONFIGURE messages from LL hosts

This has to be authentiated, and there is a chance we cannot know
the token if IP address sharing.
The initial messages are send via LL anyway, so the peer address
the server should record is the LL.

While here, drop the lease at exit if we accepted a reconfigure token.
The token may not be in all the replies from the server and we
always save the last reply.

XXX Save the token in another file?

5 years agoprivsep: Only open raw sockets for the needed protocols.
Roy Marples [Mon, 1 Jun 2020 17:59:08 +0000 (18:59 +0100)] 
privsep: Only open raw sockets for the needed protocols.

Just warn about any errors rather than forcing an early exit as well.
While here, fix startup if DHCPv6 disabled globally but enabled per if.

5 years agoFix compile without DHCP or DHCP6
Roy Marples [Mon, 1 Jun 2020 14:38:51 +0000 (15:38 +0100)] 
Fix compile without DHCP or DHCP6

5 years agoprivsep: Double the size of the send buffer.
Roy Marples [Mon, 1 Jun 2020 14:33:05 +0000 (15:33 +0100)] 
privsep: Double the size of the send buffer.

And ensure the buffer size is not reduced.

5 years agoprivsep: Ensure socketpair IPC buffers are large enough.
Roy Marples [Mon, 1 Jun 2020 14:03:46 +0000 (15:03 +0100)] 
privsep: Ensure socketpair IPC buffers are large enough.

For at least one fully sized message.

5 years agoprivsep: Don't carry ifa_next
Roy Marples [Mon, 1 Jun 2020 12:57:31 +0000 (13:57 +0100)] 
privsep: Don't carry ifa_next

While harmless, it's also meaningless.

5 years agoRestore dumping a lease from stdin
Roy Marples [Sun, 31 May 2020 20:06:32 +0000 (21:06 +0100)] 
Restore dumping a lease from stdin

5 years agoRelease dhcpcd-9.1.0 v9.1.0
Roy Marples [Sun, 31 May 2020 11:14:28 +0000 (12:14 +0100)] 
Release dhcpcd-9.1.0

5 years agoFix compile with inet or inet6 disabled
Roy Marples [Sat, 30 May 2020 14:50:25 +0000 (14:50 +0000)] 
Fix compile with inet or inet6 disabled

5 years agoLinux: File compile without plugins
Julian Wollrath [Sat, 30 May 2020 14:21:04 +0000 (14:21 +0000)] 
Linux: File compile without plugins

5 years agoroute: improve overflow logging
Roy Marples [Sat, 30 May 2020 14:01:47 +0000 (14:01 +0000)] 
route: improve overflow logging

5 years agologerr: Preserve errno
Roy Marples [Sat, 30 May 2020 13:54:31 +0000 (14:54 +0100)] 
logerr: Preserve errno

5 years agoprivsep: Drain the link socket as we can't re-open it.
Roy Marples [Sat, 30 May 2020 12:25:41 +0000 (13:25 +0100)] 
privsep: Drain the link socket as we can't re-open it.

Add debug per 100 messages.

5 years agoFix some Coverity isues
Roy Marples [Sat, 30 May 2020 10:36:20 +0000 (10:36 +0000)] 
Fix some Coverity isues

5 years agoFix some clang analyzer issues
Roy Marples [Sat, 30 May 2020 09:51:49 +0000 (09:51 +0000)] 
Fix some clang analyzer issues

5 years agoSolaris: IP_RECVIF is busted on DilOS at least
Roy Marples [Fri, 29 May 2020 19:33:30 +0000 (22:33 +0300)] 
Solaris: IP_RECVIF is busted on DilOS at least

Luckily Solaris supports IP_PKTINFO as well so lets fall back
to that for the time being.

5 years agoSolaris: Fix sending RS probes
Roy Marples [Fri, 29 May 2020 19:07:49 +0000 (22:07 +0300)] 
Solaris: Fix sending RS probes

5 years agoSolaris: driver names have numbers
Roy Marples [Fri, 29 May 2020 19:01:10 +0000 (22:01 +0300)] 
Solaris: driver names have numbers

So we can't use the BSD/Linux methodology

5 years agoSolaris: Fix compile
Roy Marples [Fri, 29 May 2020 18:13:11 +0000 (21:13 +0300)] 
Solaris: Fix compile

But if_init is failing? Odd as this has not changed.

5 years agoDHCP6: Revert part of prior - only allow vendorclassid to disable
Roy Marples [Thu, 28 May 2020 08:02:13 +0000 (09:02 +0100)] 
DHCP6: Revert part of prior - only allow vendorclassid to disable

Not set.
dhcpcd owns the IANA_PEN defined.
Either use it as is, or get your own.
This restores the prior behaviour but still allows the option
as a whole to be disabled by vendorclassid being disabled.

5 years agodhcpcd.conf: harden default options
Roy Marples [Wed, 27 May 2020 22:34:16 +0000 (23:34 +0100)] 
dhcpcd.conf: harden default options

Don't send the current hostname.
Don't send the default vendorclassid.
Slight re-org while here.

5 years agoDHCP6: Use interface vendorclassid rather than context
Roy Marples [Wed, 27 May 2020 20:49:05 +0000 (21:49 +0100)] 
DHCP6: Use interface vendorclassid rather than context

This allows the vendor class to be turned off as well.

5 years agoAppease older compilers
Roy Marples [Wed, 27 May 2020 15:53:21 +0000 (15:53 +0000)] 
Appease older compilers

5 years agoFor systems without open_memstream(3) warn that /tmp needs to exit
Roy Marples [Wed, 27 May 2020 15:52:01 +0000 (15:52 +0000)] 
For systems without open_memstream(3) warn that /tmp needs to exit

Inside the privsep users home directory.

5 years agoCheck AF_PACKET is defined
Roy Marples [Wed, 27 May 2020 15:49:40 +0000 (15:49 +0000)] 
Check AF_PACKET is defined

5 years agodhcpcd: Fix a memory error dumping leases.
Roy Marples [Sun, 24 May 2020 14:57:18 +0000 (14:57 +0000)] 
dhcpcd: Fix a memory error dumping leases.

5 years agoprivsep: root and inet don't need arc4random
Roy Marples [Sun, 24 May 2020 14:38:06 +0000 (14:38 +0000)] 
privsep: root and inet don't need arc4random

Saves a fd or two.

5 years agoprivsep: Avoid the /proc/../ escape
Roy Marples [Sun, 24 May 2020 13:49:41 +0000 (14:49 +0100)] 
privsep: Avoid the /proc/../ escape

5 years agodhcpcd: Fix releasing addresses
Roy Marples [Sun, 24 May 2020 13:32:15 +0000 (14:32 +0100)] 
dhcpcd: Fix releasing addresses

5 years agoprivsep: Init the arc4random seed before chrooting
Roy Marples [Sun, 24 May 2020 12:23:20 +0000 (12:23 +0000)] 
privsep: Init the arc4random seed before chrooting

/dev/urandom isn't available in the chroot.
So keep a fd open to it.

5 years agoFix some memory issues with prior
Roy Marples [Sun, 24 May 2020 12:02:15 +0000 (12:02 +0000)] 
Fix some memory issues with prior

5 years agoFix prior for BSD
Roy Marples [Sun, 24 May 2020 11:30:13 +0000 (12:30 +0100)] 
Fix prior for BSD

5 years agoprivsep: Fix compile for prior without dev plugins
Roy Marples [Sun, 24 May 2020 10:49:58 +0000 (11:49 +0100)] 
privsep: Fix compile for prior without dev plugins

5 years agoprivsep: Pass BPF flags via ps_flags
Roy Marples [Sun, 24 May 2020 10:36:14 +0000 (10:36 +0000)] 
privsep: Pass BPF flags via ps_flags

5 years agoprivsep: Allow dev plugins to work
Roy Marples [Sun, 24 May 2020 10:30:23 +0000 (10:30 +0000)] 
privsep: Allow dev plugins to work

For udev at least, it requires a /var/run to be available in the chroot
which is poor. As such, give it a full IPC.

5 years agoprivsep: No need for a CHROOT reason now
Roy Marples [Sun, 24 May 2020 05:54:40 +0000 (05:54 +0000)] 
privsep: No need for a CHROOT reason now

5 years agoprivsep: Allow Linux to work without needing any mounts
Roy Marples [Sun, 24 May 2020 05:47:14 +0000 (05:47 +0000)] 
privsep: Allow Linux to work without needing any mounts

5 years agoMove get_line to common to re-use outside of options
Roy Marples [Sun, 24 May 2020 05:24:52 +0000 (05:24 +0000)] 
Move get_line to common to re-use outside of options

5 years agoAvoid putting an extra space here.
Roy Marples [Fri, 22 May 2020 09:12:55 +0000 (10:12 +0100)] 
Avoid putting an extra space here.

5 years agodhcpcd: Move the script file from per interface to global context
Roy Marples [Thu, 21 May 2020 17:28:27 +0000 (18:28 +0100)] 
dhcpcd: Move the script file from per interface to global context

This *should* affect no-one, but you never know.
The primary motivation for this is to ensure that nothing arbitary
can be executed by the root process if anyone breaks into the
chrooted unprivileged master process.

It also makes for smaller code.

5 years agoprivsep: Validate ICMP messages we send as well
Roy Marples [Thu, 21 May 2020 16:03:54 +0000 (17:03 +0100)] 
privsep: Validate ICMP messages we send as well

5 years agoprivsep: Validate UDP ports
Roy Marples [Thu, 21 May 2020 15:53:54 +0000 (16:53 +0100)] 
privsep: Validate UDP ports

Just like we filter the ioctls.

5 years agoApparently case is important.
Roy Marples [Thu, 21 May 2020 15:30:08 +0000 (16:30 +0100)] 
Apparently case is important.

5 years agodhcpcd: Silence console output entirely with more -q
Roy Marples [Thu, 21 May 2020 15:12:25 +0000 (16:12 +0100)] 
dhcpcd: Silence console output entirely with more -q

SystemD logs console ouput and syslog to the same place.
Pretty daft if you ask me, but heh.
-qq disables console output entirely to make SystemD logs easier to read.

5 years agoNote RFC6926 fields even though we don't perform a bulk lease query
Roy Marples [Thu, 21 May 2020 14:35:06 +0000 (15:35 +0100)] 
Note RFC6926 fields even though we don't perform a bulk lease query

5 years agoprivsep: Only allow file IO to specific paths
Roy Marples [Thu, 21 May 2020 11:54:58 +0000 (12:54 +0100)] 
privsep: Only allow file IO to specific paths

In the same vein as filtering ioctls.

5 years agoprivsep: Log the user chrooting as
Roy Marples [Wed, 20 May 2020 20:43:20 +0000 (21:43 +0100)] 
privsep: Log the user chrooting as

5 years agoRemove some old FORKED logic.
Roy Marples [Wed, 20 May 2020 20:36:00 +0000 (21:36 +0100)] 
Remove some old FORKED logic.

No longer needed now the main process forks from the get go.

5 years agoprivsep: Filter ioctls to a known list.
Roy Marples [Wed, 20 May 2020 17:14:38 +0000 (18:14 +0100)] 
privsep: Filter ioctls to a known list.

In-case the master process is broken into.

5 years agoARP: reduce conflicts from errors to warnings
Roy Marples [Wed, 20 May 2020 16:37:21 +0000 (17:37 +0100)] 
ARP: reduce conflicts from errors to warnings

It's only an error on DAD failure and you're warned about this
already.

5 years agoprivsep: inet processes no longer need inet pledge
Roy Marples [Wed, 20 May 2020 16:27:07 +0000 (17:27 +0100)] 
privsep: inet processes no longer need inet pledge

5 years agoOpenBSD: Avoid a pledge segfault when exiting
Roy Marples [Wed, 20 May 2020 16:14:12 +0000 (17:14 +0100)] 
OpenBSD: Avoid a pledge segfault when exiting

No cpath permission anymore, so we can't unlink the pidfile.
If compiled for pledge then don't bother.

5 years agoprivsep: Ensure we don't scribble garbage to BPF
Roy Marples [Wed, 20 May 2020 15:44:19 +0000 (15:44 +0000)] 
privsep: Ensure we don't scribble garbage to BPF

Well, it's not garbage, it's a privsep IPC message telling us to
start BPF which the BPF process should not have recieved!
Add code to ensure this cannot happen.

5 years agoARP: A few minor fixes for prior
Roy Marples [Wed, 20 May 2020 15:43:44 +0000 (15:43 +0000)] 
ARP: A few minor fixes for prior

5 years agoprivsep: Add comment about BPF returing EPERM on OpenBSD.
Roy Marples [Wed, 20 May 2020 13:15:30 +0000 (14:15 +0100)] 
privsep: Add comment about BPF returing EPERM on OpenBSD.

Looks like an OpenBSD bug.

5 years agoIPv4LL: Fix for non NetBSD
Roy Marples [Wed, 20 May 2020 13:07:36 +0000 (14:07 +0100)] 
IPv4LL: Fix for non NetBSD

5 years agoOpenBSD: Fix non privsep builds.
Roy Marples [Wed, 20 May 2020 11:23:25 +0000 (12:23 +0100)] 
OpenBSD: Fix non privsep builds.

5 years agoIPv4LL: Fix for prior on NetBSD at least.
Roy Marples [Wed, 20 May 2020 11:17:00 +0000 (12:17 +0100)] 
IPv4LL: Fix for prior on NetBSD at least.

5 years agoLinux: workaround a kernel bug when sending DHCPv6 over SOCK_RAW
Roy Marples [Tue, 19 May 2020 16:44:49 +0000 (16:44 +0000)] 
Linux: workaround a kernel bug when sending DHCPv6 over SOCK_RAW

The equivalent works fine for DHCP messages, so hum ho.

5 years agoprivsep: No need for ipv4state
Roy Marples [Tue, 19 May 2020 16:13:06 +0000 (16:13 +0000)] 
privsep: No need for ipv4state

5 years agoFix compile on Linux
Roy Marples [Tue, 19 May 2020 16:09:35 +0000 (16:09 +0000)] 
Fix compile on Linux

5 years agoRemove some debug
Roy Marples [Tue, 19 May 2020 15:43:50 +0000 (16:43 +0100)] 
Remove some debug

5 years agoFix compile for prior on NetBSD
Roy Marples [Tue, 19 May 2020 15:37:10 +0000 (16:37 +0100)] 
Fix compile for prior on NetBSD

5 years agoprivsep: Enable Capsicum for all processes.
Roy Marples [Tue, 19 May 2020 15:19:05 +0000 (16:19 +0100)] 
privsep: Enable Capsicum for all processes.

Except for the priviledged process.
This is quite an in-depth change:
 * ARP is now one process per address
 * BPF flags are now returned via privsep
 * BPF write filters are locked when supported
 * The root process sends to the network

The last step is done by opening RAW sockets and then sending a UDP
header (where applicable) to avoid binding to an address
which is already in use by the reader sockets.

This is slightly wasteful for OS's without sandboxing but does
have the very nice side effect of not needing a source address
to unicast DHCPs replies from which makes the code smaller.

5 years agoLinux: Lock the BPF filter from future changes
Roy Marples [Sat, 16 May 2020 11:28:56 +0000 (12:28 +0100)] 
Linux: Lock the BPF filter from future changes

5 years agoARP: Remove ability to filter specific addresses
Roy Marples [Fri, 15 May 2020 21:29:30 +0000 (22:29 +0100)] 
ARP: Remove ability to filter specific addresses

This is only really needed for long lasting ARP, which is only
used for IPv4 address defence.
Modern NetBSD does not need this and it fails to work with
OpenBSD Pledge. FreeBSD Capsicum is more secure without this
as the BPF fd can then be locked for other changes [1].
That just leaves Linux and Solaris.

If anyone feels dhcpcd is processing to much ARP then please
implement RFC 5227 in the kernel like NetBSD.

[1] Locking the BPF fd is questionable because the inet proxy
using sendmsg can send any packet to any destination.

5 years agoBPF: Set write filters where supported
Roy Marples [Fri, 15 May 2020 19:23:55 +0000 (20:23 +0100)] 
BPF: Set write filters where supported

While here make Capsicum and Pledge more granular so we can
easily Pledge the BPF BOOTP process but not the ARP one.

5 years agodhcpcd: allow sigpipe in scripts.
Roy Marples [Fri, 15 May 2020 14:56:47 +0000 (15:56 +0100)] 
dhcpcd: allow sigpipe in scripts.

5 years agoDHCP: always log inform when not renewing
Roy Marples [Fri, 15 May 2020 14:34:16 +0000 (15:34 +0100)] 
DHCP: always log inform when not renewing

So that we log a new lease on rebind from a renew failure.

5 years agoprivsep: sockaddr len should be socklen_t
Roy Marples [Thu, 14 May 2020 00:15:39 +0000 (01:15 +0100)] 
privsep: sockaddr len should be socklen_t

While ps_root_getifaddrs is only for capsicum, it's highly portable
and thus in the privsep-root rather than privsep-bsd.
As such, store the sockaddr len as socklen_t because that's what
POSIX demands.

It's only a few more bytes and I'd rather make this change now
than it potentially bite me later.

5 years agoRemove debug.
Roy Marples [Wed, 13 May 2020 19:58:58 +0000 (20:58 +0100)] 
Remove debug.

5 years agoprivsep: Add a generic wrapper for getifaddrs(3)
Roy Marples [Wed, 13 May 2020 19:52:24 +0000 (20:52 +0100)] 
privsep: Add a generic wrapper for getifaddrs(3)

Although this is only for Capsicum, the getifaddrs interface is
quite portable although not POSIX.

With this final change, the Master process can now enter Capsicum
Capabilites Mode and this completes the Capsicum integration.

5 years agoprivsep: Move defines around
Roy Marples [Wed, 13 May 2020 19:50:45 +0000 (20:50 +0100)] 
privsep: Move defines around

5 years agoBump date for prior
Roy Marples [Tue, 12 May 2020 21:10:08 +0000 (22:10 +0100)] 
Bump date for prior