summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
2015-12-19Don't exit if a route can't be added. Just log particulars andKenneth R Westerback
let someone else figure it out. ok mpi@
2015-12-19Delete superfluous "continue;" just before end of loop.Kenneth R Westerback
2015-12-19Delete superfluous "close(s);return" just before "close(s);<functionKenneth R Westerback
exit>".
2015-12-18Check ioctl() result with == -1, not < 0. Break long line.Kenneth R Westerback
2015-12-12Send DECLINE messages in response to ACK messages that turn out toKenneth R Westerback
have inadequate or invalid leases. In particular leases for addresses that are already configured on a different interface. After the DECLINE, return to INIT state and start looking for a valid lease. This conforms much closer to the relevant RFC's. Avoids 'hanging' dhclient(8) during boot when the attempt to configure the address fails without dhclient(8) realizing it. Issue found and various fixes tested by mpi@. Feedback from beck@ and reyk@. ok mpi@
2015-12-10Pledge.Kenneth R Westerback
Diff from Ricardo Mestre. ok deraadt@
2015-12-07Convert to arc4random_uniform.tb
ok krw@
2015-12-05EAGAIN handling for imsg_read. OK henning@ benno@Claudio Jeker
2015-12-03No need to continuously check the current rdomain of the interfaceKenneth R Westerback
using the SIOCGIFRDOMAIN ioctl. If the rdomain is changed an RTM_IFINFO message is generated on the old rdomain indicating the interface is down. This will cause dhclient to exit, just like our manual check did but even faster! Should make pledging easier. Behaviour confirmed by phessler@
2015-11-12When link loss is reported, cancel any active timeout and wait forKenneth R Westerback
link to return. Inadvertantly broken in r1.308. Problem noted by tedu@
2015-10-26Give dhclient(8) the ability to use option 119, a.k.a. "DomainKenneth R Westerback
Search" if supplied by the server. Requested by a few. Original diff from Ray Lai via tech@. Tested & ok claudio@
2015-09-08Correct strsep() usage to free() correct string. Spotted by andKenneth R Westerback
original diff from Michael McConville via tech@. Thanks! ok millert@ beck@ guenther@ jca@
2015-09-05Some whitespace bulking out a diff unnecessarily.Kenneth R Westerback
2015-08-31Support deviant but historically blessed practice of acceptingKenneth R Westerback
multiple domain names in dhcp option 15 (Domain Name). This allows resolv.conf 'search' statements to be built with multiple entries. Adhere to the limits stated in resolv.conf(5) - no more than 6 domains and less than 1024 characters total length. Encountered in the wild and fix tested by beck@. Feedback from deraadt@
2015-08-19Missing prototypes. Noted by deraadt@Kenneth R Westerback
2015-05-18Tweak parsing so that hostnames starting with 0-9 are accepted.Kenneth R Westerback
Reported long ago by matthieu@. Also Jacob Berkman via the lists. Tests and suggestions from Jacob and Matthieu.
2015-05-18Stop rejecting leases with a subnet that overlaps a subnet alreadyKenneth R Westerback
present. The latest routing stack code can now handle these situations. Much requested by beck@ and others. Detailed discussion at s2k15 identified required routing changes. ok claudio@
2015-05-02Hoist common assignments out of a series of if/if-else statementsKenneth R Westerback
in get_token(). Simplifies code and shrinks future diff. No intentional functional change.
2015-05-02Correct switch between current and previous line buffers whenKenneth R Westerback
encountering a carriage return in the input. Found by jsg@ a long time ago in a respository far, far away.
2015-04-16Tweak error output.Gleydson Soares
ok krw@
2015-02-15convert bcmp to memcmpTed Unangst
ok doug millert miod
2015-02-10Groundwork for better route support over multiple interfaces byKenneth R Westerback
using RTM_IFA to bind routes to an interface. Keep the subnet route conflict avoidance code for the time being. diff from claudio@ as part of larger routing magic diff. ok claudio@ mpi@
2015-02-08Get rid of a bunch of memset()'s where struct variables and arraysKenneth R Westerback
are clearly properly initialized in the same area. Prompted by the recent shrinkage of most imsg structs.
2015-02-07Add support for interface-mtu (option 26).Kenneth R Westerback
Original request+diff from matthew@ ok dlg@
2015-02-07GC unused parameters now that ifname and rdomain are not used inKenneth R Westerback
constructing imsgs. ok reyk@
2015-02-06The write_file() privsep interface was too permissive andReyk Floeter
theoretically allowed the unprivileged child process to write to arbitrary files. Restrict it by replacing it with two specific write_resolv_conf() and write_option_db() privsep interfaces where all the critical decision has been moved to the parent. OK krw@
2015-02-06matthew@ points out that it's a bad idea to rely on the non-privileged,Kenneth R Westerback
network-facing process to properly fill out the interface name and rdomain on which operations are to be performed. Instead, always use the interface name and rdomain discovered before forking and dropping privs. Lets all the imsg structs to drop a couple of members. ok matthew@ henning@
2015-02-06Don't let errors leak the memory returned by getifaddrs().Kenneth R Westerback
2015-02-05Use sizeof(struct X) rather than sizeof(*p) in calloc() invocations.Kenneth R Westerback
History indicates this is slightly less error prone. Inconsistant usage pointed out by Benjamin Baier.
2015-02-01free(NULL) works, so stop checking for non-zero length allocationKenneth R Westerback
or non-NULLness before calling free(). This batch from Benjamin Baier.
2015-01-31free(NULL) works, so stop checking for non-zero length allocationKenneth R Westerback
or non-NULLness before calling free().
2015-01-31Don't leak the "access protected, zero sized object" returned byKenneth R Westerback
calloc(N, 0). Avoid the whole controversy by skipping zero length options while cloning a lease. Leak reported by Remco van den Berg via bugs@. Additional testing and diagnostic help from Benjamin Baier. Thanks!
2015-01-31Set is_static to 0 before trying to free a lease. Otherwise itKenneth R Westerback
might leak. *Should* not be possible but better safe than sorry.
2015-01-31Always free(buf) if errmsg is set while trying to flush routes.Kenneth R Westerback
2015-01-30Don't leak incompletely cloned static lease. Should never happenKenneth R Westerback
but better safe than sorry. Noted and diff from Benjamin Baier. Thanks!
2015-01-30Tweak error message to say 'realloc' since that's what's failing,Kenneth R Westerback
not 'malloc'.
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-10Reusing the same field for different things in different contexts mayKenneth R Westerback
be clever, but it is definitely confusing. Use a flag IFI_VALID_LLADDR to indicate that the ifi->hw_address field is valid, rather than assuming ifi->linkstat does that. Add startup_time to record client startup rather than using first_sending and hoping nobody else needs it until link is complete.
2014-12-10The consensus is that RTM_IFINFO messages do not always carry theKenneth R Westerback
latest information. So back off to using interface_status() to directly query the interface when link status is in question. Partly from Nathanael Rensen's original diff. Also, while waiting for initial link, keep checking every second rather than backing off to checking every (default) 60 seconds after (default) 10 seconds.
2014-12-09Move the initial link status check and possible forceup back beforeKenneth R Westerback
the routing socket initialization. Otherwise certain combinations of UP/RUNNING/active will generate the deadly RTM_IFINFO with RTF_UP == 0 and kill the client. Add comment to nail this section in place.
2014-12-08Try harder to avoid displaying "no link ... got link" when initialKenneth R Westerback
link comes up and nothing has yet been displayed.
2014-12-07Do not move from S_PREBOOT to S_REBOOT just because link_timeoutKenneth R Westerback
has expired. In S_REBOOT state_reboot() assumes link is present and starts sending REQUEST/DISCOVER packets and doing the backoff dance after retry_interval expires. Stay in S_PREBOOT until link appears. Pointed out by and initial diff from Nathanael Rensen.
2014-12-07Ensure we grab the interface LLADDR as soon as the link state isKenneth R Westerback
noted as being up. Thus avoiding a premature exit if extra RTM_IFINFO messages arrive before state_reboot() gets a chance to run.
2014-12-07Retract check for IFF_RUNNING when checking for link state. At leastKenneth R Westerback
some interfaces (e.g. em(4) in qemu) do not have this flag set in the RTM_IFINFO message dhclient gets. Problem found & fix tested by Nathanael Rensen. Thanks!
2014-12-05Move initial wait for network link into the state machine by addingKenneth R Westerback
state S_PREBOOT and associated state_preboot() function. This results in routing socket messages being processed even while the link is being waited for. Thus the RTM_IFINFO message announcing the link is ready can be reacted to immediately, rather than waiting for the sleep(1)'ing process to wake up and look at the link state. Some interfaces seem to lose the first packet sent when the RTM_IFINFO message is reacted to so quickly, so temporarily leave in place an explicit delay before sending the first packet.
2014-12-03Correct comment to state that the BPF program is patched inKenneth R Westerback
if_register_receive.
2014-11-30Don't check for hardware address change unless link was up. DelayKenneth R Westerback
construction of default client identifier until link is up (i.e. do it in state_reboot()).
2014-11-29Explicitly initialize client->state to S_REBOOTING rather thanKenneth R Westerback
relying on S_REBOOTING being 0.
2014-11-27Use if_nametoindex() to get the interface index, and thereby checkKenneth R Westerback
the validity of the interface name as soon the actual name is known. i.e. right after 'egress' is expanded. One less thing for get_hw_address() to do.
2014-11-26Reset ifi->errors after a successful receive_packet(), rather thanKenneth R Westerback
incrementing sporadic errors until the limit is exceeded. i.e. only exit dhclient when enough consecutive errors occur. Tweak error messages. Don't bother checking interface_status() when receive_packet() fails. Let other status checks function on their own.