Commit Graph

227 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
d1f4d85494 MFp4 @229471:
Remove unused argument from assemble_hw_header().

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
2013-07-03 21:49:10 +00:00
Pawel Jakub Dawidek
592291c1e7 MFp4 @229470:
Remove unused argument from send_packet().

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
2013-07-03 21:45:29 +00:00
Pawel Jakub Dawidek
181ab08d9e MFp4: @229469:
Garbage-collect dead prototypes.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
2013-07-03 21:41:35 +00:00
Bruce M Simpson
d32438c3f1 When acquiring a lease, record the value of the BOOTP siaddr field
contained in the DHCP offer, and write it out to the lease file
as an unquoted value of the "next-server" keyword. The value is ignored
when the lease is read back by dhclient, however other applications
are free to parse it.

The intent behind this change is to allow easier interoperability
with automated installation systems e.g. Cobbler, Foreman, Razor;
FreeBSD installation kernels can automatically probe the network
to discover deployment servers.  There are no plans to MFC this
change unless a backport is specifically requested.

The syntax of the "next-server <ip>" lease keyword is intended to be
identical to that used by the ISC DHCPD server in its configuration files.
The required defines are already present in dhclient but were unused before
this change. (Note: This is NOT the same as Option 66, tftp-server-name).

It has been exercised in a university protocol testbed environment, with
Cobbler and an mfsBSD image containing pc-sysinstall (driven by Cobbler
Cheetah templates). The SYSLINUX memdisk driver is used to boot mfsBSD.
Currently this approach requires that a dedicated system profile has
been created for the node where FreeBSD is to be deployed. If this
is not present, the pc-sysinstall wrapper will be unable to obtain
a node configuration. There is code in progress to allow mfsBSD images
to obtain the required hints from the memdisk environment by parsing
the MBFT ACPI chunk.  This is non-standard as it is not linked into
the platform's ACPI RSDT.

Reviewed by:	des
2013-07-02 13:24:37 +00:00
John Baldwin
9291a1cd14 Use a higher TTL (128) for DHCP packets. This matches the ISC DHCP client.
PR:		bin/170279
MFC after:	1 week
2013-04-22 15:02:32 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
John Baldwin
0a26f85822 Revert r239356 and use an alternate algorithm.
First, don't exit when the link goes down on an interface.  Instead,
teach dhclient to track changes in link state and to enter the reboot
state when the link on an interface goes up causing dhclient to attempt
to renew its existing lease.

Second, remove the change I added to clear the old lease when dhclient
exits due to an error (such as ifconfig down).  If an interface is
using autoconfiguration it should keep its autoconfiguration as much as
possible.  If the next time it needs a configuration it is able to reuse
the previous autoconfiguration, then leaving the settings intact allows
existing connections to survive temporary outages, etc.

PR:		bin/166656
MFC after:	1 month
2012-08-22 13:53:37 +00:00
John Baldwin
83f745b8b9 Fix dhclient to properly exit and teardown the configured lease when
link is lost.  devd will start a new dhclient instance when link is
restored.

PR:		bin/166656
Submitted by:	Peter Jeremy (mostly)
Reviewed by:	brooks (earlier version from Peter)
MFC after:	1 month
2012-08-17 15:53:43 +00:00
Ulrich Spörlein
4b85a12f71 Spelling fixes for sbin/ 2012-01-07 16:09:33 +00:00
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
Jean-Sébastien Pédron
33d5b03267 Invalid Domain Search option isn't considered as a fatal error
In the original Domain Search option patch, an invalid option value
would cause the whole lease to be rejected. However, DHCP servers who
emit such an invalid value are more common than I thought. With this new
patch, just the option is rejected, not the entire lease.

PR:		bin/163431
Submitted by:	Fabian Keil <fk@fabiankeil.de> (earlier version)
Reviewed by:	Fabian Keil <fk@fabiankeil.de>
Sponsored by:	Yakaz (http://www.yakaz.com)
2011-12-30 14:33:08 +00:00
Dimitry Andric
7824741286 In sbin/dhclient, since we know the size of the source strings anyway,
we might as well use memcpy; strlcpy is really unnecessary here.

MFC after:	1 week
2011-12-17 01:29:46 +00:00
Dimitry Andric
e2f95dd941 In sbin/dhclient, work around warnings about the size argument to
strlcpy appearing to be the size of the source buffer, instead of the
destination.

MFC after:	1 week
2011-12-17 01:19:07 +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
Dag-Erling Smørgrav
23f39c906b Make dhclient use a pid file. Modify the rc script accordingly; while
there, clean it up and add some error checks.

Glanced at by:	brooks@
MFC after:	3 weeks
2011-10-13 17:20:45 +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
Brian Somers
5172455266 Document dhclient-enter-hooks and dhclient-exit-hooks and mention
how to configure dhclient to clear the interface of IP numbers prior
to configuring it.

PR:		149351
MFC after:	2 weeks
2010-09-06 09:59:10 +00:00
Brian Somers
6964abef83 When dhclient obtains a lease, it runs dhclient-script and expects
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
2010-07-07 06:06:54 +00:00
Philip Paeps
9b683f8da6 Make dhclient use bootpc (68) as the source port for unicast DHCPREQUEST
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)
2009-10-21 23:50:35 +00:00
Ruslan Ermilov
106d839190 Switch the default WARNS level for sbin/ to 6.
Submitted by:	Ulrich Spörlein
2009-10-19 16:00:24 +00:00
Sam Leffler
f8c44ada2e Fix the logic to count the number of "live interfaces". With this change
dhclient now terminates when the underlying ifnet is destroyed (e.g.
on card eject).

Reviewed by:	brooks
Approved by:	re (kib)
2009-07-21 15:06:10 +00:00
Brian Somers
043bcc8d44 Fix an off by one error when we limit append/prepend text sizes based on our
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.
2009-06-08 21:42:30 +00:00
Brooks Davis
38e755fd40 Support the remaining options listed in dhcp-options(5) and RFC 2132.
PR:		bin/127076
Submitted by:	jkim
MFC after:	1 week
2008-10-17 13:28:53 +00:00
Ed Schouten
708925463e Run the privileged dhclient process in its own session.
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
2008-06-30 20:23:49 +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
8ca3089abc When sending packets directly to the DHCP server, use a socket and send
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
2008-04-15 22:48:56 +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
Sam Leffler
61063e478a Defer state change on disassociate to avoid unnecessarily dropping the
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
2008-03-22 16:24:02 +00:00
Sam Leffler
043f1935e0 correct syslog mask so LOG_DEBUG msgs are not lost
MFC after:	2 weeks
2008-03-22 16:18:07 +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
Jung-uk Kim
cd765a6594 Teach dhclient(8) about net80211 link (association) status.
Reviewed by:	brooks
MFC after:	3 days
2007-12-05 17:13:45 +00:00
Gabor Kovesdan
6b7267a277 - Remove references to unexisting man pages
PR:		docs/116099
Submitted by:	Ben Kaduk <minimarmot@gmail.com>
Approved by:	re (bmah)
MFC after:	3 days
2007-09-20 10:46:25 +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
Ed Maste
a2d605f78c Add a $FreeBSD$ tag missing after the original import. Note that this
file isn't actually installed; the one in src/etc is.
2007-02-09 16:28:25 +00:00
Brooks Davis
a0b5cadc42 Actually implement rev 1.12 for host names and NIS domain names. We
were removing the invalid option, but still rejecting the lease.

Reported by:	Yoshihiko Sarumaru <mistral at imasy dot or dot jp>
2007-01-29 15:55:13 +00:00
Brooks Davis
ebe609b4a2 It is possible for bpf to return a length such that:
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
2006-09-26 01:02:02 +00:00
Brian Somers
3dd3357a13 Revert the addition of -p. It's flawed in that dhclient should not run
on an interface without carrier.  devd should be used instead to handle
link up/down events.

Put on the right path by:	brooks, sam
2006-08-21 16:31:31 +00:00
Brian Somers
4fdeb33466 Bump the document date. s/dhclient/.Nm/
Suggested by: ru
2006-08-17 20:11:21 +00:00
Brian Somers
43cb852dc0 Correct usage() 2006-08-17 17:27:42 +00:00
Brian Somers
9341e8dd88 Add a -p switch to dhclient. The switch tells dhclient to persist
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@
2006-08-17 17:12:27 +00:00
Jung-uk Kim
473c2d129b Send client identifier unconditionally. My ancient D-Link router response
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
2006-07-03 22:05:38 +00:00
Warner Losh
649482853c Remove 'n' from the getopt string. There's no -n option that is
parsed, so it winds up at usage anyway.

Add 'b' to the usage summary.  Noticed by Ben Mesander.
2006-05-23 16:57:47 +00:00
Brooks Davis
fcab8addcf Be more like Windows and Linux and send our hostname in the host-name
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
2006-05-07 23:31:10 +00:00
Jesus R. Camou
6912d575ee Correct RFC for NTP.
PR:		docs/92629
Submitted by:	Daniel Gerzo <danger@rulez.sk>
Noticed by:	Michal F. Hanula <f@7f000001.org>
Approved by:	trhodes (mentor)
2006-02-06 19:22:34 +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
3b8376f05e Mention the -b flag in the SYNOPSIS.
MFC after:	1 week
2006-01-10 05:44:11 +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
dfad96ea18 Allow users to add aliases to the interface.
PR:		bin/87465 (different solution used)
MFC after:	1 week
2006-01-10 04:53:20 +00:00
Brooks Davis
82dbbc4120 When we get a bogus hostname in an option, drop the option rather than
refusing the lease.  This allow obtaining leases on misadministered
networks that use host names with underscores in them.

MFC After: 3 days
2005-12-10 03:46:14 +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
40767e22ea When we supersed the subnet-mask, write the forced value to the lease
file.  This is what the ISC client does.

Submitted by:	Rostislav Krasny <rosti dot bsd at gmail dot com>
2005-09-02 17:35:35 +00:00
Brooks Davis
f954ec0bcf Introduce a new helper function check_search() derived for res_hnok to
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
2005-08-30 18:20:46 +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
753d6c0327 In read_string(), when the last character was a backslash, unincrement
the output index instead of keeping what ever trash was in the buffer.

Reported by:	iedowse
2005-08-26 01:25:59 +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
1469b42c7d MFOpenBSD rev 1.9: fix a buffer overflow when processing config file
lines that are exactly 81 characters in length.

Obtained from:	OpenBSD
MFC After:	3 days
2005-08-24 00:05:04 +00:00
Brooks Davis
8794fdbb48 Add __FBSDID to all .c files in dhclient to aid in determining file
versions when dealing with user problems.
2005-08-23 23:59:55 +00:00
Christian S.J. Peron
4d3d08301e FreeBSD unconditionally supports write filters now. 2005-08-23 01:35:38 +00:00
Brooks Davis
289d89d80f Further fix receive_packet() by using BPF_WORDALIGN to insure the offset
is properly aligned when we move to the next packet.

Obtained from:	ISC dhclient via krw at OpenBSD
2005-07-28 15:30:19 +00:00
Brooks Davis
acccb9aa83 Don't reject packets with server names containing characters that are
not allowed in domain names.  RFC 2132 does not list valid or invalid
characters and the ISC client accepts anything here.

Reported by:	ps
2005-07-28 00:24:39 +00:00
Brooks Davis
4eae015de1 Fix a bug in the handling of cases where we got a short (or zero)
capture.  Zero length captures caused an infinte loop and short captures
probably caused memory corruption and a crash.

Reported by:	many
MFC After:	3 days
2005-07-27 19:25:46 +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
a65d8df916 Change host-name from type "X" to type "t". This allows the client to
accept NUL-terminated strings as required by RFC 2132.

This solution is not perfect as it removes the ability to send
NUL-terminated host-name options which may be required by some broken
servers.  Given the current lack of an existance proof of such servers
and the fact that servers that send NUL-terminated domain names do
exist, this seems like an acceptable compromise.  A discussion of these
issues can be found at:

http://marc.theaimsgroup.com/?l=dhcp-client&m=96837107208382&w=2

PR:		bin/83468
Reported by:	Sean Winn <sean at gothic dot net dot au>
MFC-after:	3 days
2005-07-25 22:19:09 +00:00
Sam Leffler
b35f2511fa treat REASSOC events just like ASSOC
MFC after:	3 days
2005-07-25 04:32:40 +00:00
Mark Santcroos
ac0ba90dc8 Bump document date.
Reminded by:	ru
2005-07-20 23:12:54 +00:00
Mark Santcroos
6214c00201 Document -b flag of dhclient.
Reviewed by:	ru
MFC after:	3 days
2005-07-20 22:35:44 +00:00
Brooks Davis
a36c0b6b78 Don't complain when we receive smtp, pop, nntp, www, finger, and irc
server options.

Reported by:	Max Boyarov <max_b at tut dot by>
Approved by:	re (dhclient blanket)
2005-06-30 05:50:52 +00:00
Brooks Davis
b388f1cb10 People like to do RFC violating things with the domain-name option and
include a space seperated list of domains instead of the domain of the
host.  This is supported on too many platforms to break for now so,
remove validation of this option for the moment.

The correct solution longer term is to implement RFC 3397 support and
then treat domain-name options containing space seperated lists of
domains as domain-search options for backwards compatability.

Approved by:	re (dhclient blanket)
2005-06-30 05:32:42 +00:00
Ruslan Ermilov
f9ba39e985 Install the dhcp-options.5 manpage.
Timeout from:	brooks
Approved by:	re (blanket manpages)
2005-06-25 11:03:06 +00:00
Ruslan Ermilov
9a7feaa13c Line up the markup.
Approved by:	re (blanket)
2005-06-22 14:55:59 +00:00
Brooks Davis
59eac186e2 Avoid a null pointer dereference by not expiring our lease if we don't
have an active one.

Submitted by:	sam
Reported by:	James Snow <snow at teardrop dot org>
Approved by:	re (dhclient blanket)
2005-06-13 23:43:08 +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
9c13d9cd98 Fix build on 64-bit platforms where time_t is 64 bit. Since where
talking about time related to leases, it should be OK to cast these to
(int)s rather than using intmax_t.

Submitted by:	ru
Pointy hat:	brooks
2005-06-07 14:47:54 +00:00
Ruslan Ermilov
c55cd9092d - Remove OpenBSD'ism (bsd.own.mk).
- Remove redundant and harmful -Wall from CFLAGS.
2005-06-07 09:32:23 +00:00
Brooks Davis
43c56a9bd9 Use SCRIPTS to install dhclient-script instead of rolling our own. 2005-06-07 04:35:48 +00:00
Brooks Davis
8750adaf5a FreeBSDize the dhclient-script.
Submitted by:	sam
2005-06-07 04:32:29 +00:00
Brooks Davis
2b19b6fca1 Define _PATH_VAREMPTY.
Add a -b option to background immediatly.

Add support for 802.11 routing messages to "instantly" renegotiate
at lease when we associate with a new network.

Submitted by:	sam
2005-06-07 04:26:14 +00:00
Brooks Davis
b5be635a44 NULL is not a valid time_t.
Submitted by:	sam
2005-06-07 04:14:54 +00:00
Brooks Davis
1b3bb962f9 We don't support BPF write filters at this time.
Submitted by:	sam
2005-06-07 04:13:52 +00:00
Brooks Davis
955cf67bf4 Take the OpenBSD version of the Makefile to resolve conflicts as the old
one is irrelevent.  Add $FreeBSD.
2005-06-07 04:08:50 +00:00
Brooks Davis
24bd614bbd This commit was generated by cvs2svn to compensate for changes in r147072,
which included commits to RCS files with non-trunk default branches.
2005-06-07 04:05:09 +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
Brooks Davis
981e23b873 Remove the bits to build the isc-dhclient. 2005-06-07 04:02:10 +00:00
Ruslan Ermilov
254dd1666e Let bsd.prog.mk set SRCS and MAN to their default values. 2005-01-28 16:08:11 +00:00
Ruslan Ermilov
e653b48c80 Start the dreaded NOFOO -> NO_FOO conversion.
OK'ed by:	core
2004-12-21 08:47:35 +00:00
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
Johan Karlsson
604d24db95 style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
Murray Stokely
28149368ce Update maintainer line. mbr has been maintainer for at least the last
6 months.

Approved by:	re (murray)
2003-11-30 21:09:58 +00:00
Martin Blapp
35dfd13e0b Turn the annoying and long error message off. It was so
long that it was even hard to find the real error cause.

Requested by:	rwatson
2003-08-09 20:36:06 +00:00
Martin Blapp
636a538d15 Enable dhclient to poll the interface state and send only
requests if the interface has an active link. This is a
great benefit if you often change networks with your laptop
and you do not like to kill/restart dhclient all the time.
Changes are automatically detected and the link is refreshed.

The change allows us to start dhclient in background mode
Enable dhclient to poll the interface state and send only
requests if the interface has an active link. This is a
great benefit if you often change networks with your laptop
and you do not like to kill/restart dhclient all the time.
Changes are automatically detected and the link is refreshed.

The change allows us to start dhclient in background mode
while the network cable is not plugged in.

To control the polling interval, the option -i has been
introduced. It takes seconds as parameter, the minimum is
one second, the default is five seconds.

Polling is done in seconds, not microseconds, because dhclient
does internally work with timeouts in seconds.

This change will be part of the next major ISC-dhcpd release.

Tested by:	bms, imp, and many many others.
Reviewed by:	murray, eivind, dhclient folks
2003-07-28 08:30:11 +00:00
Gordon Tetlow
6d1b4a4730 Tweak a couple of utilities so they compile cleanly for /rescue. Mostly
path fixes.

Submitted by:	Tim Kientzle <kientzle@acm.org>
2003-06-29 18:46:18 +00:00
Matthew N. Dodd
7ff910a94b Hook omshell(1) up to the build. 2003-03-25 03:16:53 +00:00
Matthew N. Dodd
a47e79711b Building crunched things by hand (regenerating boot floppies for example)
without a full make release cycle fails as the correct include path
isn't setup.
2003-03-25 03:13:57 +00:00
Ruslan Ermilov
46f8fdc34e Removed now unused INTERNALSTATICLIB.
INTERNALLIB now implies NOPIC and NOPROFILE.
Removed gratuitous NOMAN.
2002-05-13 11:09:07 +00:00
David E. O'Brien
c3fa6e4e46 Do not use perl where sed is more than adequate. 2002-04-13 23:53:36 +00:00
Makoto Matsushita
0ed8a30f62 Fix "make release.4" breakage.
src/contrib/isc-dhcp/includes/minires/resolv.h has a 'extern' definition
but it makes an error when linking crunched binary just like this:

	dhclient.lo: In function `MRres_nquery':
	dhclient.lo(.text+0x2dcce): undefined reference to `__h_errno_set'
	dhclient.lo(.text+0x2dd5b): undefined reference to `__h_errno_set'
	dhclient.lo: In function `MRres_nquerydomain':
	dhclient.lo(.text+0x2de53): undefined reference to `__h_errno_set'

The author understands this will be a problem (see comments in resolv.h).
Murray said that the author will fix this, but as a temporary solution,
modifying the source code and not to use __h_errno_set.

BTW, I'm sorry that previous commitlog in src/sbin/dhclient/Makefile should
read "Found by:" instead of "Confirmed by"; I just found that rev 1.15
has a typo so fixed.

Tested on: ushi.jp.FreeBSD.org with today's 5-current source code.
           (belive me, "make release.4" works fine now)
2002-02-28 16:17:18 +00:00
Makoto Matsushita
226e3b6ec6 For unbraking "make release": s/client/common/g
(these files are sitting in src/contrib/isc-dhcp/common, not .../client.)

Confirmed by: 5.0-CURRENT-20020228-JPSNAP at snapshots.jp.FreeBSD.org
2002-02-28 00:02:33 +00:00
Murray Stokely
d52ccfe321 Add some ifdef(RELEASE_CRUNCH) goo to explicitly list the requisite
object files for crunchgen.  Without this patch, release.4 will fail
to build the crunched binaries for the release floppies.
2002-02-26 15:12:54 +00:00
David E. O'Brien
d5c6e8dee0 Neutralize bits of ns_parse.c with bad juju. 2002-02-20 05:45:59 +00:00
David E. O'Brien
3c442e5104 Style cleanup.
Approved by:	Murray
2002-02-19 22:23:49 +00:00
Murray Stokely
0829ba2c77 Makefile glue for DHCP v3 import. 2002-02-19 12:57:18 +00:00
Alfred Perlstein
b3dcd94961 If the dhcpd server doesn't provide a domain name or dns servers then
don't clobber /etc/resolv.conf

Add $FreeBSD.

Submitted by: an j. peterson" <rbw@myplace.org>
Verified fix in: dhcp-3.0.1rc6
PR: misc/34455
2002-02-01 18:46:58 +00:00
David E. O'Brien
2d68bf45bf Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
Ruslan Ermilov
b9ad8c8635 beforeinstall -> SCRIPTS. 2001-04-07 11:21:35 +00:00
Ruslan Ermilov
0a5779d45b - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
Jacques Vidrine
248aee623c Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.

= Hesiod has been added to libc (see hesiod(3)).

= A library routine for parsing nsswitch.conf and invoking callback
  functions as specified has been added to libc (see nsdispatch(3)).

= The following C library functions have been modified to use nsdispatch:
    . getgrent, getgrnam, getgrgid
    . getpwent, getpwnam, getpwuid
    . getusershell
    . getaddrinfo
    . gethostbyname, gethostbyname2, gethostbyaddr
    . getnetbyname, getnetbyaddr
    . getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr

= host.conf has been removed from src/etc.  rc.network has been modified
  to warn that host.conf is no longer used at boot time.  In addition, if
  there is a host.conf but no nsswitch.conf, the latter is created at boot
  time from the former.

Obtained from:	NetBSD
2000-09-06 18:16:48 +00:00
David E. O'Brien
fbc679ea4b Alternate script for dhclient to use in setting the received configuration
on the host.

PR:		15342
Submitted by:	Patrick Bihan-Faou <patrick@mindstep.com>
2000-07-27 20:49:27 +00:00
David E. O'Brien
f063845519 Blah, need to add /usr/bin to the path also.
Of course this is a bug in that the dhclient script will not work properly
if one has a local / and an NFS mounted /usr and needs to obtain its IP
address via DHCP before being able to mount /usr.
2000-07-21 19:08:22 +00:00
David E. O'Brien
fbb0d22951 Need /usr/sbin for arp(8). 2000-07-20 10:29:52 +00:00
David E. O'Brien
a3b867b670 Patchlevel 3 of the ISC 2.0 dhcp client now requires us to give it the
shell script's PATH setting in the environment.
2000-07-20 10:11:22 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
David E. O'Brien
d7f6c914c9 Add new file that needs compiling. 1999-06-24 08:13:21 +00:00
Bruce Evans
3e3aea1728 Install dhclient-script under ${DESTDIR}.
PR:		10615, 10891
1999-04-03 07:09:59 +00:00
David E. O'Brien
2a3a31d8ca More style fixes to bring this almost to bde's suggested version. 1999-02-18 18:56:58 +00:00
David E. O'Brien
a20d7fd0c0 bde suggests not to trust ${COPY} to always be defined.
also fix style bugs submitted by Bruce
1999-02-18 09:38:18 +00:00
David E. O'Brien
914345e310 bmake framework for ISC-DHCP client 1999-02-10 20:51:22 +00:00