aboutsummaryrefslogtreecommitdiff
path: root/contrib/isc-dhcp/client
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>1999-02-28 20:34:40 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>1999-02-28 20:34:40 +0000
commit06456076746ea64f78c59057928b2c7dfd2d734e (patch)
treedf4cd80f77d6ff8d12ecef362039cb4041880fa3 /contrib/isc-dhcp/client
parentb02401bdd6455578fb36dc5eed002b83d88e4954 (diff)
downloadsrc-06456076746ea64f78c59057928b2c7dfd2d734e.tar.gz
src-06456076746ea64f78c59057928b2c7dfd2d734e.zip
Virgin import of ISC-DHCP v2.0b1pl17vendor/isc-dhcp/2.0b1-pl.17
Notes
Notes: svn path=/vendor/isc-dhcp/dist/; revision=44335 svn path=/vendor/isc-dhcp/2.0b1-pl.17/; revision=44337; tag=vendor/isc-dhcp/2.0b1-pl.17
Diffstat (limited to 'contrib/isc-dhcp/client')
-rw-r--r--contrib/isc-dhcp/client/dhclient-script.84
-rw-r--r--contrib/isc-dhcp/client/dhclient.c33
2 files changed, 22 insertions, 15 deletions
diff --git a/contrib/isc-dhcp/client/dhclient-script.8 b/contrib/isc-dhcp/client/dhclient-script.8
index bae59b4634ed..6d1c9b72d004 100644
--- a/contrib/isc-dhcp/client/dhclient-script.8
+++ b/contrib/isc-dhcp/client/dhclient-script.8
@@ -55,7 +55,7 @@ modify an existing one. In general, customizations specific to a
particular computer should be done in the
.B ETCDIR/dhclient.conf
script. If you find that you can't make such a customization without
-customizing dhclient.conf, please submit a bug report.
+customizing dhclient-script, please submit a bug report.
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
writes a shell script into /tmp which defines a variety of variables.
@@ -89,7 +89,7 @@ no examples exist yet. The IP address to check is passed in
$new_ip_address, and the interface name is passed in $interface.
.SH ARPCHECK
The DHCP client wants to know if a response to the ARP request send
-using ARPCHECK has been received. If one has, the script should exit
+using ARPSEND has been received. If one has, the script should exit
with a nonzero status, indicating that the offered address has already
been requested and should be declined. $new_ip_address and
$interface are set as with ARPSEND.
diff --git a/contrib/isc-dhcp/client/dhclient.c b/contrib/isc-dhcp/client/dhclient.c
index 08fa4fcef895..d9a1b9f2c44d 100644
--- a/contrib/isc-dhcp/client/dhclient.c
+++ b/contrib/isc-dhcp/client/dhclient.c
@@ -56,7 +56,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.44.2.14 1999/02/09 04:59:50 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.44.2.24 1999/02/27 21:51:35 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -92,7 +92,7 @@ int save_scripts;
static char copyright[] =
"Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
static char arr [] = "All rights reserved.";
-static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl11";
+static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl17";
static char contrib [] = "\nPlease contribute if you find this software useful.";
static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n";
@@ -106,7 +106,7 @@ int main (argc, argv, envp)
struct servent *ent;
struct interface_info *ip;
int seed;
- int quiet;
+ int quiet = 0;
#ifdef SYSLOG_4_2
openlog ("dhclient", LOG_NDELAY);
@@ -498,6 +498,10 @@ void dhcpack (packet)
ip -> client -> new -> expiry =
getULong (ip -> client ->
new -> options [DHO_DHCP_LEASE_TIME].data);
+ /* A number that looks negative here is really just very large,
+ because the lease expiry offset is unsigned. */
+ if (ip -> client -> new -> expiry < 0)
+ ip -> client -> new -> expiry = TIME_MAX;
/* Take the server-provided renewal time if there is one;
otherwise figure it out according to the spec. */
@@ -521,8 +525,15 @@ void dhcpack (packet)
ip -> client -> new -> renewal / 4;
ip -> client -> new -> expiry += cur_time;
+ /* Lease lengths can never be negative. */
+ if (ip -> client -> new -> expiry < cur_time)
+ ip -> client -> new -> expiry = TIME_MAX;
ip -> client -> new -> renewal += cur_time;
+ if (ip -> client -> new -> renewal < cur_time)
+ ip -> client -> new -> renewal = TIME_MAX;
ip -> client -> new -> rebind += cur_time;
+ if (ip -> client -> new -> rebind < cur_time)
+ ip -> client -> new -> rebind = TIME_MAX;
bind_lease (ip);
}
@@ -1038,8 +1049,6 @@ void send_discover (ipp)
ip -> client -> packet_length,
inaddr_any, &sockaddr_broadcast,
(struct hardware *)0);
- if (result < 0)
- warn ("send_packet: %m");
add_timeout (cur_time + ip -> client -> interval, send_discover, ip);
}
@@ -1292,9 +1301,6 @@ void send_request (ipp)
from, &destination,
(struct hardware *)0);
- if (result < 0)
- warn ("send_packet: %m");
-
add_timeout (cur_time + ip -> client -> interval,
send_request, ip);
}
@@ -1316,8 +1322,6 @@ void send_decline (ipp)
ip -> client -> packet_length,
inaddr_any, &sockaddr_broadcast,
(struct hardware *)0);
- if (result < 0)
- warn ("send_packet: %m");
}
void send_release (ipp)
@@ -1337,8 +1341,6 @@ void send_release (ipp)
ip -> client -> packet_length,
inaddr_any, &sockaddr_broadcast,
(struct hardware *)0);
- if (result < 0)
- warn ("send_packet: %m");
}
void make_discover (ip, lease)
@@ -1690,7 +1692,7 @@ void make_release (ip, lease)
ip -> client -> packet.htype = ip -> hw_address.htype;
ip -> client -> packet.hlen = ip -> hw_address.hlen;
ip -> client -> packet.hops = 0;
- ip -> client -> packet.xid = ip -> client -> xid;
+ ip -> client -> packet.xid = random ();
ip -> client -> packet.secs = 0;
ip -> client -> packet.flags = 0;
memcpy (&ip -> client -> packet.ciaddr,
@@ -2096,6 +2098,11 @@ void go_daemon ()
/* Become session leader and get pid... */
pid = setsid ();
+ /* Close standard I/O descriptors. */
+ close(0);
+ close(1);
+ close(2);
+
write_client_pid_file ();
}