Commit 4b9b0514 authored by Thomas Markwalder's avatar Thomas Markwalder

[#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
parent 5ea0daf4
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)
......
......@@ -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_);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment