summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
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-20Always 'send' host-name, rather than relying on dhclient.conf to askKenneth R Westerback
for it. Removes the need to install a dhclient.conf for a default configuration. Install script simplification to follow. General enthusiasm. ok millert@ benno@ tom@ ian@
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.
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.