From: Ted Lemon Date: Thu, 25 Jun 1998 21:20:41 +0000 (+0000) Subject: If a client REQUESTs an abandoned lease, reclaim it. X-Git-Tag: V2-BETA-1-PATCH-2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea3f25096370bcc71a9723bd76f60b226ce769b7;p=thirdparty%2Fdhcp.git If a client REQUESTs an abandoned lease, reclaim it. --- diff --git a/server/dhcp.c b/server/dhcp.c index 94c31c5fb..2f1573c0a 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.57.2.2 1998/06/25 21:11:35 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.57.2.3 1998/06/25 21:20:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1241,9 +1241,13 @@ struct lease *find_lease (packet, share, ours) *ours = 1; /* If the requested IP address isn't on the network the packet - came from, or if it's been abandoned, don't use it. */ - if (ip_lease && (ip_lease -> shared_network != share || - (ip_lease -> flags & ABANDONED_LEASE))) + came from, don't use it. Allow abandoned leases to be matched + here - if the client is requesting it, there's a decent chance + that it's because the lease database got trashed and a client + that thought it had this lease answered an ARP or PING, causing the + lease to be abandoned. If so, this request probably came from + that client. */ + if (ip_lease && (ip_lease -> shared_network != share)) ip_lease = (struct lease *)0; /* Toss ip_lease if it hasn't yet expired and the uid doesn't @@ -1377,6 +1381,15 @@ struct lease *find_lease (packet, share, ours) } } + /* If we find an abandoned lease, take it, but print a + warning message, so that if it continues to lose, + the administrator will eventually investigate. */ + if (lease -> flags & ABANDONED_LEASE) { + warn ("Reclaiming REQUESTed abandoned IP address %s.\n", + piaddr (lease -> ip_addr)); + lease -> flags &= ~ABANDONED_LEASE; + } + return lease; }