From: Ted Lemon Date: Fri, 29 Sep 2000 18:21:33 +0000 (+0000) Subject: Don't enter leases that don't have subnets. X-Git-Tag: V3-BETA-2-PATCH-6~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e775b7b6da689d34031007eae7aacf7d319c3a9;p=thirdparty%2Fdhcp.git Don't enter leases that don't have subnets. --- diff --git a/server/mdb.c b/server/mdb.c index 8475c456c..ce40563f8 100644 --- a/server/mdb.c +++ b/server/mdb.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: mdb.c,v 1.42 2000/08/28 19:36:13 neild Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: mdb.c,v 1.43 2000/09/29 18:21:33 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -733,12 +733,25 @@ void enter_lease (lease) if (comp -> subnet) subnet_reference (&lease -> subnet, comp -> subnet, MDL); - lease_hash_delete (lease_ip_addr_hash, lease -> ip_addr.iabuf, lease -> ip_addr.len, MDL); lease_dereference (&comp, MDL); } + + /* The only way a lease can get here without a subnet is if it's in + the lease file, but not in the dhcpd.conf file. In this case, we + *should* keep it around until it's expired, but never reallocate it + or renew it. Currently, to maintain consistency, we are not doing + this. + XXX fix this so that the lease is kept around until it expires. + XXX this will be important in IPv6 with addresses that become + XXX non-renewable as a result of a renumbering event. */ + + if (!lease -> subnet) { + log_error ("lease %s: no subnet.", piaddr (lease -> ip_addr)); + return; + } lease_hash_add (lease_ip_addr_hash, lease -> ip_addr.iabuf, lease -> ip_addr.len, lease, MDL);