summaryrefslogtreecommitdiff
path: root/client/clparse.c
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1997-03-05 06:24:21 +0000
committerTed Lemon <source@isc.org>1997-03-05 06:24:21 +0000
commit7550b9ef7c83be6ff9b99b2d6d20e0005e504b1a (patch)
tree5dc5cc27048e849c1509031673d725b449b48c42 /client/clparse.c
parent8314a2823cf4083ebe27b57d67b9e10d0efb492e (diff)
downloadisc-dhcp-7550b9ef7c83be6ff9b99b2d6d20e0005e504b1a.tar.gz
Add an INIT-REBOOT timeout; don't ever call a static lease the active lease
Diffstat (limited to 'client/clparse.c')
-rw-r--r--client/clparse.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/client/clparse.c b/client/clparse.c
index 8d92f8bf..c90d637e 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.5 1997/02/27 03:39:11 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.6 1997/03/05 06:24:21 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -149,6 +149,7 @@ void read_client_leases ()
REQUIRE option-list |
TIMEOUT number |
RETRY number |
+ REBOOT number |
SELECT_TIMEOUT number |
SCRIPT string |
interface-declaration |
@@ -209,6 +210,10 @@ void parse_client_statement (cfile, ip, config)
parse_lease_time (cfile, &config -> select_interval);
return;
+ case REBOOT:
+ parse_lease_time (cfile, &config -> reboot_timeout);
+ return;
+
case SCRIPT:
config -> script_name = parse_string (cfile);
return;
@@ -500,6 +505,32 @@ void parse_client_lease_statement (cfile, is_static)
return;
}
+ /* The new lease may supersede a lease that's not the
+ active lease but is still on the lease list, so scan the
+ lease list looking for a lease with the same address, and
+ if we find it, toss it. */
+ pl = (struct client_lease *)0;
+ for (lp = ip -> client -> leases; lp; lp = lp -> next) {
+ if (lp -> address.len == lease -> address.len &&
+ !memcmp (lp -> address.iabuf, lease -> address.iabuf,
+ lease -> address.len)) {
+ if (pl)
+ pl -> next = lp -> next;
+ else
+ ip -> client -> leases = lp -> next;
+ free_client_lease (lp);
+ break;
+ }
+ }
+
+ /* If this is a preloaded lease, just put it on the list of recorded
+ leases - don't make it the active lease. */
+ if (is_static) {
+ lease -> next = ip -> client -> leases;
+ ip -> client -> leases = lease;
+ return;
+ }
+
/* The last lease in the lease file on a particular interface is
the active lease for that interface. Of course, we don't know
what the last lease in the file is until we've parsed the whole
@@ -528,23 +559,6 @@ void parse_client_lease_statement (cfile, is_static)
}
ip -> client -> active = lease;
- /* The current lease may supersede a lease that's not the
- active lease but is still on the lease list, so scan the
- lease list looking for a lease with the same address, and
- if we find it, toss it. */
- pl = (struct client_lease *)0;
- for (lp = ip -> client -> leases; lp; lp = lp -> next) {
- if (lp -> address.len == lease -> address.len &&
- !memcmp (lp -> address.iabuf, lease -> address.iabuf,
- lease -> address.len)) {
- if (pl)
- pl -> next = lp -> next;
- else
- ip -> client -> leases = lp -> next;
- free_client_lease (lp);
- break;
- }
- }
/* phew. */
}