summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
2022-07-02dhclient(8) has been undergoing replacement with "ifconfig xxx inet auto"Theo de Raadt
for a couple of years, backed by dhcpleased(8), which provides much better dns handling. The next step is to make the dhclient simply execve ifconfig in that way, and provide syslog warnings about deprecated options along the way. This way, we can find the last few dhclient users, and what they are missing. ok florian krw
2022-05-16Remove incorrect line about 'dhcp' in hostname.if triggering the use ofAaron Bieber
dhclient. OK tb, kettenis
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2021-12-13including sys/cdefs.h manually started as a result of netbsd trying toTheo de Raadt
macro-build a replacement for sccsid, and was done without any concern for namespace damage. Unfortunately this practice started infecting other code as others were unaware they didn't need the file. ok millert guenther
2021-10-24For open/openat, if the flags parameter does not contain O_CREAT, theTheo de Raadt
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
2021-08-25Don't use log_procname before it is initialized. In particularKenneth R Westerback
set_iff_up() is called from initialize_interface() and was using log_procname instead of ifi->name in its fatal()'s. Diagnosed by tb@ from a recent reddit post by zielonykid1234.
2021-08-24use Pa for resolv.conf.tail, since there is no longer a man pageJason McIntyre
to Xr;
2021-07-27Having 'taken charge' of the interface by eliminating otherKenneth R Westerback
dhclient instances for the interface, check if the IPv4 AUTOCONF flag is set. If it is, go quietly into that good night and let dhcpleased do its thing, comforted by the fact that dhcpleased knows that a new lease has been requested. requested, tested & ok florian@
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
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@
2021-05-02Shuffle some code to eliminate get_address(), bring interface_state() andKenneth R Westerback
initialize_interface() logic into closer alignment, and try harder to initialize link_state at start up.
2021-04-07"oldlladddr" -> "oldlladdr" in fatal() verbiage.Kenneth R Westerback
2021-04-01Tweak log_debug() verbiage to reduce repetitive infoKenneth R Westerback
(ACK/NAK), add details (DISCOVER/REQUEST) and provide before/after info for SSID/LLADDR/MTU changes.
2021-04-01Also immediately accept the *first* OFFER if it matches the requested address,Kenneth R Westerback
rather than waiting for select_timeout to expire before accepting the same OFFER.
2021-03-31Set 'select_timeout' to 'now' when an OFFER is received for the IP addressKenneth R Westerback
requested in the DISCOVER. i.e. immediately accept the OFFER rather than waiting for select_timeout to expire before accepting the same OFFER. A corner case since select-timeout is 0 by default.
2021-03-31Add two missing checks for strdup() returning NULL.Kenneth R Westerback
2021-03-31Fix some debug output when running in foreground.Kenneth R Westerback
Call tick_msg() at startup so it knows if the link is up. Don't emit 'link timeout expired' messages after the link has been up.
2021-03-28Now that the real time and monotonic time streams don'tKenneth R Westerback
cross flip CLOCK_REALTIME to CLOCK_MONOTONIC. Suggested by cheloha@, millert@, otto@ at various stages in the time_t -> timespec conversion.
2021-03-28Convert remaining timers (lease renew, rebind, expiry) toKenneth R Westerback
timespec values. Translate from the epoch values in leases to timespec values in one place. Final step to allow CLOCK_REALTIME -> CLOCK_MONOTONIC time accounting for the active lease.
2021-03-24More timespec conversions. Less 'seconds' arithmetic.Kenneth R Westerback
2021-03-16Nuke unused time_t variable.Kenneth R Westerback
2021-03-11Use timespec timers to determine when select-timeout and timeout intervalsKenneth R Westerback
are exceeded. Feedback from otto@, cheloha@
2021-03-09Replace time_t startup_time with struct timespec link_timeout.Kenneth R Westerback
Feedback from otto@
2021-03-04Add sys/queue.h to the include list since imsg.h needs it. CurrentlyClaudio Jeker
net/route.h pulls this is as a side-effect. OK krw@
2021-03-04Notice when link-timeout expires even if istty(STDERR) hints that dhclient hasKenneth R Westerback
already gone daemon. Sometimes it's just that 2>/dev/null or something has been done. Should fix problem with sysupgrade when an interface (e.g. a wired interface that has no cable plugged in) never comes up. Problem reported and debug info from kettenis@, Jean-Philippe Luigi, Thomas L. and Markus Lude. Thanks!
2021-03-02Rename local variable 'cur_time' in set_timeout() to 'now' likeKenneth R Westerback
all the other struct timespec variables holding the current time.
2021-03-02Eliminate redundant checks for expired leases in ifi->leasedb. SimplyKenneth R Westerback
toss expired leases when writing the list to disk. And write the list to disk before using a lease from it. Just make sure ifi->active isn't tossed.
2021-02-28Move tick_msg(TICK_WAIT) calls after related log_debug()Kenneth R Westerback
calls to avoid losing those debug messages if tick_msg() notices link-timeout has expired and daemonizes dhclient.
2021-02-28Reduce non-debug output further by allowing up to the usual 3 secondKenneth R Westerback
grace period of silence before emitting "<if>: no lease...", even if the link has taken a few secocnds to come up. 'link-timoeut' remains the hard deadline for going daemon.
2021-02-27Stop checking 'epoch' in get_recorded_lease() and just set it asKenneth R Westerback
required in read_lease_db(). It's already set in packet_to_lease() and thus both paths to TAILQ_INSERT(lease_db) ensure there is a non-zero epoch in all lease_db entries.
2021-02-27Disentangle log_debug() output from tick_msg() output.Kenneth R Westerback
Simplifies -v output, and reduces non-'-v' output. Reduce non-'-v' output further by only displaying the first 'link up' event. Restore behaviour specified in dhclient.conf(5) of going daemon after link-timeout seconds, rather than waiting another link-timeout seconds for a lease to be accepted. Lease verbiage problem reported, and fix tested by Mihai Popescu. Thanks! Link verbiage problems reported, fix tested & ok tb@.
2021-02-24Complete deleting ifi->active before calling write_lease_db().Kenneth R Westerback
No functional change but a bit more obvious and shrinks upcoming diff.
2021-02-24No need to get time() twice. Just use the alreadyKenneth R Westerback
obtained cur_time to initialize a missing lease->epoch.
2021-02-24No need to check ifi->active for NULL when looking for duplicate/obsoleteKenneth R Westerback
leases. It can't be NULL, and is unconditionally dereferenced a few lines later anyway.
2021-02-24Fix annoying typo in a comment.Kenneth R Westerback
2021-02-24Remove incomplete/incorrect connection with autoconf, clearing groundKenneth R Westerback
for future attempts at making it more IPv6-like. ok florian@
2021-02-22remove unused decode_hw_header() functionJonathan Gray
ok krw@
2021-02-22Switch reboot timing to timespec, the better to handle theKenneth R Westerback
default reboot interval of 1 sec. Gives the DHCP server a fairer shot at replying before the timeout expires. ok millert@
2021-02-21Rename struct client_config fields 'timeout', 'link_timeout' andKenneth R Westerback
'reboot_timeout' to 'offer_interval', 'link_interval' and 'reboot_interval' to be consistant with other '_interval' fields that specify a number of seconds to wait.
2021-02-21No need for state_preboot() to double check timeout beingKenneth R Westerback
tracked in tick_msg() and explicitly calling tick_msg(TICK_SLEEP). One fewer use of each of time(), ifi->startup_time and config->link_timeout. Makes code easier to follow. No intentional functional change.
2021-02-20tick_msg("lease", TICK_SUCCESS) in bind_lease() should *not* beKenneth R Westerback
invoked when log_getverbose() returns 0.
2021-02-19Put duplicated code calculating backoff interval and packet 'secs'Kenneth R Westerback
into new set_interval()/set_secs() functions. send_request() and send_discover() become much easier to understand. No intentional functional change.
2021-02-19Missed poll -> ppoll in log_warn() verbiage.Kenneth R Westerback
2021-02-15Extraneous blank line.Kenneth R Westerback
2021-02-15Rework tick_msg() to make messages displayed during startup moreKenneth R Westerback
reliable and consistant. Eliminate unused time_t parameter since we only tick during the first link_timeout seconds. Replace it with 'action' parameter to clearly indicated what tick_msg() is supposed to do. Fix issuance of '\n' before log_debug() messages. Properly reinitialize static variables. Use more precise 'timespec' timers, hewing to idiom suggested by cheloha@.
2021-02-02dhclient(8): fork_privchld, take_charge, propose_release: poll(2) -> ppoll(2)cheloha
Switch from poll(2) to ppoll(2) in a few more functions. Because we're working with ppoll(2) and clock_gettime(2) it is easier to encode the various timeouts as static const timespecs instead of preprocessor macros. This way we aren't packing timespecs in the middle of the code, which distracts from the (more important) logic of what the code is doing. Part of a larger campaign improve "time stuff" in dhclient(8). Prompted by and discussed with krw@. Based on a diff by krw@. ok krw@
2021-02-01dhclient(8): default_route_index(): poll(2) -> ppoll(2)cheloha
Use ppoll(2) instead of poll(2) in default_route_index(). Using ppoll(2) here forces us to use clock_gettime(2) to measure the timeout, which is less error-prone than using time(3). Part of a larger campaign in dhclient(8) to make "time stuff" more accurate and robust. Prompted by krw@. Based on a diff from krw@. ok krw@
2021-02-01Switch dispatch loop to ppoll() and protocol timeouts to struct timespec.Kenneth R Westerback
Reduces spurious packet transmissions in situations with short timings. Suggestions millert@, further suggestions & ok cheloha@
2020-12-10Simplify '-i' handling, failing immediately during command line parsingKenneth R Westerback
when an invalid option name is encountered.
2020-12-06Oops. Missed chunk in previous.Kenneth R Westerback
fatal() immediately whem parsing command line option '-c' reveals a non-existant file. Original diff, tweaks & ok kn@
2020-12-06fatal() immediately whem parsing command line option '-c' reveals a non-existantKenneth R Westerback
file. Original diff, tweaks & ok kn@