diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index bac19f49b9..c104ff73e7 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -1695,18 +1695,17 @@ Memfile_LeaseMgr::getLeases6Internal(SubnetID subnet_id, Lease6StorageSubnetIdIndex::const_iterator lb = idx.lower_bound(boost::make_tuple(subnet_id, lower_bound_address)); + // Exclude the lower bound address specified by the caller. + if ((lb != idx.end()) && ((*lb)->addr_ == lower_bound_address)) { + ++lb; + } + // Return all leases being within the page size. - IOAddress last_addr = lower_bound_address; for (auto it = lb; it != idx.end(); ++it) { - if ((*it)->addr_ == last_addr) { - // Already seen: skip it. - continue; - } if ((*it)->subnet_id_ != subnet_id) { // Gone after the subnet id index. break; } - last_addr = (*it)->addr_; collection.push_back(Lease6Ptr(new Lease6(**it))); if (collection.size() >= page_size.page_size_) { break; diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.h b/src/lib/dhcpsrv/memfile_lease_mgr.h index 54072dffc8..bda0757ec1 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.h +++ b/src/lib/dhcpsrv/memfile_lease_mgr.h @@ -373,7 +373,7 @@ class Memfile_LeaseMgr : public TrackingLeaseMgr { getLeases6(const asiolink::IOAddress& lower_bound_address, const LeasePageSize& page_size) const override; - /// @brief Returns a page of IPv6 leases for a subnet identifier. + /// @brief Returns a page of IPv6 leases for a subnet identifier. /// /// @param subnet_id subnet identifier. /// @param lower_bound_address IPv6 address used as lower bound for the @@ -732,7 +732,7 @@ class Memfile_LeaseMgr : public TrackingLeaseMgr { const LeasePageSize& page_size, Lease6Collection& collection) const; - /// @brief Returns a page of IPv6 leases for a subnet identifier. + /// @brief Returns a page of IPv6 leases for a subnet identifier. /// /// @param subnet_id subnet identifier. /// @param lower_bound_address IPv6 address used as lower bound for the diff --git a/src/lib/dhcpsrv/memfile_lease_storage.h b/src/lib/dhcpsrv/memfile_lease_storage.h index 96dda3815c..d5a8b3fa4e 100644 --- a/src/lib/dhcpsrv/memfile_lease_storage.h +++ b/src/lib/dhcpsrv/memfile_lease_storage.h @@ -125,7 +125,7 @@ typedef boost::multi_index_container< // Specification of the fourth index starts here. // This index sorts leases by SubnetID and address. - boost::multi_index::ordered_non_unique< + boost::multi_index::ordered_unique< boost::multi_index::tag, boost::multi_index::composite_key< Lease6,