]>
git.ipfire.org Git - thirdparty/dhcpcd.git/log
Anders Kaseorg [Wed, 1 Jan 2020 19:42:47 +0000 (11:42 -0800)]
Linux: fix RA time unit confusion
The RA times are provided in milliseconds, but commit
569051c8aa8fc297eb8edb7bd228e0fd353d30c1 (dhcpcd-8.1.3~18) “Linux:
prefer ms RA times” incorrectly scaled them by an extra factor of 1000
before writing them to retrans_time_ms and base_reachable_time_ms.
Instead, write the values in milliseconds directly to the *_ms files,
and correctly convert to jiffies or seconds for the other files if
necessary.
Fixes NixOS/nixpkgs#76710.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Roy Marples [Fri, 20 Dec 2019 22:05:59 +0000 (22:05 +0000)]
options: Fix allocating the script option
When passing PARSE_STRING_NULL we expect to store the string
NULL terminated. As such, allocate space for it an ensure we have
space for it.
Roy Marples [Thu, 19 Dec 2019 15:36:31 +0000 (15:36 +0000)]
DHCP: Ensure we have a lease to extract options from.
Roy Marples [Wed, 18 Dec 2019 14:37:01 +0000 (14:37 +0000)]
privsep: Support the generic _dhcp entry on DragonFly
No need to create a specific _dhcpcd user in this instance.
Roy Marples [Wed, 18 Dec 2019 14:16:18 +0000 (14:16 +0000)]
Linux: Move RTA_OK and RTA_NEXT from a while to a for loop.
Roy Marples [Tue, 17 Dec 2019 22:32:21 +0000 (22:32 +0000)]
DHCP6: Remove now unused vars
Roy Marples [Tue, 17 Dec 2019 22:23:56 +0000 (22:23 +0000)]
DHCP6: Add disabled code to allow packet replay
I get bored of adding similar code from time to time just to
aid debugging, so let's just add it in.
Someone else might find it useful too.
Roy Marples [Tue, 17 Dec 2019 22:16:26 +0000 (22:16 +0000)]
DHCP6: Rework delegation deprecation
Split ipv6_addaddrs out so ipv6_doaddr can operate on a single address.
Call this when deprecating delegated addresses to avoid calling
ipv6_addaddrs.
This allows a more simple ipv6_addaddrs that doesn't need to test
which address collection we are deleting from and removes DHCPv6
specific code from the generic IPv6 module.
Roy Marples [Tue, 17 Dec 2019 15:57:18 +0000 (15:57 +0000)]
Correct URL in prior
Roy Marples [Tue, 17 Dec 2019 15:48:37 +0000 (15:48 +0000)]
Note some compilation issues and how to solve them.
Roy Marples [Tue, 17 Dec 2019 15:29:53 +0000 (15:29 +0000)]
Linux: work around alignment isses with clang
Roy Marples [Tue, 17 Dec 2019 12:26:11 +0000 (12:26 +0000)]
Linux: remove some casts no longer needed
Roy Marples [Mon, 16 Dec 2019 16:56:17 +0000 (16:56 +0000)]
DHCP6: Fix deprecating a delegated prefix
Be sure to remove the address using the right TAILQ member.
While here, simplify the initialisation of pd_pfxs.
Roy Marples [Mon, 16 Dec 2019 12:32:43 +0000 (12:32 +0000)]
options: Suboption 3 of NTP Server is a FQDN
As such it should be domain and not ip6address.
Roy Marples [Thu, 12 Dec 2019 14:06:20 +0000 (14:06 +0000)]
DHCP: Don't warn about expiry of deprecated addresses
Roy Marples [Wed, 11 Dec 2019 16:09:18 +0000 (16:09 +0000)]
compat: Add a guard to _strtoi.h
Not really needed but LGTM wants it which blows.
Should really take this upstream.....
Roy Marples [Wed, 11 Dec 2019 12:36:14 +0000 (12:36 +0000)]
Refix assertation....
Roy Marples [Tue, 10 Dec 2019 21:44:24 +0000 (21:44 +0000)]
IPv6ND: Fix reachable test
Roy Marples [Tue, 10 Dec 2019 21:35:49 +0000 (21:35 +0000)]
privsep: Don't close not open fd's
Roy Marples [Tue, 10 Dec 2019 21:26:40 +0000 (21:26 +0000)]
privsep: prefer IN_PRIVSEP macros
Roy Marples [Tue, 10 Dec 2019 21:00:58 +0000 (21:00 +0000)]
privsep: Enable ARP BPF filtering for interesting addresses
This brings parity with non privsep features.
Aside from the lack of Solaris support, but that's another day.
Roy Marples [Sat, 7 Dec 2019 21:29:40 +0000 (21:29 +0000)]
script: Document why this block is intentionally blank.
Roy Marples [Sat, 7 Dec 2019 17:06:18 +0000 (17:06 +0000)]
DHCP: dl is always >0 at this point, so remove check.
Found by the LGTM bot.
Roy Marples [Sat, 7 Dec 2019 14:11:30 +0000 (14:11 +0000)]
privsep: Fix an assertation
Found by LGTM bot.
Roy Marples [Mon, 2 Dec 2019 00:43:07 +0000 (00:43 +0000)]
privsep: Allow priviledge separation user to be specified by configure
Roy Marples [Sun, 1 Dec 2019 22:09:18 +0000 (22:09 +0000)]
privsep: Enable privsep by default
Except on Solaris where it's not expected to work.
Roy Marples [Sun, 1 Dec 2019 21:56:08 +0000 (21:56 +0000)]
privsep: Always check the unpriv user exists
So that every process fails and we can fall back to non privsep mode.
Roy Marples [Sun, 1 Dec 2019 21:54:48 +0000 (21:54 +0000)]
privsep: Dont exit the eloop on signal in the launcher process
The state engine will receive the signal and write back to the
fork_fd socket.
Roy Marples [Sun, 1 Dec 2019 08:57:07 +0000 (08:57 +0000)]
dhcpcd: log forked to background earlier
Roy Marples [Fri, 29 Nov 2019 23:53:11 +0000 (23:53 +0000)]
dhcpcd: Only report SSID when we have a carrier
Roy Marples [Fri, 29 Nov 2019 22:40:00 +0000 (22:40 +0000)]
Close ends of sigpipe not needed.
Roy Marples [Fri, 29 Nov 2019 22:11:46 +0000 (22:11 +0000)]
dhcpcd: Rework daemonisation
Now that we spawn helper processes for priviledge separation,
we need to fork() and setssid() much earlier. Infact, pretty much
from the get go of starting up.
dhcpcd_daemonise now writes to the launcher signal pipe about the
result of "daemonisation", even though it's already deamonised at
this point.
This allows dhcpcd to keep the helper processes running when
started by the system init at boot.
Roy Marples [Fri, 29 Nov 2019 22:07:08 +0000 (22:07 +0000)]
common: add close_std
Closed stdin, stdout and stderr.
Roy Marples [Fri, 29 Nov 2019 22:06:25 +0000 (22:06 +0000)]
privsep: guard spawn debug messages behind PRIVSEP_DEBUG
Roy Marples [Fri, 29 Nov 2019 14:46:15 +0000 (14:46 +0000)]
dhcpcd-run-hooks: change state dir name to reflect what it is
Roy Marples [Fri, 29 Nov 2019 14:15:56 +0000 (14:15 +0000)]
Linux: Improve privsep write unsigned int to path API
Roy Marples [Fri, 29 Nov 2019 13:55:46 +0000 (13:55 +0000)]
privsep: Use another eloop instead of a blocking read.
We need to read the error status from making a privileged request.
This happens in an eloop already, but the read itself needs to block.
So that we can still be interupted, use an inner eloop whose sole
purpose is to monitor the root fd for message back. Then we can
make the fd non blocking.
dhcpcd should now exit cleanly once more.
Roy Marples [Fri, 29 Nov 2019 13:33:14 +0000 (13:33 +0000)]
dhcpcd: signal_cb -> dhcpcd_signal_cb
Roy Marples [Fri, 29 Nov 2019 03:19:02 +0000 (03:19 +0000)]
privsep: Note the db directory needs to be readable by _dhcpcd.
Roy Marples [Fri, 29 Nov 2019 01:24:17 +0000 (01:24 +0000)]
Whitespace
Roy Marples [Fri, 29 Nov 2019 01:17:12 +0000 (01:17 +0000)]
privsep: Don't log error shutting down a unconnected socket.
Roy Marples [Fri, 29 Nov 2019 00:32:42 +0000 (00:32 +0000)]
privsep: Don't close BPF listeners when forked
The normal flow is just to release resources for sanitisers.
Roy Marples [Fri, 29 Nov 2019 00:05:48 +0000 (00:05 +0000)]
privsep: Fix a crash trying to close a non existant inet listener
Roy Marples [Thu, 28 Nov 2019 23:50:16 +0000 (23:50 +0000)]
privsep: Expect errors from ioctl so dont log them.
The dhcpcd state engine will.
Roy Marples [Thu, 28 Nov 2019 23:23:21 +0000 (23:23 +0000)]
privsep: Sprinkle some const
Roy Marples [Thu, 28 Nov 2019 23:06:44 +0000 (02:06 +0300)]
Solaris: start privsep support
Compiles but lacks support for DLPI and ioctl needs rework.
Roy Marples [Thu, 28 Nov 2019 22:13:35 +0000 (01:13 +0300)]
Solaris: Fix non PRIVSEP compile
Roy Marples [Thu, 28 Nov 2019 16:41:15 +0000 (16:41 +0000)]
privsep: Add support for priviledge separation
Not enabled by default - enable with ./configure --enable-privsep
Requires a user added to the system - default _dhcpcd
Several processes will be spawned off the main state engine:
a privileged actioneer and a generic network proxy.
Only the privileged actioneer process will retain root permissions.
When required, the privileged actioneer will also spawn
BPF listeners for BOOTP (DHCP) and ARP.
The BOOTP BPF listener should be a short lived process.
On kernels with RFC 5227 support, the ARP BPF listener will only
be used for ARPing and announcing a preferred address and will
also be a short lived process.
When not running in master mode, an address listener will be
spawned for each address (with the exception of RA dervived addresses)
dhcpcd cares about.
TODO:
* Solaris support.
* ARP BPF address filtering.
Roy Marples [Thu, 28 Nov 2019 12:34:29 +0000 (12:34 +0000)]
Sync strtoi and strtou with latest upstream to allow -Wundef
not to error.
Roy Marples [Thu, 28 Nov 2019 12:22:28 +0000 (12:22 +0000)]
build: Add -Wundef to debugging CFLAGS
Roy Marples [Thu, 28 Nov 2019 12:14:52 +0000 (12:14 +0000)]
Correct path for dhcpcd socket.
Roy Marples [Thu, 28 Nov 2019 12:09:50 +0000 (12:09 +0000)]
Move some option finialisation so it's available globally.
Roy Marples [Thu, 28 Nov 2019 11:58:24 +0000 (11:58 +0000)]
Fix socket paths for prior.
Roy Marples [Thu, 28 Nov 2019 11:47:29 +0000 (11:47 +0000)]
build: Move rundir from /var/run to /var/run/dhcpcd
This will allow dhcpcd to create and unlink pidfiles and sockets
which it could otherwise not if dropped priviledges.
Downstream packages such as dhcpcd-ui will need to be adjusted.
Roy Marples [Thu, 28 Nov 2019 11:17:23 +0000 (11:17 +0000)]
DHCP: Require unspecificed BOOTP port for master mode
This mirrors DHCP6 behaviour and will make privsep easier.
This is also a change in behaviour from prior versions and is the
first real change for dhcpcd-9.
Roy Marples [Wed, 27 Nov 2019 15:10:15 +0000 (15:10 +0000)]
Welcome to the start of dhcpcd-9
Roy Marples [Wed, 27 Nov 2019 15:06:47 +0000 (15:06 +0000)]
DHCP6: Fix prior to log an error
Roy Marples [Tue, 26 Nov 2019 19:58:42 +0000 (19:58 +0000)]
DHCP6: Improve API for privsep
Roy Marples [Tue, 26 Nov 2019 19:57:30 +0000 (19:57 +0000)]
DHCP: Improve API for privsep
Roy Marples [Tue, 19 Nov 2019 22:02:05 +0000 (22:02 +0000)]
Linux: remove XX debug
Roy Marples [Tue, 19 Nov 2019 21:13:15 +0000 (21:13 +0000)]
Linux: Support kernels without PR_SET_MM_MAP
Roy Marples [Sun, 17 Nov 2019 19:57:27 +0000 (19:57 +0000)]
Linux: prefer ms RA times
The old sysctls have apparently been deprecated since 2.6.12.
Sascha Wildner [Fri, 15 Nov 2019 11:28:28 +0000 (11:28 +0000)]
Spelling fixes
Roy Marples [Wed, 13 Nov 2019 10:23:52 +0000 (10:23 +0000)]
Release dhcpcd-8.1.2
Roy Marples [Tue, 12 Nov 2019 16:01:50 +0000 (16:01 +0000)]
dhcpcd: report SSID connected to when we gain carrier
Helps debugging without the need for explicit debug.
Roy Marples [Sun, 10 Nov 2019 21:12:31 +0000 (21:12 +0000)]
RA: Set mtu to zero and then pull in the MTU option if any
Incase the router sets it back to unspecified.
Nathan Houghton [Sun, 10 Nov 2019 20:53:11 +0000 (20:53 +0000)]
OpenBSD: Support LINK_STATE_HALF_DUPLEX and LINK_STATE_FULL_DUPLEX
For if_msghdr messages from route(4).
Roy Marples [Sun, 10 Nov 2019 20:43:04 +0000 (20:43 +0000)]
IPv6ND: If a router is reachable again, don't solicit another.
Roy Marples [Sun, 10 Nov 2019 20:39:52 +0000 (20:39 +0000)]
RA: Warn if advertised MTU is greater than link MTU
Roy Marples [Sun, 10 Nov 2019 15:15:16 +0000 (15:15 +0000)]
BSD: Try and set linkmtu for the interface just to be nice.
If it fails, zero it out and try again - only the linkmtu should
fail really. This is fine as we fix it against the route itself.
Roy Marples [Sun, 10 Nov 2019 02:46:27 +0000 (02:46 +0000)]
OpenBSD: Fix prior - OS cannot set any RA bits such as hop limit.
Roy Marples [Sat, 9 Nov 2019 22:22:59 +0000 (22:22 +0000)]
BSD: strlcpy > strncpy
Roy Marples [Sat, 9 Nov 2019 22:22:28 +0000 (01:22 +0300)]
Solaris: Fix compile with prior
Roy Marples [Sat, 9 Nov 2019 22:14:28 +0000 (22:14 +0000)]
Linux: fix compile for prior
Roy Marples [Sat, 9 Nov 2019 22:03:19 +0000 (22:03 +0000)]
INET6: Apply hoplimit, reachable and retrans timer values from RA.
Only tested thus far on NetBSD.
While here, fix prior to not lose the first sorted route.
Roy Marples [Sat, 9 Nov 2019 14:37:54 +0000 (14:37 +0000)]
INET6: Sort routers when reachability changes
If unreachable, try and install a better default router.
Roy Marples [Wed, 6 Nov 2019 12:22:28 +0000 (12:22 +0000)]
script: Ensure pid is initialised.
Roy Marples [Tue, 5 Nov 2019 21:54:32 +0000 (21:54 +0000)]
DHCP: When rebinding ensure we have a DHCP ARP state
So we can defend the address.
Roy Marples [Tue, 5 Nov 2019 21:01:19 +0000 (21:01 +0000)]
Linux: rename _open_link_socket to if_linksocket
Roy Marples [Tue, 5 Nov 2019 17:18:02 +0000 (17:18 +0000)]
Linux: improve the netlink API more
By putting the callback arg with the callback function.
Roy Marples [Tue, 5 Nov 2019 16:23:02 +0000 (16:23 +0000)]
build: Improve detection of dlopen(3) in libdl
Roy Marples [Tue, 5 Nov 2019 16:22:39 +0000 (16:22 +0000)]
dev: remove pointless cast
Roy Marples [Tue, 5 Nov 2019 15:52:57 +0000 (15:52 +0000)]
INET: Fix corruption of IPv4 address flags when renewing
What a mistaka to maka!
Roy Marples [Tue, 5 Nov 2019 15:23:10 +0000 (15:23 +0000)]
Linux: always open a netlink socket when writing netlink messages
While here, bring some function names into the same style.
Roy Marples [Mon, 4 Nov 2019 20:21:30 +0000 (20:21 +0000)]
build: Improve import-src target
Incase a supposed source file file does not exist.
Roy Marples [Mon, 4 Nov 2019 20:02:36 +0000 (20:02 +0000)]
and more pretty
Roy Marples [Mon, 4 Nov 2019 19:56:32 +0000 (19:56 +0000)]
build: make prior output more pretty
Roy Marples [Mon, 4 Nov 2019 19:56:51 +0000 (19:56 +0000)]
build: Check compiler actually supports address sanitisation.
Roy Marples [Mon, 4 Nov 2019 17:21:33 +0000 (17:21 +0000)]
BSD: Disable kernel RTADV sysctl earlier
Just makes life a bit easier.
Roy Marples [Sun, 3 Nov 2019 23:24:09 +0000 (23:24 +0000)]
build: Enforce address sanitisaton when debugging.
Roy Marples [Sun, 3 Nov 2019 10:13:54 +0000 (10:13 +0000)]
dhcpcd: Set ctx.ifaces to NULL after freeing
Because they it might be used trying to find an interface to assign
our option routes to when freed if never used.
Roy Marples [Fri, 1 Nov 2019 23:34:37 +0000 (23:34 +0000)]
eloop: Fix a segfault if we free a NULL eloop
Roy Marples [Fri, 1 Nov 2019 23:29:06 +0000 (23:29 +0000)]
control: when closing, remove from eloop.
Roy Marples [Fri, 1 Nov 2019 22:30:33 +0000 (22:30 +0000)]
script: Improve API
Roy Marples [Fri, 25 Oct 2019 14:15:22 +0000 (15:15 +0100)]
DHCP6: Simplify opening the UDP port for all interfaces.
Roy Marples [Fri, 25 Oct 2019 14:04:12 +0000 (15:04 +0100)]
DHCP: Rework closing BPF and seeing if we need to open UDP
Just easier to read.
Roy Marples [Fri, 25 Oct 2019 13:44:23 +0000 (14:44 +0100)]
DHCP: Simplify opening the UDP port for all interfaces.
Roy Marples [Fri, 25 Oct 2019 12:32:38 +0000 (13:32 +0100)]
ARP: Add interface to arp_state
Simplifies the codes slightly and allows a backreference if
we need to pass the ARP state as a context.
Roy Marples [Fri, 25 Oct 2019 12:20:20 +0000 (13:20 +0100)]
Fix prior on other os
Roy Marples [Fri, 25 Oct 2019 12:18:39 +0000 (15:18 +0300)]
Solaris: Fix prior by receving IP6_PKTINFO