From: Ted Lemon Date: Tue, 17 Mar 1998 18:19:44 +0000 (+0000) Subject: Add dissociate_lease(). Abandon leases but don't _really_ abandon them - sort them... X-Git-Tag: carrel-2~146 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ca2eda92d5e29538fb83476e2b6c10823121cd4;p=thirdparty%2Fdhcp.git Add dissociate_lease(). Abandon leases but don't _really_ abandon them - sort them back into the list so that they can be reclaimed later. --- diff --git a/common/memory.c b/common/memory.c index 7e4af6bbd..e8b6ca8f4 100644 --- a/common/memory.c +++ b/common/memory.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: memory.c,v 1.37 1998/03/17 06:11:25 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: memory.c,v 1.38 1998/03/17 18:19:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -647,7 +647,7 @@ void abandon_lease (lease, message) lease -> flags |= ABANDONED_LEASE; lt = *lease; - lt.ends = MAX_TIME; + lt.ends = cur_time; /* XXX */ warn ("Abandoning IP address %s: %s", piaddr (lease -> ip_addr), message); lt.hardware_addr.htype = 0; @@ -657,6 +657,25 @@ void abandon_lease (lease, message) supersede_lease (lease, <, 1); } +/* Abandon the specified lease (set its timeout to infinity and its + particulars to zero, and re-hash it as appropriate. */ + +void dissociate_lease (lease, message) + struct lease *lease; + char *message; +{ + struct lease lt; + + lt = *lease; + if (lt.ends > cur_time) + lt.ends = cur_time; + lt.hardware_addr.htype = 0; + lt.hardware_addr.hlen = 0; + lt.uid = (unsigned char *)0; + lt.uid_len = 0; + supersede_lease (lease, <, 1); +} + /* Locate the lease associated with a given IP address... */ struct lease *find_lease_by_ip_addr (addr)