aboutsummaryrefslogtreecommitdiff
path: root/sbin/dhclient
Commit message (Collapse)AuthorAgeFilesLines
* Make dhclient use a pid file. Modify the rc script accordingly; whileDag-Erling Smørgrav2011-10-135-3/+48
| | | | | | | | | | there, clean it up and add some error checks. Glanced at by: brooks@ MFC after: 3 weeks Notes: svn path=/head/; revision=226345
* Use resolvconf(8) to update /etc/resolv.conf.Hajimu UMEMOTO2011-03-181-25/+46
| | | | | | | | If you don't want to use resolvconf(8) to update /etc/resolv.conf, you can put resolvconf_enable="NO" into /etc/dhclient-enter-hooks. Notes: svn path=/head/; revision=219739
* Document dhclient-enter-hooks and dhclient-exit-hooks and mentionBrian Somers2010-09-061-1/+25
| | | | | | | | | | | how to configure dhclient to clear the interface of IP numbers prior to configuring it. PR: 149351 MFC after: 2 weeks Notes: svn path=/head/; revision=212253
* When dhclient obtains a lease, it runs dhclient-script and expectsBrian Somers2010-07-071-16/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it to configure the interface. When the script is complete, dhclient monitors the routing socket and will terminate if its address is deleted or if its interface is removed or brought down. Because the routing socket is already open when dhclient-script is run, dhclient ignores address deletions for 10 seconds after the script was run. If the address that will be obtained is already configured on the interface before dhclient starts, and if dhclient-script takes more than 10 seconds (perhaps due to dhclient-*-hooks latencies), on script completion, dhclient will immediately and silently exit when it sees the RTM_DELADDR routing message resulting from the script reassigning the address to the interface. This change logs dhclient's reason for exiting and also changes the 10 second timeout to be effective from completion of dhclient-script rather than from when it was started. We now ignore RTM_DELADDR and RTM_NEWADDR messages when the message contains no interface address (which should not happen) rather than exiting. Not reviewed by: brooks (timeout) MFC after: 3 weeks Notes: svn path=/head/; revision=209756
* Make dhclient use bootpc (68) as the source port for unicast DHCPREQUESTPhilip Paeps2009-10-213-18/+41
| | | | | | | | | | | | | | | packets instead of allowing the protocol stack to pick a random source port. This fixes the behaviour where dhclient would never transition from RENEWING to BOUND without going through REBINDING in networks which are paranoid about DHCP spoofing, such as most mainstream cable-broadband ISP networks. Reviewed by: brooks Obtained from: OpenBSD (partly - I'm not convinced their solution can work) MFC after: 1 week (pending re approval) Notes: svn path=/head/; revision=198352
* Switch the default WARNS level for sbin/ to 6.Ruslan Ermilov2009-10-191-0/+2
| | | | | | | Submitted by: Ulrich Spörlein Notes: svn path=/head/; revision=198236
* Fix the logic to count the number of "live interfaces". With this changeSam Leffler2009-07-211-9/+11
| | | | | | | | | | | dhclient now terminates when the underlying ifnet is destroyed (e.g. on card eject). Reviewed by: brooks Approved by: re (kib) Notes: svn path=/head/; revision=195805
* Fix an off by one error when we limit append/prepend text sizes based on ourBrian Somers2009-06-081-5/+15
| | | | | | | | | | | | | | internal buffer sizes. When we 'append', assume we're appending to text. Some MS dhcp servers will give us a string with the length including the trailing NUL. when we 'append domain-name', we get something like "search x.y\000 z" in resolv.conf :( MFC after: 1 week Security: A buffer overflow (by one NUL byte) was possible. Notes: svn path=/head/; revision=193765
* Support the remaining options listed in dhcp-options(5) and RFC 2132.Brooks Davis2008-10-173-5/+31
| | | | | | | | | PR: bin/127076 Submitted by: jkim MFC after: 1 week Notes: svn path=/head/; revision=183974
* Run the privileged dhclient process in its own session.Ed Schouten2008-06-301-0/+1
| | | | | | | | | | | In the MPSAFE TTY branch, I noticed PTY's to be leaked, because dhclient's privileged process was run inside the session of, say, the login shell. Make sure we call setsid() here. Approved by: philip (mentor), brooks Notes: svn path=/head/; revision=180130
* Use the -n flag to route(8) when calling "route get". Otherwise we hangBrooks Davis2008-06-091-1/+1
| | | | | | | | | for a long time if we get a lease, but DNS isn't working. MFC after: 1 week Notes: svn path=/head/; revision=179689
* When sending packets directly to the DHCP server, use a socket and sendBrooks Davis2008-04-151-0/+15
| | | | | | | | | | | directly rather than bogusly sending it out as a link layer broadcast (which fails to be received on some networks). PR: bin/96018 MFC after: 2 weeks Notes: svn path=/head/; revision=178232
* Add a new function is_default_interface() which determines if thisBrooks Davis2008-03-301-20/+48
| | | | | | | | | | | | | | interface is one with the default route (or there isn't one). Use it to decide if we should adjust the default route and /etc/resolv.conf. Fix the delete of the default route. The if statement was totally bogus and the delete only worked due to a typo. [1] Reported by: Jordan Coleman <jordan at JordanColeman dot com> [1] MFC after: 1 week Notes: svn path=/head/; revision=177730
* Defer state change on disassociate to avoid unnecessarily dropping theSam Leffler2008-03-221-15/+31
| | | | | | | | | | | | | lease: track the current bssid and if it changes (as reported in an assoc/reassoc) event only then kick the state machine. This gives us immediate response when roaming but otherwise causes us to fallback on the normal state machine. Reviewed by: brooks, jhb MFC after: 3 weeks Notes: svn path=/head/; revision=177501
* correct syslog mask so LOG_DEBUG msgs are not lostSam Leffler2008-03-221-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=177500
* During PREINIT, when giving the interface the address 0.0.0.0, do it as anBrooks Davis2008-01-211-1/+1
| | | | | | | | | | alias to avoid distrubing other addresses. PR: bin/119255 Submitted by: Jaakko Heinonen <jh at saunalahti dot fi> Notes: svn path=/head/; revision=175554
* Teach dhclient(8) about net80211 link (association) status.Jung-uk Kim2007-12-051-1/+4
| | | | | | | | Reviewed by: brooks MFC after: 3 days Notes: svn path=/head/; revision=174314
* - Remove references to unexisting man pagesGabor Kovesdan2007-09-201-5/+2
| | | | | | | | | | PR: docs/116099 Submitted by: Ben Kaduk <minimarmot@gmail.com> Approved by: re (bmah) MFC after: 3 days Notes: svn path=/head/; revision=172252
* Use the -n flag on ifconfig so that dhclient does not cause the kernel moduleAndrew Thompson2007-07-031-8/+9
| | | | | | | | | | to be reloaded when the interface is torn down. Reviewed by: brooks Approved by: re (kensmith) Notes: svn path=/head/; revision=171187
* The minimum size of an RFC3442 destination descriptor is five bytes, soEd Maste2007-04-131-1/+1
| | | | | | | | | | correct test to -ge 5. Without this change an RFC3442 encoded default route would be ignored. Reported by: Cedric Jonas <cedric at decemplex dot net> Notes: svn path=/head/; revision=168689
* Implement RFC3442, the Classless Static Route option.Ed Maste2007-02-096-4/+137
| | | | | | | | | | | | | | The original DHCP specification includes a route option but it supports only class-based routes. RFC3442 adds support for specifying the netmask width for each static route. A variable length encoding is used to minimize the size of this option. PR: bin/99534 Submitted by: Andrey V. Elsukov <bu7cher@yandex.ru> Reviewed by: brooks Notes: svn path=/head/; revision=166602
* Add a $FreeBSD$ tag missing after the original import. Note that thisEd Maste2007-02-091-0/+2
| | | | | | | file isn't actually installed; the one in src/etc is. Notes: svn path=/head/; revision=166597
* Actually implement rev 1.12 for host names and NIS domain names. WeBrooks Davis2007-01-291-1/+0
| | | | | | | | | were removing the invalid option, but still rejecting the lease. Reported by: Yoshihiko Sarumaru <mistral at imasy dot or dot jp> Notes: svn path=/head/; revision=166330
* It is possible for bpf to return a length such that:Brooks Davis2006-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | length != BPF_WORDALIGN(length) This meeans that it is possible for this to be true: interface->rbuf_offset > interface->rbuf_len Handle this case in the test for running out of packets. While OpenBSD's solution of setting interface->rbuf_len to BPF_WORDALIGN(length) is safe due to the size of the buffer, I think this solution results in less hidden assumptions. This should fix the problem of dhclient running away and consuming 100% CPU. PR: bin/102226 Submitted by: Joost Bekkers <joost at jodocus.org> MFC after: 3 days Notes: svn path=/head/; revision=162641
* Revert the addition of -p. It's flawed in that dhclient should not runBrian Somers2006-08-212-25/+7
| | | | | | | | | | on an interface without carrier. devd should be used instead to handle link up/down events. Put on the right path by: brooks, sam Notes: svn path=/head/; revision=161514
* Bump the document date. s/dhclient/.Nm/Brian Somers2006-08-171-4/+7
| | | | | | | Suggested by: ru Notes: svn path=/head/; revision=161417
* Correct usage()Brian Somers2006-08-171-1/+1
| | | | Notes: svn path=/head/; revision=161411
* Add a -p switch to dhclient. The switch tells dhclient to persistBrian Somers2006-08-172-5/+20
| | | | | | | | | | | | | despite the interface link status. Add dhclient_flags_iface and background_dhclient_iface rc.conf options. (where iface is a specific interface). These can be used to give interface specific flags to dhclient. Reviewed by: brooks@ Notes: svn path=/head/; revision=161410
* Send client identifier unconditionally. My ancient D-Link router responseJung-uk Kim2006-07-031-4/+0
| | | | | | | | | | | | with NACK if I don't set it. Setting 'option dhcp-client-identifier' is alternative but it is inconvenient because I have to keep the list of all MAC addresses. As bin/94743 pointed out, it is always sent from Windows clients and I found Mac OS X does the same. OK'd by: brooks Notes: svn path=/head/; revision=160089
* Remove 'n' from the getopt string. There's no -n option that isWarner Losh2006-05-231-2/+2
| | | | | | | | | parsed, so it winds up at usage anyway. Add 'b' to the usage summary. Noticed by Ben Mesander. Notes: svn path=/head/; revision=158856
* Be more like Windows and Linux and send our hostname in the host-nameBrooks Davis2006-05-071-0/+68
| | | | | | | | | | | | option if none is given in the config file. Also add #ifdefd out support for sending a client ID based on our MAC address. PR: bin/94743, bin/76401 Submitted by: Frank Behrens <frank at pinky dot sax dot de> X-MFC after: 6.1-RELEASE Notes: svn path=/head/; revision=158353
* Correct RFC for NTP.Jesus R. Camou2006-02-061-1/+1
| | | | | | | | | | PR: docs/92629 Submitted by: Daniel Gerzo <danger@rulez.sk> Noticed by: Michal F. Hanula <f@7f000001.org> Approved by: trhodes (mentor) Notes: svn path=/head/; revision=155394
* Fix rev 1.12.Brooks Davis2006-01-261-1/+1
| | | | | | | | | | | | | | | | /tmp may not be writeable yet when dhclient is first run via /etc/rc.d/netif so using it may not work. Also, writing to a predictable file in /tmp as root is a really bad idea since a malicious user may be able to win a race and insert a symlink which will allow them to cause any file to be overwritten. To solve these problems, create the tempory file in /var/run which will exist this early and is writable only by root. Security: Local risk if users can cause dhclient to run on demand (such as by unplugging and replugging the network cable). Notes: svn path=/head/; revision=154869
* Give the TIMEOUT case a chance to work by using -t # instead of theBrooks Davis2006-01-241-1/+1
| | | | | | | | | | | OpenBSD -w # when invoking ping. PR: bin/92187 Submitted by: "Shin'ya Kumabuchi" <kumabu at t3 dot rim dot or dot jp> MFC After: 6 days Notes: svn path=/head/; revision=154760
* Make dhclient-script more agreeable with read-only /etc.Wes Peters2006-01-231-9/+10
| | | | | | | | | PR: 90518 Submitted by: John E. Hein <jhein@timing.com> MFC after: 3 days Notes: svn path=/head/; revision=154702
* Mention the -b flag in the SYNOPSIS.Brooks Davis2006-01-101-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=154165
* When we give up on an interface, use the arp(8) command to remove allBrooks Davis2006-01-101-2/+5
| | | | | | | | | | | entries from the interface rather than using ifconfig's delete command. This preserves non-dhclient configured addresses (though they are wiped out when dhclient is restarted). MFC after: 1 week Notes: svn path=/head/; revision=154164
* Allow users to add aliases to the interface.Brooks Davis2006-01-101-13/+13
| | | | | | | | PR: bin/87465 (different solution used) MFC after: 1 week Notes: svn path=/head/; revision=154161
* When we get a bogus hostname in an option, drop the option rather thanBrooks Davis2005-12-101-1/+4
| | | | | | | | | | refusing the lease. This allow obtaining leases on misadministered networks that use host names with underscores in them. MFC After: 3 days Notes: svn path=/head/; revision=153287
* Avoid updating resolv.conf when no changes have actually occured.Brooks Davis2005-09-081-0/+10
| | | | | | | Submitted by: ume Notes: svn path=/head/; revision=149898
* When we fail to aquire a lease, our lease expires without a sucessfulBrooks Davis2005-09-081-0/+1
| | | | | | | | | | | | renewal, or we lose link, be more forceful about clearing interface state so another interface that connects to the same network has a chance of working. This doesn't address attemping to connect to both at once, but appears to allow unplugging from a wired interface and then inserting a wireless card that associates with an AP bridged to the same LAN. Notes: svn path=/head/; revision=149896
* When we supersed the subnet-mask, write the forced value to the leaseBrooks Davis2005-09-021-10/+14
| | | | | | | | | file. This is what the ISC client does. Submitted by: Rostislav Krasny <rosti dot bsd at gmail dot com> Notes: svn path=/head/; revision=149727
* Introduce a new helper function check_search() derived for res_hnok toBrooks Davis2005-08-301-0/+56
| | | | | | | | | | | | | | | | | | check the domain-name parameter according to the rules for "search" strings as documented in resolv.conf(5). Specifically, the string must be no more than 256 bytes long and contain no more than six valid domain names separated by white space. The previous unchecked values could result in a mangled resolv.conf file which could effectively deny access to local sites. This is not a security issue as rogue dhcp servers could already do this without sending invalid strings. Reviewed by: cperciva MFC After: 3 days Notes: svn path=/head/; revision=149639
* The $medium string often contains quoted values with spaces in them (ssids,Brooks Davis2005-08-261-6/+6
| | | | | | | | | | for example). Follow the example of the ISC script and wrap ifconfig calls using $medium in eval "..." so this works. Reported by: iedowse Notes: svn path=/head/; revision=149519
* In read_string(), when the last character was a backslash, unincrementBrooks Davis2005-08-261-0/+1
| | | | | | | | | the output index instead of keeping what ever trash was in the buffer. Reported by: iedowse Notes: svn path=/head/; revision=149481
* Use a more robust, grep-free command to get the interface of the currentBrooks Davis2005-08-261-2/+1
| | | | | | | | | default route. Submitted by: Rostislav Krasny <rosti dot bsd at gmail dot com> Notes: svn path=/head/; revision=149480
* Don't and/remove a route to our assigned IP through 127.0.0.1. ItBrooks Davis2005-08-261-4/+4
| | | | | | | | | | serves no apparent purpose (we commented this out ages ago in the ISC scripts) and cases problems with some ADSL setups. Reported by: Rostislav Krasny <rosti dot bsd at gmail dot com> Notes: svn path=/head/; revision=149479
* MFOpenBSD rev 1.9: fix a buffer overflow when processing config fileBrooks Davis2005-08-241-1/+1
| | | | | | | | | | lines that are exactly 81 characters in length. Obtained from: OpenBSD MFC After: 3 days Notes: svn path=/head/; revision=149400
* Add __FBSDID to all .c files in dhclient to aid in determining fileBrooks Davis2005-08-2316-4/+48
| | | | | | | versions when dealing with user problems. Notes: svn path=/head/; revision=149399
* FreeBSD unconditionally supports write filters now.Christian S.J. Peron2005-08-231-2/+0
| | | | Notes: svn path=/head/; revision=149383