summaryrefslogtreecommitdiff
path: root/sbin/dhclient/clparse.c
AgeCommit message (Collapse)Author
2024-06-30delete dhclient(8). ipv4 dhcp leases have been acquired by theTheo de Raadt
always-running-in-background dhcpleased(8) for a while, which is activated per-interface with "ifconfig $if autoconf', or "ifconfig $if inet autoconf", or with "inet autoconf" in /etc/hostname.$if dhclient(8) has done execve(3) of ifconfig(8) to handle this for a while, so everyone has moved to the dhcpleased(8) method ok florian
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-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.
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-05-13Repair 'domain-search' parsing broken in r1.191.Kenneth R Westerback
2020-05-13We don't count a terminating NUL in the length of option data.Kenneth R Westerback
2020-05-13Nuke a variable that is always set to 0.Kenneth R Westerback
2020-05-13No need to memcpy() into a string created by strdup().Kenneth R Westerback
2020-02-02Tweak dhclient(8) timing defaults depending on SMALL rather than usingKenneth R Westerback
/dev/stdin to fake a dhclient.conf file during install. Simplifies and shortens install.sub code. Allows further restrictions to be applied to '-c' specified files.
2019-12-17Reject leases that do not provide a subnet mask for the address beingKenneth R Westerback
provided. Restores behaviour previously provided by the default dhclient.conf.
2019-07-23Compilers may not be as magical as I hope, so revert to using memcpy()Kenneth R Westerback
when treating various sized integers as arrays of bytes. Doubts expressed by kettenis@ on behalf of strict alignment architectures.
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-22Eliminate pointless "... else {}" branch to improve readability.Kenneth R Westerback
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-20Use same 'switch (token) ...' idiom in parse_lease_decl() andKenneth R Westerback
parse_conf_decl(). Smaller, less confusing. No intentional functional change.
2019-07-20Sort TOK_USELEASE case into proper alphabetic location inKenneth R Westerback
switch statement. Nuke TOK_LEASE handling (neutered since 2017) in config file.
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-06-29write_lease_db() only needs ifi->name and ifi->lease_db.Kenneth R Westerback
read_lease_db() can use a better param name (lease_db instead of tq). Makes the two more obviously related. No intentional functional change.
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-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-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-26Add 'uselease' statement to allow the disabling of built-in orKenneth R Westerback
previously specified 'append', 'default', 'ignore', 'prepend', or 'supersede' actions on the values provided in leases.
2019-01-18Oops. Nuke debug statement that snuck it.Kenneth R Westerback
2019-01-18Shuffle lease file reading code to improve clarity and shorten someKenneth R Westerback
lines. No intentional functional change.
2019-01-18Yet another long line broke cover.Kenneth R Westerback
2019-01-18Be consistent in explicitly testing memcmp() return values.Kenneth R Westerback
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-14Check NULLness of ignore list inside apply_ignore_list() and notKenneth R Westerback
before calling it.
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-13White space nits.Kenneth R Westerback
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.
2018-11-04No names in function prototypes. Spaces after commas inKenneth R Westerback
function prototypes.
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-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@
2018-01-05Complete and fix grammar in comments and bring grammar terms,Kenneth R Westerback
function names and function code into sync.
2018-01-04Compact some whitespace, unsplit now shorter lines.Kenneth R Westerback
2018-01-04Comments and grammar use '_decl' so use _decl instead of _declarationKenneth R Westerback
in the names of the respective parsing functions.
2018-01-04parse_lease_time() is an unnecessary abstraction. Just useKenneth R Westerback
parse_number('L') since it is parsing unsigned 32bit integers.
2018-01-04We only parse decimal numbers, so parse_decimal() -> parse_number() toKenneth R Westerback
match grammar comments and improve euphony.
2018-01-02More grammar comments improvements.Kenneth R Westerback
2018-01-01Tweak syntax comments into consistency and completeness.Kenneth R Westerback
2017-12-18Stop inserting and paying attention to 'interface <if>;'Kenneth R Westerback
inside 'lease {}' declarations. We don't keep leases from multiple interfaces in dhclient.leases.<if> files. One less thing to parse and keep in memory. More rope for those wanting to do unspeakable things with their lease files.
2017-12-17Further simplifY lease parsing. Fold add_lease() into read_lease_db(),Kenneth R Westerback
and move all lease parsing into parse_lease().
2017-12-16With leases no longer in dhclient.conf, rename a bunch ofKenneth R Westerback
functions and fields to more obvious names reflecting this separation.
2017-12-13Fix whitespace botch that snuck in.Kenneth R Westerback
2017-12-13Simplifiy parser by not worrying about nesting 'interface <if> {}'Kenneth R Westerback
statements. They are silly but harmless and work fine.