Commit Graph

5458 Commits

Author SHA1 Message Date
Fabrice Fontaine
572a94cef8 src/dhcpcd.c: fix build without fork or signals (#20)
Since version 9.3.3 and commit a5348dd02c,
build without fork or signals fails on:

dhcpcd.c: In function ‘main’:
dhcpcd.c:2261:3: error: label ‘start_master’ used but not defined
   goto start_master;
   ^~~~

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-12-26 19:45:08 +00:00
Roy Marples
111fb8364c privsep: log sandbox when not daemonising 2020-12-26 15:58:46 +00:00
Roy Marples
e1c846907c linux: ARM64 stock kernel does not emit hardware in cpuinfo
They have no plans to add it either, so just hardcode AArch64.
2020-12-26 15:57:31 +00:00
Roy Marples
08140d736c privsep: Fix Linux i386 for SECCOMP as it just uses socketcall
Rather than accept(2), recv(2), etc..... which is horrible!

Thanks to Steve Hirsch <stevehirsch49@msn.com> for testing.
2020-12-12 22:12:54 +00:00
Roy Marples
544191a525 DHCP6: Fix a LGTM issue 2020-12-12 17:41:37 +00:00
Roy Marples
7a85694c6c privsep: Allow getsockopt for SO_RCVBUF on Linux
For when the link socket overflows
2020-12-12 17:35:45 +00:00
Roy Marples
c81acbb4e5 link: Report errors obtaining recv buffer size on link overflow 2020-12-12 17:34:31 +00:00
Roy Marples
84fda07e2e link: Only report hardware address changes for active interfaces 2020-12-12 17:33:26 +00:00
Roy Marples
81396853be Linux: Support wireless IP roaming
This is achieved by checking that the interface is wireless,
IFF_UP and IFF_LOWER_UP are present, but IFF_RUNNING is missing.

This gives exactly the same support as modern NetBSD when carrier
loss is detected, but without the address verifications when the
carrier comes back as that needs to be handled in the kernel.

While IP setup is maintained, other configuration data is discarded.
Note that this should be improved in the future.

Thanks to Boris Krasnovskiy <borkra@gmail.com> for helping with this.
2020-12-12 13:20:19 +00:00
Roy Marples
e99249b608 privsep: Don't log a BPF error that network is down
The master process will catch this clean remove the BPF process.
2020-12-09 11:15:30 +00:00
Mikhail Efremov
7c08f3777a Linux: Fix privsep build by including sys/termios.h for all platforms 2020-12-08 16:15:28 +00:00
Roy Marples
b4907bae5f Release dhcpcd-9.3.4 2020-11-28 14:12:59 +00:00
Roy Marples
84bf6e55f7 DHCP6: Abort in test mode when an error is returned by server. 2020-11-25 15:14:11 +00:00
Roy Marples
3ee6b4aab9 Don't stop control in test 2020-11-25 14:55:25 +00:00
Roy Marples
21d3551351 options: Allow duid to take a value
If a value is given, it overrides /var/db/dhcpcd/duid.
2020-11-25 14:19:55 +00:00
Roy Marples
ba04408c08 options: allow --ia_na=1 and --ia_pd=2 on the command line
This only works for non master mode.
2020-11-25 14:05:18 +00:00
Roy Marples
3ca5bffd2d DHCP: If error adding the address in oneshot, exit with failure
Otherwise we loop.
It's unlikely oneshot would be used with IPv6 due to addresses
having lifetimes.
2020-11-24 10:30:08 +00:00
Roy Marples
7c1f6fe634 DHCP: Only listen to the address if we successfully added it
Fixes an issue on Linux where the headers advertise something
newer than what the kernel actually provides.
2020-11-23 13:22:20 +00:00
Roy Marples
7751af5f38 Improve readability. 2020-11-21 12:01:21 +00:00
Roy Marples
9b683ed33d DHCP6: Delegated activations work once more
This was broken with the --noconfigure option in dhcpcd-9.3.3
2020-11-21 11:59:07 +00:00
Roy Marples
f8771a152f DHCP6: Fix segfault introduced in dhcpcd-9.3.3
lo0 won't have a configuration for example.
2020-11-21 08:46:30 +00:00
Lars Wendler
de22dc5ef8 dhcpcd.conf(8): add all -> at all 2020-11-20 19:49:46 +00:00
Roy Marples
1bf7daf8e8 Release dhcpcd-9.3.3 2020-11-20 13:06:16 +00:00
Matthew Clarkson
450a51cc1b privsep: adjust comment for prior
Note that this is a requirement for printf over serial terminals.
2020-11-19 19:15:12 +00:00
Matthew Clarkson
3a32f22b03 privsep: Allow ioctl TCGETS
printf on some platforms seems to require it.
Without this, script_dump() may fault.
2020-11-19 15:37:33 +00:00
Matthew Clarkson
12a91777bd privsep: Allow fcntl64 and fstat64 to fix ARM32 talking to the controller
We already allow fcntl and fstat so this is not a problem.
2020-11-13 08:22:42 +00:00
Roy Marples
7ece8ef526 route: Correct prior logic 2020-11-13 08:21:12 +00:00
Roy Marples
77260559dd dhcpcd: Don't create launcher process if keeping in foreground
There is little point.
2020-11-11 17:44:55 +00:00
Roy Marples
040561d61e control: create an unpriv socket for non master mode
This allows `dhcpcd -U4 eth0` to work once more.
2020-11-11 17:41:16 +00:00
Roy Marples
c49db0e1ce When adding a route, the interface will always have options. 2020-11-04 14:25:00 +00:00
Roy Marples
e9dfc2416b Add --noconfigure option
With this set dhcpcd will not configure anything on the host.
The expectation is that a 3rd party script will instead.
2020-11-04 14:18:48 +00:00
Ted Feng
d5565ba4c5 fix if_getnetworknamespace matching bug. (#19)
Co-authored-by: Ted Feng <Ted.Feng@Aviatnet.com>
2020-11-03 22:31:40 +00:00
Roy Marples
17b3642039 Linux: Fix detecting existing IPv4 addresses
This is important for better NetworkManager support.
2020-11-03 11:37:05 +00:00
Roy Marples
7b19da4978 options: Don't log unknown option errors when printing the pidfile 2020-11-02 17:03:58 +00:00
Roy Marples
407de1ed00 Release dhcpcd-9.3.2 2020-11-01 14:07:38 +00:00
Roy Marples
88702bf5b6 Fix compile without various defines 2020-10-30 22:18:57 +00:00
Roy Marples
734031c7ca Remove debug from prior 2020-10-30 16:13:49 +00:00
Roy Marples
d5e1be0978 privsep: don't leave a BOOTP process hanging around on SIGUSR1
When not in master mode.
2020-10-30 16:11:44 +00:00
Roy Marples
b0525d9d35 log: Allow logopen to be called without logclose
logclose is meant to free resources.
On Linux this means that _log_prog is also free'd and once in the
chroot we cannot work it out again.

As such allow logopen to close what it needs to so that reopening
works.
2020-10-30 15:16:02 +00:00
Roy Marples
c963b6033c privsep: Allow logfile reopening in a chroot
Now that only the privileged actioneer does the actual logging
we can safely reopen the file we are logging to.
This also closes and re-opens the syslog connection.
2020-10-30 14:19:16 +00:00
Roy Marples
c3069de559 privsep: Send all log messages to the privileged actioneer
If dhcpcd starts and no syslogd implementation is running then
various syscall filters could be triggered when dhcpcd wants to syslog
and it's already in a chroot.

Not all libc openlog implementations support LOG_NDELAY and
openlog does not return an error code and can also mask errno back to 0.
So we have no way of knowing if we have a syslog connection or not.
This means we cannot cache the connection at startup because syslog itself
will try and open if no connection.

As such, all logging is now directed to the dhcpcd privileged actioneer
process which will handle all the syslog and log file writing actions.

The only downside of this approach (other than an extra fd per process)
is that we no longer know which PID raised the message. While we could
put the correct PID in the logfile as we control the API, we cannot
put it into syslog as we cannot control that API.
As all privsep errors should log which function they came from this
will hopefully not be an issue as on the happy path only the master
process will log stuff.
2020-10-30 03:43:51 +00:00
Roy Marples
25e2eec83b DHCP: Implement IPv6-Only Preferred option, RFC 8925.
Enable it like so in dhcpcd.conf:
option ipv6_only_preferred
2020-10-26 11:19:54 +00:00
Roy Marples
c5740a4825 privsep: Close BPF socket on ENXIO.
This stops log spam if RTM_IFANNOUNCE is delayed for the departing
interface.
2020-10-25 15:30:13 +00:00
Roy Marples
a5ca938487 Bump date for prior 2020-10-25 08:52:38 +00:00
Roy Marples
dca37a5e26 dhcpcd.conf(5): mention fallback for the reboot option
Syncs with dhcpcd(8)
2020-10-25 08:50:44 +00:00
Roy Marples
3db40d00c4 BSD: LINK_UNKNOWN is traditionally treated as LINK_UP 2020-10-16 14:36:34 +01:00
Roy Marples
2a5ca0e317 privsep: Allow more syscalls through SECCOMP and add a debugger
This fixes PowerPC at least.

The debugger should not be enabled by default as the attacker
could keep the processes running.
However, it is need to work out which syscall is failing due to the
way SECCOMP works.
2020-10-15 17:59:33 +01:00
Roy Marples
944e4b80d4 Make a note about solaris privileges 2020-10-15 13:29:26 +01:00
Roy Marples
40a08e98ee duid: plug a potential memory leak 2020-10-12 14:56:34 +01:00
Roy Marples
fadb847a8e Release dhcpcd-9.3.1 2020-10-12 14:41:06 +01:00