Commit Graph

24 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
999f397284 Set svn:executable on dhclient-script
Sponsored by:	Yakaz (http://www.yakaz.com)
2011-12-30 14:46:53 +00:00
Gleb Smirnoff
1c6eeddad9 dhclient-script relied on incorrect behavior of SIOCAIFADDR ioctl,
that changed 0.0.0.0/0.0.0.0 prefix to 0.0.0.0/255.0.0.0.

In the r228313 this behavior was fixed, and since dhclient-script
got broken.

I'm not sure this fix is a perfect one, it just changes
dhclient-script to set 0.0.0.0/255.0.0.0 explicitly.

PR:		kern/163206
2011-12-13 11:54:51 +00:00
Jean-Sébastien Pédron
409139f051 Support domain-search in dhclient(8)
The "domain-search" option (option 119) allows a DHCP server to publish
a list of implicit domain suffixes used during name lookup. This option
is described in RFC 3397.

For instance, if the domain-search option says:
    ".example.org .example.com"
and one wants to resolve "foobar", the resolver will try:
    1. "foobar.example.org"
    2. "foobar.example.com"

The file /etc/resolv.conf is updated with a "search" directive if the
DHCP server provides "domain-search".

A regression test suite is included in this patch under
tools/regression/sbin/dhclient.

PR:		bin/151940
Sponsored by	Yakaz (http://www.yakaz.com)
2011-12-04 14:44:31 +00:00
Hajimu UMEMOTO
9201145d02 Use resolvconf(8) to update /etc/resolv.conf.
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.
2011-03-18 12:23:20 +00:00
Brooks Davis
9761cdd839 Use the -n flag to route(8) when calling "route get". Otherwise we hang
for a long time if we get a lease, but DNS isn't working.

MFC after:	1 week
2008-06-09 20:03:35 +00:00
Brooks Davis
d5354256b6 Add a new function is_default_interface() which determines if this
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
2008-03-30 02:42:39 +00:00
Brooks Davis
1547317e88 During PREINIT, when giving the interface the address 0.0.0.0, do it as an
alias to avoid distrubing other addresses.

PR:		bin/119255
Submitted by:	Jaakko Heinonen <jh at saunalahti dot fi>
2008-01-21 23:54:57 +00:00
Andrew Thompson
60932bc9ae Use the -n flag on ifconfig so that dhclient does not cause the kernel module
to be reloaded when the interface is torn down.

Reviewed by:	brooks
Approved by:	re (kensmith)
2007-07-03 17:49:32 +00:00
Ed Maste
9f0d81ba56 The minimum size of an RFC3442 destination descriptor is five bytes, so
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>
2007-04-13 15:07:10 +00:00
Ed Maste
2fcc737008 Implement RFC3442, the Classless Static Route option.
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
2007-02-09 17:50:26 +00:00
Brooks Davis
f1bacaa501 Fix rev 1.12.
/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).
2006-01-26 21:05:39 +00:00
Brooks Davis
b0864f3a7d Give the TIMEOUT case a chance to work by using -t # instead of the
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
2006-01-24 06:11:55 +00:00
Wes Peters
90158aee27 Make dhclient-script more agreeable with read-only /etc.
PR:		90518
Submitted by:	John E. Hein <jhein@timing.com>
MFC after:	3 days
2006-01-23 05:42:59 +00:00
Brooks Davis
b1f35e43b1 When we give up on an interface, use the arp(8) command to remove all
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
2006-01-10 05:33:33 +00:00
Brooks Davis
dd415a50d6 Avoid updating resolv.conf when no changes have actually occured.
Submitted by:	ume
2005-09-08 22:49:17 +00:00
Brooks Davis
3d0181db3f When we fail to aquire a lease, our lease expires without a sucessful
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.
2005-09-08 22:15:19 +00:00
Brooks Davis
001f040a03 The $medium string often contains quoted values with spaces in them (ssids,
for example).  Follow the example of the ISC script and wrap ifconfig
calls using $medium in eval "..." so this works.

Reported by:	iedowse
2005-08-26 20:31:04 +00:00
Brooks Davis
6ae27cb6ce Use a more robust, grep-free command to get the interface of the current
default route.

Submitted by:	Rostislav Krasny <rosti dot bsd at gmail dot com>
2005-08-26 01:07:51 +00:00
Brooks Davis
7e82455ea8 Don't and/remove a route to our assigned IP through 127.0.0.1. It
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>
2005-08-26 01:02:38 +00:00
Brooks Davis
3c0898098e s/if_defaulroute/if_defaultroute/
We may now handle route updates better.
2005-07-26 18:27:37 +00:00
Brooks Davis
d5fedb6e96 Add support for /etc/dhclient-enter-hooks to match /etc/dhclient-exit-hooks. 2005-06-10 03:41:18 +00:00
Brooks Davis
d6790d5a5c Add support for /etc/dhclient-exit-hooks file.
Tested by:	Max Boyarov <max_b at tut dot by>
2005-06-08 18:21:56 +00:00
Brooks Davis
8750adaf5a FreeBSDize the dhclient-script.
Submitted by:	sam
2005-06-07 04:32:29 +00:00
Brooks Davis
47c0859616 Import the OpenBSD dhclient as shipped with OpenBSD-3.7 (the tag
OPENBSD_3_7).
2005-06-07 04:05:09 +00:00