From: Ted Lemon Date: Wed, 5 Mar 1997 06:24:21 +0000 (+0000) Subject: Add an INIT-REBOOT timeout; don't ever call a static lease the active lease X-Git-Tag: DHCP-970305~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7550b9ef7c83be6ff9b99b2d6d20e0005e504b1a;p=thirdparty%2Fdhcp.git Add an INIT-REBOOT timeout; don't ever call a static lease the active lease --- diff --git a/client/clparse.c b/client/clparse.c index 8d92f8bf9..c90d637e2 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. */ }