]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3149] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Wed, 17 Jan 2024 09:11:12 +0000 (10:11 +0100)
committerFrancis Dupont <fdupont@isc.org>
Wed, 17 Jan 2024 10:06:16 +0000 (11:06 +0100)
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/memfile_lease_storage.h

index bac19f49b9879888e6b395830311e9edc1870a5c..c104ff73e702728ff72950edd358287305591f0d 100644 (file)
@@ -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;
index 54072dffc8ee48f50b28e6e0de4205acbaf3be3a..bda0757ec1a3baf5625f3c7937aa12f93f13c1dc 100644 (file)
@@ -373,7 +373,7 @@ public:
     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 @@ private:
                             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
index 96dda3815c77515a8194249f01ddb8325f87a5f1..d5a8b3fa4eceacd084d534488c77742dcbe49005 100644 (file)
@@ -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<SubnetIdIndexTag>,
             boost::multi_index::composite_key<
                 Lease6,