summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhcpd.h
AgeCommit message (Collapse)Author
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-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-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-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-06fatal() immediately whem parsing command line option '-c' reveals a non-existantKenneth R Westerback
file. Original diff, tweaks & ok kn@
2020-11-06Remove the -L option. A debugging tool that is no longer required.Kenneth R Westerback
man page and usage() tweaks from jmc@. ok lteo@
2020-05-21extract_classless_route() -> extract_route() as there is only the one routeKenneth R Westerback
extraction function.
2020-05-14Massage merge_option_data() to be more careful when dealing with 'D'Kenneth R Westerback
(domain search) and 't' (text) options. Enables append/prepend for the domain-search option by inserting blanks between the domains and ensures the presence of a terminating NUL when merging text.
2020-01-23Separate command line syntax parsing from semantic validation ofKenneth R Westerback
command line contents. Display usage() when syntax is incorrect and relevant error messages when semantic checks fail. More akin to the way other commands handle the syntax/semantic split. Idea taken from a larger diff by kn@. ok kn@
2019-11-22Polish logic talking to unwind.Kenneth R Westerback
ok florian@
2019-11-19Inform unwind about DNS servers it finds in leases.Kenneth R Westerback
ok florian@
2019-07-30Use AUTOCONF4 flag. Set the flag on startup. But if the flag isKenneth R Westerback
subsequently reset by ifconfig(8) then stop applying leases. If the flag is set after being reset then get a new lease and carry on. Clean up man page verbiage and add AUTOCONF4 description. ok benno@, man page formatting ok ingo@
2019-07-22Cleanup/simplify parse_number():Kenneth R Westerback
1) Restructure to explicitly set a long long result and take the desired low/high constraints for strtonum(). 2) No need to use a temporary variable when setting long long (a.k.a. time_t) fields. 3) Fewer magic numbers when processing integer valued option data. Less memcpy()'ing where a cast or two is sufficient to make integer assignment work. No intentional functional change.
2019-07-21Replace malloc()/memcpy() with strdup() in parse_string(). Nuke 'len' parameterKenneth R Westerback
to parse_string() in favour of taking strlen() of resulting string in the few cases that it is of interest.
2019-07-19Nuke a bunch of 'name' parameters that haven't been used sinceKenneth R Westerback
dhclient(8) stopped writing interface names in the leases file.
2019-05-22Don't get & apply a new lease for an RTM_IFINFO that reports a changeKenneth R Westerback
to the MTU of the interface. Such message are generated by the application of a lease containing interface-mtu, and thus caused a duplicate lease negotiation and application when that option was present. This rapid duplication confused Google Compute Engine. Noticed and fix tested by Greg Steuck. Also tested by Bj??rn Ketelaars to make sure Dutch Railways still worked. Thanks! ok claudio@
2019-04-02Add human readable parsing/display of RFC1035 data in domain-searchKenneth R Westerback
option. Replace handrolled dn_expand() with the system version. Existing hex octet versions still accepted. New format is option domain-search "my.domain.org", "fw.my.domain.org"; It is now possible to append and prepend domains to the list provided by the server. Documention update to dhcp-options(5) in the pipeline! Inspired by dhcpd(8) domain-search diff from William Ahern. Code peered at by florian@ and kn@.
2019-03-22Revert parts of recent changes to pretty_print_domain_search(). PartsKenneth R Westerback
of WIP escaped into the wild and broke parsing of domain-search. Reported by Greg Steuck and Raf Czlonka. Fix tested by Greg.
2019-03-20Do not accept dhclient.conf(5) "prepend" or "append" statements whenKenneth R Westerback
the option data cannot be prepended or appended to. Instead, treat "prepend" as "supersede" and "append" as "default". This preserves the safe aspects of current behaviour. Issue a parsing warning when appropriate to encourage people to fix their configuration files. Eliminate egregious repeated code by abstracting merge_option_data().
2019-03-18Use same idiom for pretty_print_domain_search() andKenneth R Westerback
pretty_print_classless_routes(), making both of them local to options.c. Avoids a double pretty print of DHO_DOMAIN_SEARCH, eliminates an unneeded 1024 byte static array. Shrinks size of upcoming diff to implement parsing of domain search option in leases and dhclient.conf.
2019-02-12Restructure code to simplifiy imsg communications, further separatingKenneth R Westerback
DHCP knowledge and interface manipulation. Unprivileged process now sends proposal derived from the accepted lease to the privileged process rather than individual interface manipulation requests. The only intended functional change is that /etc/resolv.conf.tail is not re-read each time a new proposal is implemented, rather than once at dhclient startup.
2019-01-26Rename ACTION_NONE to ACTION_USELEASE. TOK_NOACTION to TOK_USELEASE.Kenneth R Westerback
More consistent, clearer.
2019-01-19Since dhclient no longer tries to clean up when exiting, there is noKenneth R Westerback
need to start a new copy when LLADDR or SSID changes. Just go back to S_PREBOOT and get a new lease. Fewer log messages, faster join'ing new networks, simpler code.
2019-01-19Drop pseudo-signal idiom. Rename INTERNALSIG to TERMINATE. Use RESTARTKenneth R Westerback
instead of overloading SIGHUP.
2019-01-19'quit' is no longer set in a signal handler so it no longer needs toKenneth R Westerback
be sig_atomic_t. Plain int should be sufficient.
2019-01-14Make apply_ignore_list(), set_default_hostname(),Kenneth R Westerback
set_default_client_identifier() and read_resolv_conf_tail() local to clparse.c and just call them from read_conf().
2019-01-14Abstract allocation and initialization of config globalKenneth R Westerback
variable into init_config() and just call it from read_conf().
2019-01-14set_default_client_identifier() only needs theKenneth R Westerback
struct ether_addr (a.k.a. ifi->hw_address) rather than the entire struct interface_info.
2019-01-13Abstract /etc/resolv.conf.tail reading out of main()Kenneth R Westerback
and into a read_resolv_conf_tail() in clparse.c.
2019-01-13Shuffle apply_ignore_list(), set_default_client_identifier() andKenneth R Westerback
set_default_host_name() to clparse.c as they are part of config initialization. First step in cleanup of startup logic.
2019-01-05Simplify and clarify (i.e. shrink) code processingKenneth R Westerback
the bpf captures.
2019-01-03The need for separate bpf and routing message buffers was eliminatedKenneth R Westerback
when dhclient moved to processing the entire buffer rather than trying to process one packet per dispatch() loop. So use ifi->rbuf for both purposes, resizing it during initialization to accommodate the larger of the routing socket read size or the bpf socket read size. Eliminates a calloc()/free() per routing socket read.
2018-12-27Rename ufdesc to udpfd to make the code slightly more intuitive.Kenneth R Westerback
2018-12-27Rename routehandler() to routefd_handler() to make the code slightlyKenneth R Westerback
more intuitive.
2018-12-27Rename bfdesc to bpffd and packethandler() to bpffd_handler() to makeKenneth R Westerback
the code slightly more intuitive.
2018-11-11As get_hw_address() is called early and unconditionally setsKenneth R Westerback
VALID_LLADDR, there is longer much point to VALID_LLADDR. Nuke it. Just check for lladdr changes when LINK_STATUS_IS_UP().
2018-11-02When reacting to SIGHUP, i.e. trying to restart, ignore incomingKenneth R Westerback
packets, routing socket messages and cancel any pending protocol timeout. Since >1 packet can be received from bpf at a time, don't process any further buffered packets after one triggers a decision to exit or a signal is received.
2018-05-23Some interfaces (e.g. cdce(4)) can't tell if they are connected. TheyKenneth R Westerback
always report a link status of UNKNOWN. Do not use recorded leases to configure such interfaces. In such cases only use the address in the recorded lease to ask for a new lease. Avoids debilitating /etc/resolv.conf changes by unplugged higher priority interfaces given to the tender mercies of dhclient after a working interface has already set /etc/resolv.conf correctly. Reported for cdce(4) by guenther@ at p2k18.
2018-05-19Add '-r', which causes running dhclient to releaseKenneth R Westerback
lease and exit. Man page tweaks from jmc@. Request, tests & ok tb@. ok millert@ on previous version.
2018-02-28Now that log_debug() has been decyphered, replace DPRINTF() instancesKenneth R Westerback
with log_debug() so -v unleashes all debug output without having to compile a custom dhclient.
2018-02-10Fix 'ignore ;' so that it really does reset the ignore list.Kenneth R Westerback
Mkae 'ignore', 'request' and 'require' cumulative so all options don't have to be jammed into one line.
2018-02-07Keep track of the last proposal used to configure the interface andKenneth R Westerback
compare that to the offered proposal to determine if there are any changes to configure. Simpler, and fixes issue where using a recorded lease meant the interface was continually being configured with the same information.
2018-02-06Nuke unused state S_REBINDING. We just use the timeKenneth R Westerback
to decide between unicast and broadcast for REQUEST.
2018-02-06Flip -q (be quiet) into -v (be noisy), making terseness the defaultKenneth R Westerback
behaviour. Always go daemon after link_timeout seconds and complete lease negotiations in the background if necessary. No hanging around in the foreground for the full 64 seconds waiting for a server to appear. Log a more relevant message when a default route can't be obtained via RTM_GET. i.e. "no default route" rather than "No such process". -q -> -v ok mpi@