summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhcpd.h
AgeCommit message (Collapse)Author
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.
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-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-09Add ACTION_IGNORE and nuke ignored_options, ignored_option_count fieldsKenneth R Westerback
in struct client_config.
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-03Move timer fields 'expiry" and "rebind" out of struct client_leaseKenneth R Westerback
and into struct interface_info. Nuke set_lease_times().
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-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-27Add '-n' option to just parse dhclient.conf for errors.Kenneth R Westerback
ok jmc@ tb@
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-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-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-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-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-20Make send_packet() log entries more informative byKenneth R Westerback
providing the name of the packet type that causes an error.
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-09Tweak extract_classless_route() to return unsigned intKenneth R Westerback
and accept NULL pointers for unwanted components of the route.
2017-08-29Add a utility function extract_classless_route() andKenneth R Westerback
use it to simplify logic at both places that process RFC 3442 data.
2017-08-28No need for pretty_print_classless() to useKenneth R Westerback
an internal 8K static buffer whose contents are simply copied into another 8K buffer in the caller. Just pass a pointer to and length of the outer buffer.
2017-08-12sig_atomic_t is not (necessarily) an int. UseKenneth R Westerback
SIG_ATOMIC_MAX for INTERNALSIG instead of INT_MAX.
2017-08-10Add IMSG_SET_RESOLV_CONF and keep the cached contentsKenneth R Westerback
in the priv process, so that they do not have to be continually retransmitted. IMSG_WRITE_RESOLV_CONF now just triggers a write of the cached info. Simplifies a bunch of logic.
2017-08-09Stop obsessively flushing the imsg connection. JustKenneth R Westerback
flush any queued messages on getting a POLLOUT.
2017-07-30Use effective_proposal data to set mtu and address.Kenneth R Westerback
2017-07-29Default routes supplied via DHO_CLASSLESS[_MS]_STATIC_ROUTESKenneth R Westerback
should have the same add_route() logic applied to them as the one supplied via DHO_ROUTERS. i.e. add the /32 route if needed, create direct route if gateway address is the same as interface address. Simplify logic by using the canonical rtstatic[] version of static routes created by lease_as_proposal().
2017-07-24Throw DHO_STATIC_ROUTES to the floor! Roughly! EnsureKenneth R Westerback
they don't appear in effective leases at all.
2017-07-24Shuffle some declarations and functions into the onlyKenneth R Westerback
files they are used in. Tweak a bunch of whitespace.
2017-07-24Move invocations of flush_routes() and delete_addresses() fromKenneth R Westerback
bind_lease() into set_routes() and set_address() respectively.
2017-07-22Add set_routes() and move bind_lease() route magicKenneth R Westerback
into it. Swap parameter order in add_default_route() to be consistant with other add_*_route() functions.
2017-07-22Rename *_add_address to *_set_address to reflect that theKenneth R Westerback
lease address replaces all current addresses. Shuffle some code from bind_lease() into set_mtu()/set_address() to shrink bind_lease().
2017-07-21s/set_interface_mtu/set_mtu/gKenneth R Westerback
2017-07-17Remove some magic formerly used to detect the presence of anotherKenneth R Westerback
dhclient taking control of the interface. In particular do not exit when addresses are manually added to or deleted from the interface dhclient(8) is concerned about. Note that such changes will still be removed whenever dhclient(8) is re-started or gets a different lease during renewal.
2017-07-10Take some of the mystery out of who does what byKenneth R Westerback
renaming "if_register_bpf()" to "get_bpf_sock()", "if_register_send()" to "get_udp_sock()" and "if_register_receive()" to "configure_bpf_sock()". Pull back interface_info knowledge and just pass the interface name, rdomain and bpf socket fd as required.
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.
2017-07-08Fold tables.c into options.c and stop exporting the oneKenneth R Westerback
table (dhcp_options) involved. Provide functions code_to_name(), name_to_code(), code_to_format() and replace direct access to dhcp_options with them. Eliminate unneeded 'struct option'. Unhook tables.c from Makefile.
2017-07-08Always use uintNN_t instead of sometimes u_intNN_tKenneth R Westerback
and sometimes uintNN_t.
2017-07-07Replace the many occurances of '256' with a new #defineKenneth R Westerback
DHO_COUNT.
2017-07-07assemble_eh_header() needs only to know about hw_addr.Kenneth R Westerback
No more struct interface_info knowledge in packet.c
2017-07-07Rename cons_options() to pack_options(), and do_packet() toKenneth R Westerback
unpack_options(). Store the unpacked options in a static variable. Move remaining raw packet processing from unpack_options() to packethandler(). No more struct interface_info knowledge in options.c
2017-07-06cons_options() only needs to know a buffer and a length toKenneth R Westerback
pack options into. Not all the gory details of interface_info. Move some of the raw packet processing out of options.c's do_packet() and into the more obvious dispatch.c's packethandler(). Mention that RFC791 is why we use 576-byte UDP packets.
2017-07-05Remove knowledge of struct interface_info from clparse.c. JustKenneth R Westerback
pass the interface name and the TAILQ to put static leases into. Add a TAILQ for static leases to struct client_config to hold the static leases until it's time to add them to ifi. Add add_lease() to add leases to a TAILQ while checking for leases that are superseded by the new lease.
2017-07-02Unbreak tree by putting revised resolv_conf_priority() declaration inKenneth R Westerback
correct place and passing the invocation the correct parameters. Noticed by & initial diff from matthieu@
2017-07-01Eliminate multiple socket openings/closings and passKenneth R Westerback
fd'd from main loops as required. One socket to do ioctl's per process (called ioctlfd) and one socket to do route messages per socket (called routefd). Clean up local variable declaration lists in passing.
2017-06-29Nuke undocumented long-deprecated and/or unsupported leaseKenneth R Westerback
fields 'hardware', 'alias', 'media', 'medium', 'ethernet'. Also remove now-unused parse_ethernet(). Making these parsing failures will smoke out anybody with leases or conf files from the last century.
2017-06-29delete_addresses(), interface_status(), addressinuse(),Kenneth R Westerback
lease_as_string() and rewrite_option_db() only use the interface name, so supply just the name. Tweak interface_link_forceup() to use the same param name as other functions taking the interface name.
2017-06-28resolv_conf_priority() is a function local to kroute.c, noKenneth R Westerback
need to expose its definition in dhcpd.h. While here change the parameter from struct interface_info to int and just pass the only field used (rdomain).
2017-06-28Stop trying to clean up addresses, routes and "-L" fileKenneth R Westerback
whenever dhclient dies. Eliminates differences in handling and thus need to intercept signals INT, TERM, USR1, USR2. Eliminates need for 'zapzombies' field and thus entire struct imsg_flushroutes. Eliminates need for 'imsg' parameter to and associated logic in priv_flush_routes(). Address, routes and '-L' file are still cleaned out when binding a lease.
2017-06-27Nuke get_rdomain() and just snag the interface rdomain from the sameKenneth R Westerback
ifa we use to get the interface hw address. One less socket() and ioctl()! MIssed cleanup from shift to just watching RTM_IFINFO messages for rdomain switch.