]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Don't enter leases that don't have subnets.
authorTed Lemon <source@isc.org>
Fri, 29 Sep 2000 18:21:33 +0000 (18:21 +0000)
committerTed Lemon <source@isc.org>
Fri, 29 Sep 2000 18:21:33 +0000 (18:21 +0000)
server/mdb.c

index 8475c456c7d97c4db9a92eeb2f5818e5990b6cf6..ce40563f8e74741cd600bfb0f9dda3f7c40e5295 100644 (file)
@@ -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);