From: Thomas Markwalder Date: Tue, 30 Jul 2019 20:19:57 +0000 (-0400) Subject: [#750,!440] Added unit tests to allocation engine X-Git-Tag: Kea-1.6.0~41^2~150 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b9b0514cbf4effffc59a9e9667b573719ec09ec;p=thirdparty%2Fkea.git [#750,!440] Added unit tests to allocation engine 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 --- diff --git a/ChangeLog b/ChangeLog index ae34760f05..ce03b2c6ff 100644 --- 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) diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index fc44a25b8b..9032974972 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -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_);