summaryrefslogtreecommitdiff
path: root/sbin/dhclient/clparse.c
AgeCommit message (Collapse)Author
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.
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-07Nuke support for defining last-gasp leases in dhclient.conf.Kenneth R Westerback
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-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-10-23Use 'for (;;)' instead of a mix of "while (1) {}" andKenneth R Westerback
"do {} while (1)".
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-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-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.
2017-10-11Tweak parse_decimal() and its invocations to emit aKenneth R Westerback
single error message ("expecting integer between x and y") and to properly handle ';' in error cases.
2017-10-10Tweak parse_boolean() to be more like its friends.Kenneth R Westerback
i.e. handle ';' better, and issue error message ("expecting boolean.") itself.
2017-10-09Tweak parse_lease_time() to emit a single message onKenneth R Westerback
failure ("expecting unsigned 32-bit decimal value") and to properly handle the terminating ';' in error situations. Make parse_lease_time() return an int to indicate success or failure as its friends do. Also avoid swapping endianess twice. Use == 1 vs != 0 when checking parse_ip_addr() return value.
2017-09-20Tweak, shorten, use more consistant verbiage.Kenneth R Westerback
2017-09-20Wrong captilization, long lines.Kenneth R Westerback
2017-09-17Create global 'log_procname' and set it to '<ifname>' orKenneth R Westerback
'<ifname> [priv]' as appropriate for the process doing the setting. Use it as the prefix in all log_*() output. Makes tracking messages for an interface or a process much easier.
2017-09-14Strive to rationalize fatal[x]() usage andKenneth R Westerback
verbiage.
2017-08-14Try for consistency in sizeof() usage.Kenneth R Westerback
No intentional functional change.
2017-07-14Replace remaining "!var" expressions withKenneth R Westerback
"<var> == 0", "!(<var> & FLAG)" with "(<var> & FLAG) == 0", "!<func()>" with "<func()> == 0" and "!<define>" with "<define> == 0". And the positive cases as well. A few stray == NULL and != NULL as well.
2017-07-14Replace remaining "!<pointer>" expressions withKenneth R Westerback
"<pointer> == NULL". And of course "<pointer>" expressions with "<pointer> != NULL".
2017-07-10Use a modern spacious idiom on all function local variableKenneth R Westerback
declarations.
2017-07-09Be consistent. "return (e);" -> "return e;"Kenneth R Westerback
2017-07-09Some parsing code cleanup: add parse_boolean(); pass literal formatKenneth R Westerback
chars to parse_decimal() instead of less obvious *fmt; refactor to eliminate need for the 'alloc:' and 'bad_flag:' labels and the invidious backwards goto's to them.