Up to [local] / src / sbin / dhcpleased
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.30 / (download) - annotate - [select for diffs], Tue Oct 10 16:09:53 2023 UTC (7 months, 3 weeks ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5,
HEAD
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)
Do not copy stack garbage, that's not going to be used. Pointed out by gcc via tb. rdns_count is validated by all callers of propose_rdns(), so we can trust it here to be sensible. While here fix a pasto in an error message. OK tb
Revision 1.29 / (download) - annotate - [select for diffs], Wed Feb 15 13:47:00 2023 UTC (15 months, 2 weeks ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE,
OPENBSD_7_4,
OPENBSD_7_3_BASE,
OPENBSD_7_3
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)
Use correct order of arguments for shutdown(2). Luckily routesock would never be <= 2 so shutdown would always failing with EINVAL and not shutting down random other sockets. The kernel was just uselessly piling up route messages that we were never reading. This mistake first showed up in slaacd(8) and then was copied to the other daemons. Reported & fixed by Josiah Frentsos (jfrent at tilde.team), thanks! OK kn
Revision 1.28 / (download) - annotate - [select for diffs], Sun Dec 11 10:47:37 2022 UTC (17 months, 3 weeks ago) by otto
Branch: MAIN
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored)
Balance a getifaddrs() with a freeifaddrs(); plugs a leak seen by florian@ and myself. ok florian@
Revision 1.27 / (download) - annotate - [select for diffs], Sun Nov 27 15:19:38 2022 UTC (18 months ago) by kn
Branch: MAIN
Changes since 1.26: +6 -3 lines
Diff to previous 1.26 (colored)
Provide more accurate lock error message When started manuall from single-user mode (/ still read-only), the current error is misleading: # slaacd -dv slaacd: already running The lock was specifically added to prevent multiple instances in the installer, which discards the error message entirely anyway. Retain the useful EAGAIN/"already running" message, but otherwise print the real error reason: # slaacd -dv slaacd: /dev/slaacd.lock: Read-only file system Feedback OK deraadt millert
Revision 1.26 / (download) - annotate - [select for diffs], Sat Jul 23 09:33:18 2022 UTC (22 months, 1 week ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE,
OPENBSD_7_2
Changes since 1.25: +15 -1 lines
Diff to previous 1.25 (colored)
Let the kernel delete the (default) route when we deconfigure the interface. This works around a problem where the kernel always deletes the first default route if there are multiple present with the same gateway. This only fixes the problem when running ifconfig inet -autoconf. There are other cases where we call configure_rotures(RTM_DELETE), for example when setting ignore routes in dhcpleased.conf and issuing a reload. To fix that we either need help from the kernel to distinguish routes by IFP or track priorities and hope they are unique. Problem reported by mbuhl. OK claudio
Revision 1.25 / (download) - annotate - [select for diffs], Sat Jul 23 09:29:20 2022 UTC (22 months, 1 week ago) by florian
Branch: MAIN
Changes since 1.24: +20 -3 lines
Diff to previous 1.24 (colored)
Send an IFP to distinguish (default) routes over different interfaces to the same gateway. Unfortunately this doesn't help with deleting the correct route when issuing ifconfig inet -autoconf, the kernel always deletes the first route. This is the one with the lowest priority if the routes have different priorities. What does work is identifying routes by priority but dhcpleased(8) doesn't set the priority so that the kernel choses the right one when adding a route and it doesn't yet track the priority the kernel set. Another issue is that we might end up with routes having the same gateway and same priority pointing out of different interfaces. For example when two ethernet interfaces are set to autoconf and they are connected to the layer 2 network. This seems like a bad idea but it is something that could be configured. Problem reported by mbuhl, claudio suggested to try to send an IFP. Even though it doesn't work, it seems worthwhile to send the IFP for when the kernel gains the ability to distinguish routes by IFP.
Revision 1.24 / (download) - annotate - [select for diffs], Mon Mar 21 04:35:41 2022 UTC (2 years, 2 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE,
OPENBSD_7_1
Changes since 1.23: +5 -9 lines
Diff to previous 1.23 (colored)
default the conffile variable to the default file name instead of NULL. this avoids having to test for NULL and swap the right name in place in a bunch of places. it also avoids having NULL passed to format strings in the parser. the only place where it actually matters if we're using the default or not is when we're parsing the config. if you don't specify a config, and the default file doesnt exist, that's ok. ok florian@
Revision 1.23 / (download) - annotate - [select for diffs], Tue Jan 4 06:20:37 2022 UTC (2 years, 4 months ago) by florian
Branch: MAIN
Changes since 1.22: +5 -1 lines
Diff to previous 1.22 (colored)
Make host name DHCP option configurable. Diff from hagen@sdf.org, tweaks by me. OK phessler testing & OK bket
Revision 1.22 / (download) - annotate - [select for diffs], Mon Dec 13 11:02:26 2021 UTC (2 years, 5 months ago) by florian
Branch: MAIN
Changes since 1.21: +12 -15 lines
Diff to previous 1.21 (colored)
Replace struct member assignment with struct assignment to make the code more compact. No binary change. OK claudio
Revision 1.21 / (download) - annotate - [select for diffs], Thu Sep 16 13:36:52 2021 UTC (2 years, 8 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE,
OPENBSD_7_0
Changes since 1.20: +6 -4 lines
Diff to previous 1.20 (colored)
dhcpleased(8) does not (yet?) track if routes it added are deleted behind its back. When a lease gets renewed dhcpleased simply adds all routes and lets the kernel sort duplicates out. This however leads to "failed to send route message: File exists" messages in /var/log/daemon which are confusing. Since this is expected do not log it as an error. While here change the error message when proposing nameservers so that it can be distinguished from failed routes. Pointed out by deraadt
Revision 1.20 / (download) - annotate - [select for diffs], Tue Aug 24 14:54:02 2021 UTC (2 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.19: +3 -2 lines
Diff to previous 1.19 (colored)
When an interface disappears, e.g. when a usb dongle gets unplugged, we get a RTM_IFANNOUNCE message not a RTM_IFINFO message. Handle this message to not accumulate "unknown" interfaces. OK benno
Revision 1.19 / (download) - annotate - [select for diffs], Thu Aug 12 12:41:08 2021 UTC (2 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.18: +15 -1 lines
Diff to previous 1.18 (colored)
Make it possible to ignore routes or nameservers from a lease as well as ignoring servers entirely. Tested by bket Parser looks reasonable to benno man page OK jmc
Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 26 09:26:36 2021 UTC (2 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.17: +158 -6 lines
Diff to previous 1.17 (colored)
Implement possibility to send vendor class identifier (option 60) and client identifier (option 61). Some dhcp servers expect these options and refuse to hand out a lease without them. Need for vendor class identifier pointed out & tested by bket Need for client identifier pointed out by sthen Input & reads OK sthen (as part of a larger diff) OK kn (as part of a larger diff)
Revision 1.17 / (download) - annotate - [select for diffs], Mon Jul 26 09:22:00 2021 UTC (2 years, 10 months ago) by florian
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)
The SIOCAIFADDR ioctl could lose a race against another process configuring the same IP. Found the hard way by afresh1
Revision 1.16 / (download) - annotate - [select for diffs], Thu Jul 22 18:01:29 2021 UTC (2 years, 10 months ago) by stsp
Branch: MAIN
Changes since 1.15: +4 -4 lines
Diff to previous 1.15 (colored)
Make dhcpleased(8) always configure provided routes, regardless of whether the address we received in our lease is already configured. In the case I observed, no default route was added to the routing table even though the server provided both an address and a route option. As it happened the leased address was already configured on the interface. This should not prevent routing table updates, but it did. ok florian
Revision 1.15 / (download) - annotate - [select for diffs], Wed Jul 21 03:53:50 2021 UTC (2 years, 10 months ago) by kn
Branch: MAIN
Changes since 1.14: +6 -2 lines
Diff to previous 1.14 (colored)
Use exclusive lock under /dev/, silence expected errors in installer resolvd(8), slaacd(8) and dhcpleased(8) are different from other daemons in that there must only be a single instance. resolvd already does this, adjust slaacd and dhcpleased accordingly while moving the lockfile paths under /dev/ such that they work early on boot and don't run into races should /var be (un)mounted between daemon starts. Locking is especially required in the installer where all three daemons are started every time the "(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? " prompt is entered, i.e. restarting installation or dropping into a shell and back into the prompt again would start multiple instances. To avoid expected lockfile error messages in between installer prompts, discard standard error when starting the autoconf daemons; none of them has other potential failure cases in installer mode before daemon(3)izing. Input sthen deraadt OK deraadt
Revision 1.14 / (download) - annotate - [select for diffs], Mon Jul 12 15:09:18 2021 UTC (2 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)
Change the error reporting pattern throughout the tree when unveil fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
Revision 1.13 / (download) - annotate - [select for diffs], Sun Jun 20 08:31:45 2021 UTC (2 years, 11 months ago) by florian
Branch: MAIN
Changes since 1.12: +20 -6 lines
Diff to previous 1.12 (colored)
Put (boot) filename, next-server, host-name and domain-name into lease file for the installer.
Revision 1.12 / (download) - annotate - [select for diffs], Wed Jun 16 14:06:17 2021 UTC (2 years, 11 months ago) by florian
Branch: MAIN
Changes since 1.11: +116 -49 lines
Diff to previous 1.11 (colored)
Implement classless static routes dhcp option. For this we need to be able to handle multiple routes being sent from the engine to the main process as well as to the control tool. The configuration of the various cases (default route, directly connected routes, non-default route via a gateway) was inspired by dhclient's set_routes() and should behave the same way. Tested by Uwe Werler
Revision 1.11 / (download) - annotate - [select for diffs], Sat May 1 11:52:36 2021 UTC (3 years, 1 month ago) by florian
Branch: MAIN
Changes since 1.10: +4 -3 lines
Diff to previous 1.10 (colored)
In singel user mode / is mounted ro. Just warn if we can't create the control socket instead of fatal(). OK deraadt
Revision 1.10 / (download) - annotate - [select for diffs], Wed Apr 14 23:35:24 2021 UTC (3 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE,
OPENBSD_6_9
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)
my fingers cannot avoid KNF'ing as I review code
Revision 1.9 / (download) - annotate - [select for diffs], Sat Mar 27 18:10:38 2021 UTC (3 years, 2 months ago) by florian
Branch: MAIN
Changes since 1.8: +19 -4 lines
Diff to previous 1.8 (colored)
If we want to configure default routes over multiple interfaces we need to provide the address of the interface behind which the default router is in case they are on the same subnet otherwise the kernel can't figure out which route we are talking about This happens for example when your wifi and wired networks are bridged. Pointed out by claudio some time ago.
Revision 1.8 / (download) - annotate - [select for diffs], Tue Mar 16 17:39:15 2021 UTC (3 years, 2 months ago) by florian
Branch: MAIN
Changes since 1.7: +2 -3 lines
Diff to previous 1.7 (colored)
We can't learn anything interesting from RTM_NEWADDR, stop handling it.
Revision 1.7 / (download) - annotate - [select for diffs], Sun Mar 7 18:39:11 2021 UTC (3 years, 2 months ago) by florian
Branch: MAIN
Changes since 1.6: +8 -11 lines
Diff to previous 1.6 (colored)
Reduce debug logging by moving protocol level debug log behind -vv or by deleting unneeded output. While here reword some debug output to make it more useful. (There is more to be done here.)
Revision 1.6 / (download) - annotate - [select for diffs], Tue Mar 2 12:03:50 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Changes since 1.5: +12 -4 lines
Diff to previous 1.5 (colored)
Make unveiling the lease directory a warning instead of a fatal error when the lease directory does not exist. This means that dhcpleased(8) will no longer request a previously configured IP address from the dhcp server and will fall back to DHCPDISCOVER which requests any IP address from the dhcp server. This likely makes diskless(8) work with dhcpleased(8). A normal diskless(8) setup has only / mounted via nfs when dhcpleased(8) starts. /var exists but nothing is mounted there yet, meaning /var/db/dhcpleased does not exist so lease files are disabled. dhcpleased(8) sends a DHCPDISCOVER to request any IP address but since the dhcp server has (very likely) a 'fixed-address' configured we get the same IP back that is already configured. If /var/db/dhcpleased/ exists on / (and /var is *NOT* mounted later) in a diskless(8) setup, care must be taken that the root file system is not shared between machines. If /var/db/dhcpleased/ exists on / and /var on NFS is mounted over this later bad things probably happen. This is a configuration error and must befixed. discussed with deraadt@ Actuall tests on existing diskless(8) setups would be appreciated.
Revision 1.5 / (download) - annotate - [select for diffs], Tue Mar 2 12:01:39 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Changes since 1.4: +4 -4 lines
Diff to previous 1.4 (colored)
Better unveil error messages; requested by deraadt some time ago.
Revision 1.4 / (download) - annotate - [select for diffs], Sat Feb 27 17:53:23 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Changes since 1.3: +5 -2 lines
Diff to previous 1.3 (colored)
Restore ability to handle default routes on multiple interfaces, this got lost shortly before initial import. While here explicitly delete the default route when deconfiguring an interface. There might be corner cases where the stack will not tear it down for us when we remove the IP address.
Revision 1.3 / (download) - annotate - [select for diffs], Sat Feb 27 10:21:08 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Changes since 1.2: +8 -8 lines
Diff to previous 1.2 (colored)
Path #defines are traditionally prefixed with _PATH. pointed out by deraadt
Revision 1.2 / (download) - annotate - [select for diffs], Sat Feb 27 10:07:41 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Changes since 1.1: +21 -13 lines
Diff to previous 1.1 (colored)
Read the lease file into a statically sized buffer and pass it over to the engine process for parsing instead of passing an fd. Let's us tighten the engine's pledge back down to "stdio".
Revision 1.1 / (download) - annotate - [select for diffs], Fri Feb 26 16:16:37 2021 UTC (3 years, 3 months ago) by florian
Branch: MAIN
Import dhcpleased(8) - a dhcp daemon to acquire IPv4 address leases from servers. dhcpleased(8) follows the well known three process design of all our privsep daemons. It uses pledge(2) and unveil(2) to restrict access further. In particular the "engine" process, responsible for parsing of untrusted data, is pledge'd "stdio". It cannot access the outside world nor the filesystem at all. Like slaacd(8) for IPv6 it will be always running and acquire addresses for all interface with the autoconf4 flag set. The flag can be set by "ifconfig $if inet autoconf" or by adding "inet autoconf" to /etc/hostname.if. An existing "dhcp" line should be removed. Various iterations tested by deraadt@ The hardest part, finding a name, was handled by jmatthew@ & otto@ "get to it :)" deraadt@