summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
2020-05-15Shuffle and tweak code in lease_as_proposal() to allocate the proposalKenneth R Westerback
after the variable length data (static routes, search path, dns servers) sizes are deteremined. No intentional functional change. Allows potential change to variable length proposals.
2020-05-15Fix domain-search option processing. Testing one value and then usingKenneth R Westerback
a different value to limit memcpy() is a bad thing. Discovered & fix tested by Andreas Kahari. Thanks!
2020-05-15Be more careful in extracting the uint16_t value of interface-mtu, andKenneth R Westerback
in printing the int field we store it in. i.e. '%d' not '%u. Discovered while tracking down breakage reported by Andreas Kahari on bugs@.
2020-05-14Massage merge_option_data() to be more careful when dealing with 'D'Kenneth R Westerback
(domain search) and 't' (text) options. Enables append/prepend for the domain-search option by inserting blanks between the domains and ensures the presence of a terminating NUL when merging text.
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-05-09Shuffle and clarify logic creating the contents of resolv.conf.Kenneth R Westerback
No intentional functional change.
2020-05-08Nuke unneeded 'inits' field in struct proposal. 'mtu' being 0 is enough of a ↵Kenneth R Westerback
clue to avoid setting interface mtu.
2020-05-08Nuke 'set but never used' addrs field in struct proposal.Kenneth R Westerback
2020-04-27If the DHCP server disappears between OFFER'ing and ACK'ing a lease,Kenneth R Westerback
stop trying to get an ACK from that server after 'timeout' seconds. Give up and try to get another lease. Possible infinite loop pointed out by Alexander Markert on tech@.
2020-04-26Tighten up NAK handling. Inform unwind when the active lease isKenneth R Westerback
discarded. Update leases file when active lease is discarded. Discard NAK'ed offers even if there is no active lease. Always transition to INIT. Issues discovered after inappropriate behaviour resported by Alexander Markert and Pierre Emeriaud.
2020-04-24Stray whitespace.Kenneth R Westerback
2020-04-21Send broadcast packets to INADDR_BROADCAST, not INADDR_ANY.Kenneth R Westerback
Should fix '-r' (a.k.a. release a lease) for leases without a valid DHCP_SERVER_IDENTIFIER. Spotted by Alexander Markert. Thanks!
2020-04-09No need to check for NULL before free().Kenneth R Westerback
From Geoff Hill.
2020-02-10briefly mention /etc/examples/ in the FILES section of all theIngo Schwarze
manual pages that document the corresponding configuration files; OK jmc@, and general direction discussed with many
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.
2020-01-26Don't validate '-c' with S_ISREG(). The install script uses /dev/stdin.Kenneth R Westerback
Noticed by sebastia@
2020-01-24Allow carp(4) interfaces to be configured via dhcp.Kenneth R Westerback
Original diff & testing from dtucker@ ok beck@ dtucker@
2020-01-23Separate command line syntax parsing from semantic validation ofKenneth R Westerback
command line contents. Display usage() when syntax is incorrect and relevant error messages when semantic checks fail. More akin to the way other commands handle the syntax/semantic split. Idea taken from a larger diff by kn@. ok kn@
2020-01-20Move warning about DHO_STATIC_ROUTES (option 33) to debug.Kenneth R Westerback
Continued emittance noticed by mlarkin@ ok florian@
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-11-27use _PATH_ names for unveil if possibleTheo de Raadt
2019-11-22Polish logic talking to unwind.Kenneth R Westerback
ok florian@
2019-11-22DNS Proposals are treated as replacements in unwind now.Florian Obser
To withdraw a proposal sent an empty list of nameservers. This one is a bit of a hack by me to keep everything in sync for now. A better version from krw is coming soon.
2019-11-19Inform unwind about DNS servers it finds in leases.Kenneth R Westerback
ok florian@
2019-11-06No need to write resolv.conf after deciding to get a new lease,Kenneth R Westerback
or after deciding to terminate or when AUTOCONF4 is not set.
2019-11-06Correct the logic deciding when to write resolv.conf.Kenneth R Westerback
Fixes switching back to wifi relevant resolv.conf when wired interface loses link.
2019-10-31Constrain and correct the routes being deleted when applying a newKenneth R Westerback
lease. Constrain by only looking at static routes, which are the only kind dhclient will add. Correct by realizing direct /32 routes in the lease look different when returned from the routing table. Further correct route comparison by applying appropriate netmask to both destination addresses before comparing them. Fixes "arpresolve: ... route contains no arp information" issue reported on bugs@. Much problem analysis and fix testing by Lauri Tirkkonen. Thanks!
2019-08-06Use pw->pw_dir when chroot'ing, not _PATH_VAREMPTY.Kenneth R Westerback
Brings various dhcp related daemons into line with the common idiom. ok florian@
2019-08-05dhclient.leases(5) is not required for dhclient(8) to work, so justKenneth R Westerback
carry on if it can't be accessed. e.g. if /var/db is not present in single user mode.
2019-08-05If the leases file cannot be opened for writing, just issue a warningKenneth R Westerback
and carry-on. Similar to treatment of /etc/resolv.conf[.tail]. Lets /var/db/dhclient.leases.if be on RO filesystem.
2019-08-01Don't leak resolv.conf contents.Kenneth R Westerback
2019-07-31space between macro arg and punctuation;Jason McIntyre
2019-07-30Use AUTOCONF4 flag. Set the flag on startup. But if the flag isKenneth R Westerback
subsequently reset by ifconfig(8) then stop applying leases. If the flag is set after being reset then get a new lease and carry on. Clean up man page verbiage and add AUTOCONF4 description. ok benno@, man page formatting ok ingo@
2019-07-26Whitespace tweak, fold long line.Kenneth R Westerback
2019-07-24Return fd of -1 if take_charge() detects 'quit' being set toKenneth R Westerback
TERMINATE. Exit if take_charge() returns -1. Set 'quit' to TERMINATE instead of directly calling 'exit(0)' in rtm_dispatch(). Nuke erroneous "not reached" comment.
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-21Restructure parse_semi() so it resembles the other parse_*Kenneth R Westerback
functions.
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-07-19Keep dhclient.leases.<if> O_EXLOCK file descriptor open for theKenneth R Westerback
lifefime of the dhclient instance. Use O_NONBLOCK so RTM_* messages are seen while trying to open the O_EXLOCK file descriptor. Prevents a possible race during startup, ensuring only one dhclient instance can be configuring an interface. Improves responsiveness to interface changes during startup.
2019-07-16Shuffle code a bit to make take_charge() return theKenneth R Westerback
leases file descriptor. No intentional functional change.
2019-07-15Nuke '-l' command line option (alternate location forKenneth R Westerback
dhclient.leases.<if>). ok kmos@
2019-07-11The privileged process of dhclient(8) runs several ioctl(2)s that are forbiddenRicardo Mestre
by pledge(2) and therefore we cannot add it here. Instead we can restrict the filesystem access to only two files, mentioned below, via unveil(2). - /etc/resolv.conf -> write/create permissions - /etc/resolv.conf.tail -> read permissions OK brynet@ deraadt@ kn@ krw@ left the decision to other people who understand unveil(2)