Roy Marples [Fri, 10 Apr 2020 09:17:38 +0000 (10:17 +0100)]
privsep: default to using _dhcpcd and not _dhcp
_dhcp home dir defaults to /var/empty.
System integrators can and should be in charge of changing it when needed.
Packagers on the other hand don't have such a luxury and so should not
use _dhcp by default.
Roy Marples [Thu, 9 Apr 2020 15:16:37 +0000 (16:16 +0100)]
RA: Rework temporary address management
Vastly simpfly how they are generated and managed.
Temporary address generation now uses pure random numbers
rather than MD5ing over a random secret as arc4random should be
random enough. This change reflects RFC 4941bis.
An empty signal mask is probably more appropriate, since most
programs presume that the signal mask is empty when they start
even when they are using signals.
Roy Marples [Sun, 5 Apr 2020 06:47:14 +0000 (07:47 +0100)]
privsep: If we fail to init privsep, continue
We continue if the privsep user cannot be found, so do the same
if passwd or similar is missing from the system.
This helps people who use dhcpcd in ramdisks to oneshot the config
for example to start iSCSI.
Roy Marples [Fri, 3 Apr 2020 18:05:41 +0000 (18:05 +0000)]
Linux: improve IPv6 router reachability
Only mark as unreachable for NUD_FAILED.
Sadly the kernel emits this when the NDP entry is deleted for
whatever reason, which looks like a bug in the kernel.
Shortly after dhcpcd started using these constants, they were dropped from OpenBSD kernel headers as they're only used by rad(8). Switch to dhcpcd's own constants instead, fixing build on recent -current.
Roy Marples [Wed, 1 Apr 2020 12:22:15 +0000 (13:22 +0100)]
resolv.conf: Uniquify contents
We might have >1 router that broadcasts the same DNS information.
While resolvconf(8) can easily take care of uniqifying the data,
not all systems have this nice tool so do the job here as well.
Roy Marples [Tue, 31 Mar 2020 19:21:58 +0000 (20:21 +0100)]
dhcpcd: disable address sanitization by default
As recent production kernels ship with ASLR by default which
stops dhcpcd running dead when this is enabled.
We dont want to break a systems boot, so force it via configure.
Roy Marples [Fri, 27 Mar 2020 16:14:48 +0000 (16:14 +0000)]
dhcpcd: dumping lease uses control socket to get the lease
Thanks to privsep it's hard to know where the lease is now stored.
As such, the only true location is from the running dhcpcd process.
The ability to read a raw lease from stdin has been dropped.
Roy Marples [Sun, 16 Feb 2020 09:38:57 +0000 (09:38 +0000)]
Revert "dhcp: Cast away a compile warning"
This reverts commit ccf3a5e9fe4ea8f63cfcdb27f96b02ec2cc8ff70.
This has been determined to be a gcc bug and will be worked
around another way in the build system.
Sergey Nikiforov [Tue, 11 Feb 2020 11:07:13 +0000 (11:07 +0000)]
logerr: Use macros to call log functions
This allows downstream implementions to inject their own data
into the log message and/or supply new logging targets whilst
preserving macros such as __FILE__ and __LINE__.
Roy Marples [Thu, 6 Feb 2020 12:54:11 +0000 (12:54 +0000)]
inet6: Ensure expired routers are cleared after a carrier loss
When we lose carrier, mark all RAs as willexpire and add
the timeout to expire to it's own queue.
On receipt of a matching RA, clear the willexpire flag.
When the above timeout occours, set doexpire on all
RA's with withexpire and then call the general expirera function.
This is needed because expirera can be called at any point.
Roy Marples [Wed, 5 Feb 2020 13:29:45 +0000 (13:29 +0000)]
BPF: Return the frame header with the data
For DHCP, we then just skip over the frame header.
For ARP, we extract the frame source and destination addresses
so we can log the source in the event of a conflict.
This is important as a user has found a router which sets the ARP
source and destination hardware addresses to all zeros but unicasts
the ARP straight to our hardware address.
Roy Marples [Tue, 4 Feb 2020 15:21:40 +0000 (15:21 +0000)]
BSD: When applying RA base information, ensure flags are correct
For some resaon, under privsep only, SIOCGIFINFO_IN6 returns 0
in flags even though the kernel seems to set it correctly.
SIOCSIFINFO_IN6 *will* overwrite flags regardless, so ensure
it has the correct value for dhcpcd.