]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#750,!440] Added unit tests to allocation engine
authorThomas Markwalder <tmark@isc.org>
Tue, 30 Jul 2019 20:19:57 +0000 (16:19 -0400)
committerThomas Markwalder <tmark@isc.org>
Wed, 7 Aug 2019 13:34:04 +0000 (09:34 -0400)
src/lib/dhcpsrv/alloc_engine.cc
     AllocEngine::removeNonreservedLeases6() -
     exits with no action if the existing list of leases contains
     one or less

added ChangeLog entry

ChangeLog
src/lib/dhcpsrv/alloc_engine.cc

index ae34760f05f1e49cee4962d301001bb50b465f08..ce03b2c6ffb47a7fbc474fd106dfe417e347bc0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1637.  [bug]           tmark
+       Corrected an issue in kea-dhcp6 where the server would assign
+       a different lease each time a client with a dynamic host
+       reservation returned via a SOLICIT.
+       (Gitlab #754,!440,      git TBD)
+
 1636.  [bug]           razvan
        Http request and response parser accepts Content-Length set to 0.
        (Gitlab #708,!423, git 09d75804e050083b502a96c8e77b0e98c735ae3d)
index fc44a25b8b48ac466ce701708208642b862ff8e8..9032974972654e756a5cd9cbd22451722b5ae5e3 100644 (file)
@@ -1539,14 +1539,12 @@ void
 AllocEngine::removeNonreservedLeases6(ClientContext6& ctx,
                                       Lease6Collection& existing_leases) {
     // This method removes leases that are not reserved for this host.
-    // It will keep at least one lease, though.
-    if (existing_leases.empty()) {
+    // It will keep at least one lease, though, as a fallback.
+    int total = existing_leases.size();
+    if (total <= 1) {
         return;
     }
 
-    // This is the total number of leases. We should not remove the last one.
-    int total = existing_leases.size();
-
     // This is officially not scary code anymore. iterates and marks specified
     // leases for deletion, by setting appropriate pointers to NULL.
     for (Lease6Collection::iterator lease = existing_leases.begin();
@@ -1560,6 +1558,9 @@ AllocEngine::removeNonreservedLeases6(ClientContext6& ctx,
             continue;
         }
 
+        // @todo - If this is for a fake_allocation, we should probably
+        // not be deleting the lease or removing DNS entries.  We should
+        // simply remove it from the list.
         // We have reservations, but not for this lease. Release it.
         // Remove this lease from LeaseMgr
         LeaseMgrFactory::instance().deleteLease((*lease)->addr_);