summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 1a1d78b..e4a9a00 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 /etc/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 f5f8eb7..4c5e7d2 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"
@@ -93,7 +93,7 @@ int onetry;
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";
@@ -107,7 +107,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);
@@ -501,6 +501,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. */
@@ -524,8 +528,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);
}
@@ -1041,8 +1052,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);
}
@@ -1299,9 +1308,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);
}
@@ -1323,8 +1329,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)
@@ -1344,8 +1348,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)
@@ -1697,7 +1699,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,
@@ -2103,6 +2105,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 ();
}
OpenPOWER on IntegriCloud