]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- supersede_lease() now requeues leases in their respective hardware
authorDavid Hankins <dhankins@isc.org>
Fri, 8 Jun 2007 18:56:30 +0000 (18:56 +0000)
committerDavid Hankins <dhankins@isc.org>
Fri, 8 Jun 2007 18:56:30 +0000 (18:56 +0000)
  address hash bucket.  This mirrors client identifier behaviour.
  [ISC-Bugs #16936]

RELNOTES
server/mdb.c

index 5b5e8b7c0485daf0b78a7beaedc17aeb63c82de5..1b23432938ead37e081095c18783293108ef3e47 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -372,6 +372,11 @@ suggested fixes to <dhcp-users@isc.org>.
 - Encapsulated option spaces within encapsulated option spaces is now
   formally supported.
 
+                       Changes since 3.0.6rc1
+
+- supersede_lease() now requeues leases in their respective hardware
+  address hash bucket.  This mirrors client identifier behaviour.
+
                        Changes since 3.0.5
 
 - Assorted fixes for broken network devices:  Packet length is now
index 6c979cff4bec65ef6567cfbdabdbae3cc69c7188..8bc7311358172782f87d4e3dd3c7343540487d89 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: mdb.c,v 1.91 2007/05/19 19:16:27 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: mdb.c,v 1.92 2007/06/08 18:56:30 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1064,8 +1064,6 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate)
        int propogate;
        int pimmediate;
 {
-       int enter_uid = 0;
-       int enter_hwaddr = 0;
        struct lease *lp, **lq, *prev;
        TIME lp_next_state;
 #if defined (FAILOVER_PROTOCOL)
@@ -1113,28 +1111,21 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate)
 
        /* If there's a Unique ID, dissociate it from the hash
           table and free it if necessary. */
-       if (comp -> uid) {
-               uid_hash_delete (comp);
-               enter_uid = 1;
-               if (comp -> uid != &comp -> uid_buf [0]) {
-                       dfree (comp -> uid, MDL);
-                       comp -> uid_max = 0;
-                       comp -> uid_len = 0;
+       if (comp->uid) {
+               uid_hash_delete(comp);
+               if (comp->uid != comp->uid_buf) {
+                       dfree(comp->uid, MDL);
+                       comp->uid_max = 0;
+                       comp->uid_len = 0;
                }
                comp -> uid = (unsigned char *)0;
-       } else
-               enter_uid = 1;
-
-       if (comp -> hardware_addr.hlen &&
-           ((comp -> hardware_addr.hlen !=
-             lease -> hardware_addr.hlen) ||
-            memcmp (comp -> hardware_addr.hbuf,
-                    lease -> hardware_addr.hbuf,
-                    comp -> hardware_addr.hlen))) {
-               hw_hash_delete (comp);
-               enter_hwaddr = 1;
-       } else if (!comp -> hardware_addr.hlen)
-               enter_hwaddr = 1;
+       }
+
+       /* If there's a hardware address, remove the lease from its
+        * old position in the hash bucket's ordered list.
+        */
+       if (comp->hardware_addr.hlen)
+               hw_hash_delete(comp);
 
        /* If the lease has been billed to a class, remove the billing. */
        if (comp -> billing_class != lease -> billing_class) {
@@ -1224,14 +1215,12 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate)
        }
 
        /* Record the lease in the uid hash if necessary. */
-       if (enter_uid && comp -> uid) {
-               uid_hash_add (comp);
-       }
+       if (comp->uid)
+               uid_hash_add(comp);
 
        /* Record it in the hardware address hash if necessary. */
-       if (enter_hwaddr && lease -> hardware_addr.hlen) {
-               hw_hash_add (comp);
-       }
+       if (comp->hardware_addr.hlen)
+               hw_hash_add(comp);
 
        comp->cltt = lease->cltt;
 #if defined (FAILOVER_PROTOCOL)