summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
2017-12-09Add ACTION_IGNORE and nuke ignored_options, ignored_option_count fieldsKenneth R Westerback
in struct client_config.
2017-12-08When accepting a BOOTP lease, do not leak offered values of leaseKenneth R Westerback
time, renewal time, rebinding time. Use the ACTION_DEFAULT mechanism to set the default expiry time for any lease so gauche as to not provide one. Use the DHCP default lease times for BOOTP leases instead of, bizarrely, shorter times.
2017-12-07adjust the "timeout" text, now that leases are no longerJason McIntyre
specified in dhclient.conf; ok krw
2017-12-07Set ifi->offer to NULL after free'ing it.Kenneth R Westerback
2017-12-07Nuke support for defining last-gasp leases in dhclient.conf.Kenneth R Westerback
2017-12-06Disentangle dhclient.conf static lease handling from dynamicKenneth R Westerback
lease handling. Simplifies code and makes it easier to consider excising this 'feature'.
2017-12-05When removing duplicate dynamic leases from the cache, compare theKenneth R Westerback
SSID against ifi->ssid, not the SSID of the new lease. They should be the same, but this makes the intent clearer and removes an assumption about the contents of ifi->active.
2017-12-04change "if (lp &&" to "if lp != NULL &&".Theo Buehler
pointed out by krw
2017-12-04Avoid a NULL-deref in get_recorded_lease() leading to a segfault seenTheo Buehler
by aja and others. ok krw
2017-12-03Move timer fields 'expiry" and "rebind" out of struct client_leaseKenneth R Westerback
and into struct interface_info. Nuke set_lease_times().
2017-12-03Abandon nagging about "_" violating RFC 952. This removes the needKenneth R Westerback
for a custom res_hnok(), so just use the libc version of res_hnok(). Requested by deraadt@
2017-11-27Simplify lease_as_string() logic to use a single time_t variableKenneth R Westerback
and lease_[expiry|rebind|renewal]() functions.
2017-11-27Fix pasto so lease_rebind() returns rebind value and notKenneth R Westerback
renewal value.
2017-11-26Move rebind time calculation to a function lease_rebind(), just likeKenneth R Westerback
lease_expiry() and lease_renewal(). Simplifies logic and upcoming changes.
2017-11-24Remove 'renewal' field from struct client_lease. Add lease_renewal() toKenneth R Westerback
calculate the value when required for a particular lease.
2017-11-23Fix use of lease_expiry() in set_lease_times(). lease_expiry() returnsKenneth R Westerback
wall clock time, not length of lease time.
2017-11-20Wnen purging dhclient.leases and when looking for unexpired offers toKenneth R Westerback
use, always recalculate offer expiry time based on the information in the original offer.
2017-11-18Generate correct time comments (renewal/rebind/expiry) inKenneth R Westerback
dhclient.leases and the 'offered' lease generated by -L. i.e. the times contained in the actual offer, and not the 'effective' times that reflect changes imposed by dhclient.conf or -i.
2017-11-14Treat invalid server name as empty instead of declining the lease offeredMartin Pieuchot
by such misconfigured DHCP servers. Original diff from and ok krw@, ok sthen@
2017-11-12Clone epoch value in clone_lease(), not manually.Kenneth R Westerback
2017-11-09tweak previous;Jason McIntyre
2017-11-09Use lease 'epoch' (time lease was acquired) to calculate timers forKenneth R Westerback
renew/rebind/expiry. Treat renew/rebind/expiry statements in leases as comments for human consumption.
2017-11-06Add lease declaration 'epoch' to hold the time() when a lease isKenneth R Westerback
received. Set it in packet_to_lease() and preserve it in apply_defaults(). Otherwise not used, documented or printed in lease database yet.
2017-11-06Add format 't' to parse_decimal() for signed 64-bitKenneth R Westerback
integers.
2017-11-04Decline duplicate offers for the requested address, as areKenneth R Westerback
duplicate offers for other addresses, so that the fastest responding and presumably 'closest' DHCP server is used.
2017-10-30Fix '-L' file handling. Mixing idioms in previous cleanups ended upKenneth R Westerback
fopen()'ing the the file with a mode of "a" (so watchers don't detect changes until the file is re-written as part of interface configuration) but using rewind() to start writing from the beginning of the file. Use ftruncate() and overwrite the date as intended, rather than appending new data. Problem reported and diffs tested by Mike via tech@. Thanks!
2017-10-27zap a bad space in usage(): sorry ken for not spotting!Jason McIntyre
2017-10-27Add '-n' option to just parse dhclient.conf for errors.Kenneth R Westerback
ok jmc@ tb@
2017-10-23Use 'for (;;)' instead of a mix of "while (1) {}" andKenneth R Westerback
"do {} while (1)".
2017-10-23Use same parse_warn() verbiage in parse_lease_time() as thatKenneth R Westerback
emitted when other unsigned 32-bit values are parsed. i.e. "expecting integer between 0 and 4294967295". No need to make people google what "unsigned 32-bit decimal value" means.
2017-10-23Enforce dhclient.conf prohibitions on nesting 'interface'Kenneth R Westerback
declarations and placing 'lease' declarations inside 'interface' declarations. Document and enforce requirement that all 'lease' declarations must specify the interface to which they apply. Ignore static leases that apply to other interfaces rather than complaining the interface name is wrong and using the lease anyway.
2017-10-21Last but not least, bring parse_interface_declaration()Kenneth R Westerback
into the 0/1 for success world.
2017-10-21Whitespace.Kenneth R Westerback
2017-10-21Bring parse_client_lease_statement() into the new world byKenneth R Westerback
return 0/1 for success.
2017-10-20prev_line and cur_line can be static.Kenneth R Westerback
2017-10-20Split eol() from get_char() so that token assmebly that isKenneth R Westerback
terminated by a '\n' can generate error messages pointing at the offending token, rather than pointing at a blank line.
2017-10-20Flense dhclient.conf.5 down to useful information. MoveKenneth R Westerback
description of "lease {}" format to dhlcient.leases.5. Neither implement standards so coalesce STANDARDS sections into dhclient.8. AUTHOR and HISTORY sections not normally used for .conf man pages so drop them. Many tweaks. Language/formatting suggestions, stamp of approved by jmc@.
2017-10-19Nuke special case for '\n' in skip_to_semi() andKenneth R Westerback
associated weird comment about parsing resolv.conf. dhclient.conf and dhclient.leases.<if> are semi-colon oriented and not line oriented. '\n' is never returned by get_token().
2017-10-16Sort & update syntax comments to match code. SortKenneth R Westerback
TOK_* case:'s alphabetically to make it easier to find things.
2017-10-16Bring parse_reject_statement() into line byKenneth R Westerback
returning 0/1 for success, etc. Simplify it by only supporting a single ip address per statement, as dhclient.conf(5) states. Don't add duplicate addresses to the reject list.
2017-10-14Whitespace fix.Kenneth R Westerback
2017-10-14Refactor parsing of hex sequences. Rename parse_X()Kenneth R Westerback
to parse_hex_octets() and have it return 0/1 to indicate success, to not touch existing data on error paths, to handle ';' better, emit single error message ("expecting colon delimited list of hex octets."). Fold parse_hex() into parse_hex_octets(). Simplify logic in parse_option_decl() to eliminate duplicate overflow error checking and error messages as a result.
2017-10-14Tweak parse_option_list() to return 0/1 to indicate success,Kenneth R Westerback
to not touch existing data on error paths, to handle ';' better, emit single error message ("expecting comma delimited list of option names.").
2017-10-13Tweak parse_option_decl() to return 0/1 to indicate success,Kenneth R Westerback
to not touch existing data on error paths, to handle ';' better.
2017-10-12Don't leak string that overflows the option data buffer.Kenneth R Westerback
2017-10-12Stop leaks of SSID strings. Whitespace fix.Kenneth R Westerback
2017-10-12Make parse_string() toe the new line by returningKenneth R Westerback
0 for failure, 1 for success, emitting a single error message ("expecting string.") and handling ';' better. Don't leak memory when encountering pathological config or lease files containing repeated instances of an option or command with string data.
2017-10-11Works better when both files in a diff areKenneth R Westerback
committed.
2017-10-11Eliminate unneeded intermediate variable. FixKenneth R Westerback
some 'return;'s that should be 'break;'s.
2017-10-11Tweak parse_date() again, this time to factorKenneth R Westerback
code in the same way as the other parse_*() functions. Whitespace fix in comment while passing. Also conform to idiom that original data is not changed in the error path.