Commit Graph

20 Commits

Author SHA1 Message Date
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