]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3149] Removed link filter on relay/remote
authorFrancis Dupont <fdupont@isc.org>
Mon, 20 Nov 2023 21:14:24 +0000 (22:14 +0100)
committerFrancis Dupont <fdupont@isc.org>
Wed, 13 Dec 2023 13:35:58 +0000 (14:35 +0100)
14 files changed:
src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc
src/lib/dhcpsrv/dhcpsrv_messages.cc
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc
src/lib/dhcpsrv/testutils/concrete_lease_mgr.cc
src/lib/dhcpsrv/testutils/concrete_lease_mgr.h
src/lib/dhcpsrv/testutils/generic_lease_extended_info_unittest.h

index 9b95b5e08d271598db5b9d1c374a87e954d08d14..181042b8c4f48755202f3af1cbf9395baf6b3aad 100644 (file)
@@ -1139,16 +1139,12 @@ void Lease6CmdsTest::testLease6AddExtendedInfo() {
     Lease6Collection leases;
     vector<uint8_t> remote_id = { 1, 2, 3, 4, 5, 6 };
     leases = lmptr_->getLeases6ByRemoteId(remote_id,
-                                          IOAddress::IPV6_ZERO_ADDRESS(),
-                                          0,
                                           IOAddress::IPV6_ZERO_ADDRESS(),
                                           LeasePageSize(10));
     EXPECT_TRUE(leases.empty());
     vector<uint8_t> relay_bin(8, 0x64);
     DuidPtr relay_id(new DUID(relay_bin));
     leases = lmptr_->getLeases6ByRelayId(*relay_id,
-                                         IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     EXPECT_TRUE(leases.empty());
@@ -1195,8 +1191,6 @@ void Lease6CmdsTest::testLease6AddExtendedInfo() {
 
     // Check that BLQ tables were updated.
     leases = lmptr_->getLeases6ByRemoteId(remote_id,
-                                          IOAddress::IPV6_ZERO_ADDRESS(),
-                                          0,
                                           IOAddress::IPV6_ZERO_ADDRESS(),
                                           LeasePageSize(10));
     // The lease must be retrieved from the remote id table.
@@ -1208,8 +1202,6 @@ void Lease6CmdsTest::testLease6AddExtendedInfo() {
 
     // The lease must be retrieved from the relay id table.
     leases = lmptr_->getLeases6ByRelayId(*relay_id,
-                                         IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     ASSERT_EQ(1, leases.size());
@@ -2583,16 +2575,12 @@ void Lease6CmdsTest::testLease6UpdateExtendedInfo() {
     Lease6Collection leases;
     vector<uint8_t> remote_id = { 1, 2, 3, 4, 5, 6 };
     leases = lmptr_->getLeases6ByRemoteId(remote_id,
-                                          IOAddress::IPV6_ZERO_ADDRESS(),
-                                          0,
                                           IOAddress::IPV6_ZERO_ADDRESS(),
                                           LeasePageSize(10));
     EXPECT_TRUE(leases.empty());
     vector<uint8_t> relay_bin(8, 0x64);
     DuidPtr relay_id(new DUID(relay_bin));
     leases = lmptr_->getLeases6ByRelayId(*relay_id,
-                                         IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     EXPECT_TRUE(leases.empty());
@@ -2639,8 +2627,6 @@ void Lease6CmdsTest::testLease6UpdateExtendedInfo() {
 
     // Check that BLQ tables were updated.
     leases = lmptr_->getLeases6ByRemoteId(remote_id,
-                                          IOAddress::IPV6_ZERO_ADDRESS(),
-                                          0,
                                           IOAddress::IPV6_ZERO_ADDRESS(),
                                           LeasePageSize(10));
     // The lease must be retrieved from the remote id table.
@@ -2652,8 +2638,6 @@ void Lease6CmdsTest::testLease6UpdateExtendedInfo() {
 
     // The lease must be retrieved from the relay id table.
     leases = lmptr_->getLeases6ByRelayId(*relay_id,
-                                         IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     ASSERT_EQ(1, leases.size());
@@ -3411,16 +3395,12 @@ void Lease6CmdsTest::testLease6BulkApplyUpdatesOnlyExtendedInfo() {
     Lease6Collection leases;
     vector<uint8_t> remote_id = { 1, 2, 3, 4, 5, 6 };
     leases = lmptr_->getLeases6ByRemoteId(remote_id,
-                                          IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     EXPECT_TRUE(leases.empty());
     vector<uint8_t> relay_bin(8, 0x64);
     DuidPtr relay_id(new DUID(relay_bin));
     leases = lmptr_->getLeases6ByRelayId(*relay_id,
-                                         IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     EXPECT_TRUE(leases.empty());
@@ -3479,8 +3459,6 @@ void Lease6CmdsTest::testLease6BulkApplyUpdatesOnlyExtendedInfo() {
 
     // Check that BLQ tables were updated.
     leases = lmptr_->getLeases6ByRemoteId(remote_id,
-                                          IOAddress::IPV6_ZERO_ADDRESS(),
-                                          0,
                                           IOAddress::IPV6_ZERO_ADDRESS(),
                                           LeasePageSize(10));
     ASSERT_EQ(1, leases.size());
@@ -3489,8 +3467,6 @@ void Lease6CmdsTest::testLease6BulkApplyUpdatesOnlyExtendedInfo() {
     EXPECT_EQ(IOAddress("2001:db8:1::2"), lx->addr_);
     EXPECT_EQ(*lease2, *lx);
     leases = lmptr_->getLeases6ByRelayId(*relay_id,
-                                         IOAddress::IPV6_ZERO_ADDRESS(),
-                                         0,
                                          IOAddress::IPV6_ZERO_ADDRESS(),
                                          LeasePageSize(10));
     ASSERT_EQ(1, leases.size());
index 0ac3856f8f43840f684e7da08ee2bdf352f6d00d..dbd2ba661f1fcd8ab9614a7d199b91ffeaae552c 100644 (file)
@@ -398,9 +398,9 @@ const char* values[] = {
     "DHCPSRV_MEMFILE_GET_PAGE4", "obtaining at most %1 IPv4 leases starting from address %2",
     "DHCPSRV_MEMFILE_GET_PAGE6", "obtaining at most %1 IPv6 leases starting from address %2",
     "DHCPSRV_MEMFILE_GET_RELAYID4", "obtaining at most %1 IPv4 leases starting from address %2 with relay id %3 and cltt between %4 and %5",
-    "DHCPSRV_MEMFILE_GET_RELAYID6", "obtaining at most %1 IPv6 leases starting from address %2 with relay id %3 and link %4/%5",
+    "DHCPSRV_MEMFILE_GET_RELAYID6", "obtaining at most %1 IPv6 leases starting from address %2 with relay id %3",
     "DHCPSRV_MEMFILE_GET_REMOTEID4", "obtaining at most %1 IPv4 leases starting from address %2 with remote id %3 and cltt between %4 and %5",
-    "DHCPSRV_MEMFILE_GET_REMOTEID6", "obtaining at most %1 IPv6 leases starting from address %2 with remote id %3 and link %4/%5",
+    "DHCPSRV_MEMFILE_GET_REMOTEID6", "obtaining at most %1 IPv6 leases starting from address %2 with remote id %3",
     "DHCPSRV_MEMFILE_GET_SUBID4", "obtaining IPv4 leases for subnet ID %1",
     "DHCPSRV_MEMFILE_GET_SUBID6", "obtaining IPv6 leases for subnet ID %1",
     "DHCPSRV_MEMFILE_GET_SUBID_CLIENTID", "obtaining IPv4 lease for subnet ID %1 and client ID %2",
@@ -456,9 +456,9 @@ const char* values[] = {
     "DHCPSRV_MYSQL_GET_PAGE4", "obtaining at most %1 IPv4 leases starting from address %2",
     "DHCPSRV_MYSQL_GET_PAGE6", "obtaining at most %1 IPv6 leases starting from address %2",
     "DHCPSRV_MYSQL_GET_RELAYID4", "obtaining at most %1 IPv4 leases starting from address %2 with relay id %3 and cltt between %4 and %5",
-    "DHCPSRV_MYSQL_GET_RELAYID6", "obtaining at most %1 IPv6 leases starting from address %2 with relay id %3 and link %4/%5",
+    "DHCPSRV_MYSQL_GET_RELAYID6", "obtaining at most %1 IPv6 leases starting from address %2 with relay id %3",
     "DHCPSRV_MYSQL_GET_REMOTEID4", "obtaining at most %1 IPv4 leases starting from address %2 with remote id %3 and cltt between %4 and %5",
-    "DHCPSRV_MYSQL_GET_REMOTEID6", "obtaining at most %1 IPv6 leases starting from address %2 with remote id %3 and link %4/%5",
+    "DHCPSRV_MYSQL_GET_REMOTEID6", "obtaining at most %1 IPv6 leases starting from address %2 with remote id %3",
     "DHCPSRV_MYSQL_GET_SUBID4", "obtaining IPv4 leases for subnet ID %1",
     "DHCPSRV_MYSQL_GET_SUBID6", "obtaining IPv6 leases for subnet ID %1",
     "DHCPSRV_MYSQL_GET_SUBID_CLIENTID", "obtaining IPv4 lease for subnet ID %1 and client ID %2",
@@ -516,9 +516,9 @@ const char* values[] = {
     "DHCPSRV_PGSQL_GET_PAGE4", "obtaining at most %1 IPv4 leases starting from address %2",
     "DHCPSRV_PGSQL_GET_PAGE6", "obtaining at most %1 IPv6 leases starting from address %2",
     "DHCPSRV_PGSQL_GET_RELAYID4", "obtaining at most %1 IPv4 leases starting from address %2 with relay id %3 and cltt between %4 and %5",
-    "DHCPSRV_PGSQL_GET_RELAYID6", "obtaining at most %1 IPv6 leases starting from address %2 with relay id %3 and link %4/%5",
+    "DHCPSRV_PGSQL_GET_RELAYID6", "obtaining at most %1 IPv6 leases starting from address %2 with relay id %3",
     "DHCPSRV_PGSQL_GET_REMOTEID4", "obtaining at most %1 IPv4 leases starting from address %2 with remote id %3 and cltt between %4 and %5",
-    "DHCPSRV_PGSQL_GET_REMOTEID6", "obtaining at most %1 IPv6 leases starting from address %2 with remote id %3 and link %4/%5",
+    "DHCPSRV_PGSQL_GET_REMOTEID6", "obtaining at most %1 IPv6 leases starting from address %2 with remote id %3",
     "DHCPSRV_PGSQL_GET_SUBID4", "obtaining IPv4 leases for subnet ID %1",
     "DHCPSRV_PGSQL_GET_SUBID6", "obtaining IPv6 leases for subnet ID %1",
     "DHCPSRV_PGSQL_GET_SUBID_CLIENTID", "obtaining IPv4 lease for subnet ID %1 and client ID %2",
index 67ce063d4daaae960b90b9c99615083086cb6014..b79d2110f800a77e1e429e764d5301f2938b2ca4 100644 (file)
@@ -597,18 +597,18 @@ A debug message issued when the server is attempting to obtain a page of
 IPv4 leases beginning with the specified address with a relay id and client
 transaction time between start and end dates.
 
-% DHCPSRV_MEMFILE_GET_RELAYID6 obtaining at most %1 IPv6 leases starting from address %2 with relay id %3 and link %4/%5
+% DHCPSRV_MEMFILE_GET_RELAYID6 obtaining at most %1 IPv6 leases starting from address %2 with relay id %3
 A debug message issued when the server is attempting to obtain a page of
-IPv6 leases beginning with the specified address with a relay id and a link.
+IPv6 leases beginning with the specified address with a relay id.
 
 % DHCPSRV_MEMFILE_GET_REMOTEID4 obtaining at most %1 IPv4 leases starting from address %2 with remote id %3 and cltt between %4 and %5
 A debug message issued when the server is attempting to obtain a page of
 IPv4 leases beginning with the specified address with a remote id and
 client transaction time between start and end dates.
 
-% DHCPSRV_MEMFILE_GET_REMOTEID6 obtaining at most %1 IPv6 leases starting from address %2 with remote id %3 and link %4/%5
+% DHCPSRV_MEMFILE_GET_REMOTEID6 obtaining at most %1 IPv6 leases starting from address %2 with remote id %3
 A debug message issued when the server is attempting to obtain a page of
-IPv6 leases beginning with the specified address with a remote id and a link.
+IPv6 leases beginning with the specified address with a remote id.
 
 % DHCPSRV_MEMFILE_GET_SUBID4 obtaining IPv4 leases for subnet ID %1
 A debug message issued when the server is attempting to obtain all IPv4
@@ -885,18 +885,18 @@ A debug message issued when the server is attempting to obtain a page of
 IPv4 leases beginning with the specified address with a relay id and client
 transaction time between start and end dates.
 
-% DHCPSRV_MYSQL_GET_RELAYID6 obtaining at most %1 IPv6 leases starting from address %2 with relay id %3 and link %4/%5
+% DHCPSRV_MYSQL_GET_RELAYID6 obtaining at most %1 IPv6 leases starting from address %2 with relay id %3
 A debug message issued when the server is attempting to obtain a page of
-IPv6 leases beginning with the specified address with a relay id and a link.
+IPv6 leases beginning with the specified address with a relay id.
 
 % DHCPSRV_MYSQL_GET_REMOTEID4 obtaining at most %1 IPv4 leases starting from address %2 with remote id %3 and cltt between %4 and %5
 A debug message issued when the server is attempting to obtain a page of
 IPv4 leases beginning with the specified address with a remote id and client
 transaction time between start and end dates.
 
-% DHCPSRV_MYSQL_GET_REMOTEID6 obtaining at most %1 IPv6 leases starting from address %2 with remote id %3 and link %4/%5
+% DHCPSRV_MYSQL_GET_REMOTEID6 obtaining at most %1 IPv6 leases starting from address %2 with remote id %3
 A debug message issued when the server is attempting to obtain a page of
-IPv6 leases beginning with the specified address with a remote id and a link.
+IPv6 leases beginning with the specified address with a remote id.
 
 % DHCPSRV_MYSQL_GET_SUBID4 obtaining IPv4 leases for subnet ID %1
 A debug message issued when the server is attempting to obtain all IPv4
@@ -1165,18 +1165,18 @@ A debug message issued when the server is attempting to obtain a page of
 IPv4 leases beginning with the specified address with a relay id and client
 transaction time between start and end dates.
 
-% DHCPSRV_PGSQL_GET_RELAYID6 obtaining at most %1 IPv6 leases starting from address %2 with relay id %3 and link %4/%5
+% DHCPSRV_PGSQL_GET_RELAYID6 obtaining at most %1 IPv6 leases starting from address %2 with relay id %3
 A debug message issued when the server is attempting to obtain a page of
-IPv6 leases beginning with the specified address with a relay id and a link.
+IPv6 leases beginning with the specified address with a relay id.
 
 % DHCPSRV_PGSQL_GET_REMOTEID4 obtaining at most %1 IPv4 leases starting from address %2 with remote id %3 and cltt between %4 and %5
 A debug message issued when the server is attempting to obtain a page of
 IPv4 leases beginning with the specified address with a remote id and client
 transaction time between start and end dates.
 
-% DHCPSRV_PGSQL_GET_REMOTEID6 obtaining at most %1 IPv6 leases starting from address %2 with remote id %3 and link %4/%5
+% DHCPSRV_PGSQL_GET_REMOTEID6 obtaining at most %1 IPv6 leases starting from address %2 with remote id %3
 A debug message issued when the server is attempting to obtain a page of
-IPv6 leases beginning with the specified address with a remote id and a link.
+IPv6 leases beginning with the specified address with a remote id.
 
 % DHCPSRV_PGSQL_GET_SUBID4 obtaining IPv4 leases for subnet ID %1
 A debug message issued when the server is attempting to obtain all IPv4
index 8ef18484dfdf5053cb25af77204553b5beb2fcf4..537c6daf6c2de5eaed97c4669922521283a63712 100644 (file)
@@ -953,8 +953,6 @@ public:
     /// @brief Returns existing IPv6 leases with a given relay-id.
     ///
     /// @param relay_id DUID for relay_id of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv6 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -962,16 +960,12 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRelayId(const DUID& relay_id,
-                        const asiolink::IOAddress& link_addr,
-                        uint8_t link_len,
                         const asiolink::IOAddress& lower_bound_address,
                         const LeasePageSize& page_size) = 0;
 
     /// @brief Returns existing IPv6 leases with a given remote-id.
     ///
     /// @param remote_id remote-id option data of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv6 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -979,8 +973,6 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                         const asiolink::IOAddress& link_addr,
-                         uint8_t link_len,
                          const asiolink::IOAddress& lower_bound_address,
                          const LeasePageSize& page_size) = 0;
 
index f0e12c49260415f2854314291699d1d50cde0e79..1f90d8dd1c7965c1011944507f257a92796627a9 100644 (file)
@@ -3052,28 +3052,15 @@ Memfile_LeaseMgr::byRemoteId6size() const {
 
 Lease6Collection
 Memfile_LeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
-                                      const IOAddress& link_addr,
-                                      uint8_t link_len,
                                       const IOAddress& lower_bound_address,
                                       const LeasePageSize& page_size) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MEMFILE_GET_RELAYID6)
         .arg(page_size.page_size_)
         .arg(lower_bound_address.toText())
-        .arg(relay_id.toText())
-        .arg(link_addr.toText())
-        .arg(static_cast<unsigned>(link_len));
+        .arg(relay_id.toText());
 
-    // Expecting IPv6 valid prefix and address.
-    if (!link_addr.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected IPv6 address while "
-                  "retrieving leases from the lease database, got "
-                  << link_addr);
-    }
-    if (link_len > 128) {
-        isc_throw(OutOfRange, "invalid IPv6 prefix length "
-                  << static_cast<unsigned>(link_len));
-    }
+    // Expecting IPv6 valid address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 address while "
                   "retrieving leases from the lease database, got "
@@ -3083,14 +3070,10 @@ Memfile_LeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
     if (MultiThreadingMgr::instance().getMode()) {
         std::lock_guard<std::mutex> lock(*mutex_);
         return (getLeases6ByRelayIdInternal(relay_id,
-                                            link_addr,
-                                            link_len,
                                             lower_bound_address,
                                             page_size));
     } else {
         return (getLeases6ByRelayIdInternal(relay_id,
-                                            link_addr,
-                                            link_len,
                                             lower_bound_address,
                                             page_size));
     }
@@ -3098,62 +3081,31 @@ Memfile_LeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
 
 Lease6Collection
 Memfile_LeaseMgr::getLeases6ByRelayIdInternal(const DUID& relay_id,
-                                              const IOAddress& link_addr,
-                                              uint8_t link_len,
                                               const IOAddress& lower_bound_address,
                                               const LeasePageSize& page_size) {
     const std::vector<uint8_t>& relay_id_data = relay_id.getDuid();
     Lease6Collection collection;
     const RelayIdIndex& idx = relay_id6_.get<RelayIdIndexTag>();
-    if (!link_len) {
-        RelayIdIndex::const_iterator lb =
-            idx.lower_bound(boost::make_tuple(relay_id_data,
-                                              lower_bound_address));
-
-        // Return all leases being within the page size.
-        IOAddress last_addr = lower_bound_address;
-        for (; lb != idx.end(); ++lb) {
-            if ((*lb)->lease_addr_ == last_addr) {
-                // Already seen: skip it.
-                continue;
-            }
-            if ((*lb)->id_ != relay_id_data) {
-                // Gone after the relay id index.
-                break;
-            }
-            last_addr = (*lb)->lease_addr_;
-            Lease6Ptr lease = getAnyLease6Internal(last_addr);
-            if (lease) {
-                collection.push_back(lease);
-                if (collection.size() >= page_size.page_size_) {
-                    break;
-                }
-            }
+    RelayIdIndex::const_iterator lb =
+        idx.lower_bound(boost::make_tuple(relay_id_data, lower_bound_address));
+
+    // Return all leases being within the page size.
+    IOAddress last_addr = lower_bound_address;
+    for (; lb != idx.end(); ++lb) {
+        if ((*lb)->lease_addr_ == last_addr) {
+            // Already seen: skip it.
+            continue;
         }
-    } else {
-        const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
-        const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
-        const IOAddress& start_addr =
-            (lower_bound_address < first_addr ? first_addr : lower_bound_address);
-        RelayIdIndex::const_iterator lb =
-            idx.lower_bound(boost::make_tuple(relay_id_data, start_addr));
-        RelayIdIndex::const_iterator ub =
-            idx.upper_bound(boost::make_tuple(relay_id_data, last_addr));
-
-        // Return all leases being within the page size.
-        IOAddress last_seen_addr = lower_bound_address;
-        for (auto it = lb; it != ub; ++it) {
-            if ((*it)->lease_addr_ == last_seen_addr) {
-                // Already seen: skip it.
-                continue;
-            }
-            last_seen_addr = (*it)->lease_addr_;
-            Lease6Ptr lease = getAnyLease6Internal(last_seen_addr);
-            if (lease) {
-                collection.push_back(lease);
-                if (collection.size() >= page_size.page_size_) {
-                    break;
-                }
+        if ((*lb)->id_ != relay_id_data) {
+            // Gone after the relay id index.
+            break;
+        }
+        last_addr = (*lb)->lease_addr_;
+        Lease6Ptr lease = getAnyLease6Internal(last_addr);
+        if (lease) {
+            collection.push_back(lease);
+            if (collection.size() >= page_size.page_size_) {
+                break;
             }
         }
     }
@@ -3162,28 +3114,15 @@ Memfile_LeaseMgr::getLeases6ByRelayIdInternal(const DUID& relay_id,
 
 Lease6Collection
 Memfile_LeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                                       const IOAddress& link_addr,
-                                       uint8_t link_len,
                                        const IOAddress& lower_bound_address,
                                        const LeasePageSize& page_size) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MEMFILE_GET_REMOTEID6)
         .arg(page_size.page_size_)
         .arg(lower_bound_address.toText())
-        .arg(idToText(remote_id))
-        .arg(link_addr.toText())
-        .arg(static_cast<unsigned>(link_len));
+        .arg(idToText(remote_id));
 
-    // Expecting IPv6 valid prefix and address.
-    if (!link_addr.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected IPv6 address while "
-                  "retrieving leases from the lease database, got "
-                  << link_addr);
-    }
-    if (link_len > 128) {
-        isc_throw(OutOfRange, "invalid IPv6 prefix length "
-                  << static_cast<unsigned>(link_len));
-    }
+    // Expecting IPv6 valid address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 address while "
                   "retrieving leases from the lease database, got "
@@ -3193,14 +3132,10 @@ Memfile_LeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
     if (MultiThreadingMgr::instance().getMode()) {
         std::lock_guard<std::mutex> lock(*mutex_);
         return (getLeases6ByRemoteIdInternal(remote_id,
-                                             link_addr,
-                                             link_len,
                                              lower_bound_address,
                                              page_size));
     } else {
         return (getLeases6ByRemoteIdInternal(remote_id,
-                                             link_addr,
-                                             link_len,
                                              lower_bound_address,
                                              page_size));
     }
@@ -3208,58 +3143,28 @@ Memfile_LeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
 
 Lease6Collection
 Memfile_LeaseMgr::getLeases6ByRemoteIdInternal(const OptionBuffer& remote_id,
-                                               const IOAddress& link_addr,
-                                               uint8_t link_len,
                                                const IOAddress& lower_bound_address,
                                                const LeasePageSize& page_size) {
     Lease6Collection collection;
     std::set<IOAddress> sorted;
     const RemoteIdIndex& idx = remote_id6_.get<RemoteIdIndexTag>();
     RemoteIdIndexRange er = idx.equal_range(remote_id);
-    if (!link_len) {
-        // Store all addresses greater than lower_bound_address.
-        for (auto it = er.first; it != er.second; ++it) {
-            const IOAddress& addr = (*it)->lease_addr_;
-            if (addr <= lower_bound_address) {
-                continue;
-            }
-            static_cast<void>(sorted.insert(addr));
-        }
-
-        // Return all leases being within the page size.
-        for (const IOAddress& addr : sorted) {
-            Lease6Ptr lease = getAnyLease6Internal(addr);
-            if (lease) {
-                collection.push_back(lease);
-                if (collection.size() >= page_size.page_size_) {
-                    break;
-                }
-            }
-        }
-    } else {
-        const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
-        const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
-
-        // Store all addresses greater than lower_bound_address in the link.
-        for (auto it = er.first; it != er.second; ++it) {
-            const IOAddress& addr = (*it)->lease_addr_;
-            if (addr <= lower_bound_address) {
-                continue;
-            }
-            if ((addr < first_addr) || (last_addr < addr)) {
-                continue;
-            }
-            static_cast<void>(sorted.insert(addr));
+    // Store all addresses greater than lower_bound_address.
+    for (auto it = er.first; it != er.second; ++it) {
+        const IOAddress& addr = (*it)->lease_addr_;
+        if (addr <= lower_bound_address) {
+            continue;
         }
+        static_cast<void>(sorted.insert(addr));
+    }
 
-        // Return all leases being within the page size.
-        for (const IOAddress& addr : sorted) {
-            Lease6Ptr lease = getAnyLease6Internal(addr);
-            if (lease) {
-                collection.push_back(lease);
-                if (collection.size() >= page_size.page_size_) {
-                    break;
-                }
+    // Return all leases being within the page size.
+    for (const IOAddress& addr : sorted) {
+        Lease6Ptr lease = getAnyLease6Internal(addr);
+        if (lease) {
+            collection.push_back(lease);
+            if (collection.size() >= page_size.page_size_) {
+                break;
             }
         }
     }
index 22f4cb70e5869e9052deee6c267c2cc1868640a8..147e60a506b9c885ca342ea26e98b4935daa87da 100644 (file)
@@ -1359,8 +1359,6 @@ public:
     /// @brief Returns existing IPv6 leases with a given relay-id.
     ///
     /// @param relay_id DUID for relay_id of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1368,16 +1366,12 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRelayId(const DUID& relay_id,
-                        const asiolink::IOAddress& link_addr,
-                        uint8_t link_len,
                         const asiolink::IOAddress& lower_bound_address,
                         const LeasePageSize& page_size) override;
 
     /// @brief Returns existing IPv6 leases with a given remote-id.
     ///
     /// @param remote_id remote-id option data of interest
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1385,8 +1379,6 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                         const asiolink::IOAddress& link_addr,
-                         uint8_t link_len,
                          const asiolink::IOAddress& lower_bound_address,
                          const LeasePageSize& page_size) override;
 
@@ -1478,8 +1470,6 @@ private:
     /// @brief Returns existing IPv6 leases with a given relay-id.
     ///
     /// @param relay_id DUID for relay_id of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1487,16 +1477,12 @@ private:
     /// @return collection of IPv6 leases
     Lease6Collection
     getLeases6ByRelayIdInternal(const DUID& relay_id,
-                                const asiolink::IOAddress& link_addr,
-                                uint8_t link_len,
                                 const asiolink::IOAddress& lower_bound_address,
                                 const LeasePageSize& page_size);
 
     /// @brief Returns existing IPv6 leases with a given remote-id.
     ///
     /// @param remote_id remote-id option data of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1504,8 +1490,6 @@ private:
     /// @return collection of IPv6 leases
     Lease6Collection
     getLeases6ByRemoteIdInternal(const OptionBuffer& remote_id,
-                                 const asiolink::IOAddress& link_addr,
-                                 uint8_t link_len,
                                  const asiolink::IOAddress& lower_bound_address,
                                  const LeasePageSize& page_size);
 
index 8c0c5db50a9c5550596242c90b1f725474d6d604..e436e1940eea0e99eb8fda79f1749a677f8aac53 100644 (file)
@@ -519,34 +519,6 @@ tagged_statements = { {
                     "GROUP BY l.address "
                     "ORDER BY l.address "
                     "LIMIT ?"},
-    {MySqlLeaseMgr::GET_RELAY_ID6_LINK,
-                    "SELECT l.address, l.duid, l.valid_lifetime, "
-                        "l.expire, l.subnet_id, l.pref_lifetime, "
-                        "l.lease_type, l.iaid, l.prefix_len, "
-                        "l.fqdn_fwd, l.fqdn_rev, l.hostname, "
-                        "l.hwaddr, l.hwtype, l.hwaddr_source, "
-                        "l.state, l.user_context, l.pool_id "
-                    "FROM lease6 AS l "
-                    "INNER JOIN lease6_relay_id AS r "
-                    " ON l.address = r.lease_addr "
-                    " WHERE r.relay_id = ? AND r.lease_addr BETWEEN ? AND ? "
-                    "GROUP BY l.address "
-                    "ORDER BY l.address "
-                    "LIMIT ?"},
-    {MySqlLeaseMgr::GET_REMOTE_ID6_LINK,
-                    "SELECT l.address, l.duid, l.valid_lifetime, "
-                        "l.expire, l.subnet_id, l.pref_lifetime, "
-                        "l.lease_type, l.iaid, l.prefix_len, "
-                        "l.fqdn_fwd, l.fqdn_rev, l.hostname, "
-                        "l.hwaddr, l.hwtype, l.hwaddr_source, "
-                        "l.state, l.user_context, l.pool_id "
-                    "FROM lease6 AS l "
-                    "INNER JOIN lease6_remote_id AS r "
-                    " ON l.address = r.lease_addr "
-                    " WHERE r.remote_id = ? AND r.lease_addr BETWEEN ? AND ? "
-                    "GROUP BY l.address "
-                    "ORDER BY l.address "
-                    "LIMIT ?"},
     {MySqlLeaseMgr::COUNT_RELAY_ID6,
                     "SELECT COUNT(*) FROM lease6_relay_id"},
     {MySqlLeaseMgr::COUNT_REMOTE_ID6,
@@ -4365,28 +4337,15 @@ MySqlLeaseMgr::upgradeExtendedInfo4(const LeasePageSize& page_size) {
 
 Lease6Collection
 MySqlLeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
-                                   const IOAddress& link_addr,
-                                   uint8_t link_len,
                                    const IOAddress& lower_bound_address,
                                    const LeasePageSize& page_size) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MYSQL_GET_RELAYID6)
         .arg(page_size.page_size_)
         .arg(lower_bound_address.toText())
-        .arg(relay_id.toText())
-        .arg(link_addr.toText())
-        .arg(static_cast<unsigned>(link_len));
+        .arg(relay_id.toText());
 
-    // Expecting IPv6 valid prefix and address.
-    if (!link_addr.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected IPv6 link address while "
-                  "retrieving leases from the lease database, got "
-                  << link_addr);
-    }
-    if (link_len > 128) {
-        isc_throw(OutOfRange, "invalid IPv6 prefix length "
-                  << static_cast<unsigned>(link_len));
-    }
+    // Expecting IPv6 valid address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 start address while "
                   "retrieving leases from the lease database, got "
@@ -4399,125 +4358,52 @@ MySqlLeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
         isc_throw(BadValue, "empty relay id");
     }
 
-    Lease6Collection result;
-
-    if (!link_len) {
-        // Bind the relay id.
-        MYSQL_BIND inbind[3];
-        memset(inbind, 0, sizeof(inbind));
-
-        inbind[0].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[0].buffer = reinterpret_cast<char*>(&relay_id_data[0]);
-        inbind[0].buffer_length = relay_id_size;
-        inbind[0].length = &relay_id_size;
-
-        // Bind the lower bound address.
-        std::vector<uint8_t> lb_addr_data = lower_bound_address.toBytes();
-        unsigned long lb_addr_size = lb_addr_data.size();
-        if (lb_addr_size != 16) {
-            isc_throw(DbOperationError, "lower bound address is not 16 bytes long");
-        }
-        inbind[1].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[1].buffer = reinterpret_cast<char*>(&lb_addr_data[0]);
-        inbind[1].buffer_length = lb_addr_size;
-        inbind[1].length = &lb_addr_size;
-
-        // Bind the size value.
-        uint32_t ps = static_cast<uint32_t>(page_size.page_size_);
-        inbind[2].buffer_type = MYSQL_TYPE_LONG;
-        inbind[2].buffer = reinterpret_cast<char*>(&ps);
-        inbind[2].is_unsigned = MLM_TRUE;
-
-        // Get a context.
-        MySqlLeaseContextAlloc get_context(*this);
-        MySqlLeaseContextPtr ctx = get_context.ctx_;
-
-        getLeaseCollection(ctx, GET_RELAY_ID6, inbind, result);
-    } else {
-        const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
-        const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
-        IOAddress start_addr = lower_bound_address;
-        if (lower_bound_address < first_addr) {
-            start_addr = first_addr;
-        } else if (last_addr <= lower_bound_address) {
-            // Range was already done.
-            return (result);
-        } else {
-            // The lower bound address is from the last call so skip it.
-            start_addr = IOAddress::increase(lower_bound_address);
-        }
-
-        // Bind the relay id.
-        MYSQL_BIND inbind[4];
-        memset(inbind, 0, sizeof(inbind));
-
-        inbind[0].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[0].buffer = reinterpret_cast<char*>(&relay_id_data[0]);
-        inbind[0].buffer_length = relay_id_size;
-        inbind[0].length = &relay_id_size;
-
-        // Bind the start address.
-        std::vector<uint8_t> start_addr_data = start_addr.toBytes();
-        unsigned long start_addr_size = start_addr_data.size();
-        if (start_addr_size != 16) {
-            isc_throw(DbOperationError, "start address is not 16 bytes long");
-        }
-        inbind[1].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[1].buffer = reinterpret_cast<char*>(&start_addr_data[0]);
-        inbind[1].buffer_length = start_addr_size;
-        inbind[1].length = &start_addr_size;
-
-        // Bind the last address.
-        std::vector<uint8_t> last_addr_data = last_addr.toBytes();
-        unsigned long last_addr_size = last_addr_data.size();
-        if (last_addr_size != 16) {
-            isc_throw(DbOperationError, "last address is not 16 bytes long");
-        }
-        inbind[2].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[2].buffer = reinterpret_cast<char*>(&last_addr_data[0]);
-        inbind[2].buffer_length = last_addr_size;
-        inbind[2].length = &last_addr_size;
+    // Bind the relay id.
+    MYSQL_BIND inbind[3];
+    memset(inbind, 0, sizeof(inbind));
 
-        // Bind the size value.
-        uint32_t ps = static_cast<uint32_t>(page_size.page_size_);
-        inbind[3].buffer_type = MYSQL_TYPE_LONG;
-        inbind[3].buffer = reinterpret_cast<char*>(&ps);
-        inbind[3].is_unsigned = MLM_TRUE;
+    inbind[0].buffer_type = MYSQL_TYPE_BLOB;
+    inbind[0].buffer = reinterpret_cast<char*>(&relay_id_data[0]);
+    inbind[0].buffer_length = relay_id_size;
+    inbind[0].length = &relay_id_size;
+
+    // Bind the lower bound address.
+    std::vector<uint8_t> lb_addr_data = lower_bound_address.toBytes();
+    unsigned long lb_addr_size = lb_addr_data.size();
+    if (lb_addr_size != 16) {
+        isc_throw(DbOperationError, "lower bound address is not 16 bytes long");
+    }
+    inbind[1].buffer_type = MYSQL_TYPE_BLOB;
+    inbind[1].buffer = reinterpret_cast<char*>(&lb_addr_data[0]);
+    inbind[1].buffer_length = lb_addr_size;
+    inbind[1].length = &lb_addr_size;
 
-        // Get a context.
-        MySqlLeaseContextAlloc get_context(*this);
-        MySqlLeaseContextPtr ctx = get_context.ctx_;
+    // Bind the size value.
+    uint32_t ps = static_cast<uint32_t>(page_size.page_size_);
+    inbind[2].buffer_type = MYSQL_TYPE_LONG;
+    inbind[2].buffer = reinterpret_cast<char*>(&ps);
+    inbind[2].is_unsigned = MLM_TRUE;
 
-        getLeaseCollection(ctx, GET_RELAY_ID6_LINK, inbind, result);
-    }
+    // Get a context.
+    MySqlLeaseContextAlloc get_context(*this);
+    MySqlLeaseContextPtr ctx = get_context.ctx_;
+    Lease6Collection result;
 
+    getLeaseCollection(ctx, GET_RELAY_ID6, inbind, result);
     return (result);
 }
 
 Lease6Collection
 MySqlLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                                    const IOAddress& link_addr,
-                                    uint8_t link_len,
                                     const IOAddress& lower_bound_address,
                                     const LeasePageSize& page_size) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_MYSQL_GET_REMOTEID6)
         .arg(page_size.page_size_)
         .arg(lower_bound_address.toText())
-        .arg(idToText(remote_id))
-        .arg(link_addr.toText())
-        .arg(static_cast<unsigned>(link_len));
+        .arg(idToText(remote_id));
 
-    // Expecting IPv6 valid prefix and address.
-    if (!link_addr.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected IPv6 link address while "
-                  "retrieving leases from the lease database, got "
-                  << link_addr);
-    }
-    if (link_len > 128) {
-        isc_throw(OutOfRange, "invalid IPv6 prefix length "
-                  << static_cast<unsigned>(link_len));
-    }
+    // Expecting IPv6 valid address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 start address while "
                   "retrieving leases from the lease database, got "
@@ -4530,97 +4416,38 @@ MySqlLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
         isc_throw(BadValue, "empty remote id");
     }
 
-    Lease6Collection result;
-
-    if (!link_len) {
-        // Bind the remote id.
-        MYSQL_BIND inbind[3];
-        memset(inbind, 0, sizeof(inbind));
-
-        inbind[0].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[0].buffer = reinterpret_cast<char*>(&remote_id_data[0]);
-        inbind[0].buffer_length = remote_id_size;
-        inbind[0].length = &remote_id_size;
-
-        // Bind the lower bound address.
-        std::vector<uint8_t> lb_addr_data = lower_bound_address.toBytes();
-        unsigned long lb_addr_size = lb_addr_data.size();
-        if (lb_addr_size != 16) {
-            isc_throw(DbOperationError, "lower bound address is not 16 bytes long");
-        }
-        inbind[1].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[1].buffer = reinterpret_cast<char*>(&lb_addr_data[0]);
-        inbind[1].buffer_length = lb_addr_size;
-        inbind[1].length = &lb_addr_size;
-
-        // Bind the size value.
-        uint32_t ps = static_cast<uint32_t>(page_size.page_size_);
-        inbind[2].buffer_type = MYSQL_TYPE_LONG;
-        inbind[2].buffer = reinterpret_cast<char*>(&ps);
-        inbind[2].is_unsigned = MLM_TRUE;
-
-        // Get a context.
-        MySqlLeaseContextAlloc get_context(*this);
-        MySqlLeaseContextPtr ctx = get_context.ctx_;
-
-        getLeaseCollection(ctx, GET_REMOTE_ID6, inbind, result);
-    } else {
-        const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
-        const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
-        IOAddress start_addr = lower_bound_address;
-        if (lower_bound_address < first_addr) {
-            start_addr = first_addr;
-        } else if (last_addr <= lower_bound_address) {
-            // Range was already done.
-            return (result);
-        } else {
-            // The lower bound address is from the last call so skip it.
-            start_addr = IOAddress::increase(lower_bound_address);
-        }
-
-        // Bind the remote id.
-        MYSQL_BIND inbind[4];
-        memset(inbind, 0, sizeof(inbind));
+    // Bind the remote id.
+    MYSQL_BIND inbind[3];
+    memset(inbind, 0, sizeof(inbind));
 
-        inbind[0].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[0].buffer = reinterpret_cast<char*>(&remote_id_data[0]);
-        inbind[0].buffer_length = remote_id_size;
-        inbind[0].length = &remote_id_size;
-
-        // Bind the start address.
-        std::vector<uint8_t> start_addr_data = start_addr.toBytes();
-        unsigned long start_addr_size = start_addr_data.size();
-        if (start_addr_size != 16) {
-            isc_throw(DbOperationError, "start address is not 16 bytes long");
-        }
-        inbind[1].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[1].buffer = reinterpret_cast<char*>(&start_addr_data[0]);
-        inbind[1].buffer_length = start_addr_size;
-        inbind[1].length = &start_addr_size;
-
-        // Bind the last address.
-        std::vector<uint8_t> last_addr_data = last_addr.toBytes();
-        unsigned long last_addr_size = last_addr_data.size();
-        if (last_addr_size != 16) {
-            isc_throw(DbOperationError, "last address is not 16 bytes long");
-        }
-        inbind[2].buffer_type = MYSQL_TYPE_BLOB;
-        inbind[2].buffer = reinterpret_cast<char*>(&last_addr_data[0]);
-        inbind[2].buffer_length = last_addr_size;
-        inbind[2].length = &last_addr_size;
+    inbind[0].buffer_type = MYSQL_TYPE_BLOB;
+    inbind[0].buffer = reinterpret_cast<char*>(&remote_id_data[0]);
+    inbind[0].buffer_length = remote_id_size;
+    inbind[0].length = &remote_id_size;
+
+    // Bind the lower bound address.
+    std::vector<uint8_t> lb_addr_data = lower_bound_address.toBytes();
+    unsigned long lb_addr_size = lb_addr_data.size();
+    if (lb_addr_size != 16) {
+        isc_throw(DbOperationError, "lower bound address is not 16 bytes long");
+    }
+    inbind[1].buffer_type = MYSQL_TYPE_BLOB;
+    inbind[1].buffer = reinterpret_cast<char*>(&lb_addr_data[0]);
+    inbind[1].buffer_length = lb_addr_size;
+    inbind[1].length = &lb_addr_size;
 
-        // Bind the size value.
-        uint32_t ps = static_cast<uint32_t>(page_size.page_size_);
-        inbind[3].buffer_type = MYSQL_TYPE_LONG;
-        inbind[3].buffer = reinterpret_cast<char*>(&ps);
-        inbind[3].is_unsigned = MLM_TRUE;
+    // Bind the size value.
+    uint32_t ps = static_cast<uint32_t>(page_size.page_size_);
+    inbind[2].buffer_type = MYSQL_TYPE_LONG;
+    inbind[2].buffer = reinterpret_cast<char*>(&ps);
+    inbind[2].is_unsigned = MLM_TRUE;
 
-        // Get a context.
-        MySqlLeaseContextAlloc get_context(*this);
-        MySqlLeaseContextPtr ctx = get_context.ctx_;
+    // Get a context.
+    MySqlLeaseContextAlloc get_context(*this);
+    MySqlLeaseContextPtr ctx = get_context.ctx_;
+    Lease6Collection result;
 
-        getLeaseCollection(ctx, GET_REMOTE_ID6_LINK, inbind, result);
-    }
+    getLeaseCollection(ctx, GET_REMOTE_ID6, inbind, result);
 
     return (result);
 }
index 8dc6901dfcf5408c5cf4be9c95ac7b04da877901..1a3dfd952d399f960bbdfd9a316f49e294b85ae5 100644 (file)
@@ -776,8 +776,6 @@ public:
         ADD_REMOTE_ID6,              // Add a lease6_remote_id entry
         GET_RELAY_ID6,               // Get lease6_relay_id entries
         GET_REMOTE_ID6,              // Get lease6_remote_id entries
-        GET_RELAY_ID6_LINK,          // Get lease6_relay_id entries by link
-        GET_REMOTE_ID6_LINK,         // Get lease6_remote_id entries by link
         COUNT_RELAY_ID6,             // Count the lease6_relay_id number of entries
         COUNT_REMOTE_ID6,            // Count the lease6_remote_id number of entries
         NUM_STATEMENTS               // Number of statements
@@ -1117,8 +1115,6 @@ public:
     /// @brief Returns existing IPv6 leases with a given relay-id.
     ///
     /// @param relay_id DUID for relay_id of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1126,16 +1122,12 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRelayId(const DUID& relay_id,
-                        const asiolink::IOAddress& link_addr,
-                        uint8_t link_len,
                         const asiolink::IOAddress& lower_bound_address,
                         const LeasePageSize& page_size) override;
 
     /// @brief Returns existing IPv6 leases with a given remote-id.
     ///
     /// @param remote_id remote-id option data of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1143,8 +1135,6 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                         const asiolink::IOAddress& link_addr,
-                         uint8_t link_len,
                          const asiolink::IOAddress& lower_bound_address,
                          const LeasePageSize& page_size) override;
 
index 4cbd2f5f0af9f18a2fe18b6ccdb373a0c27a0828..85f0dbd6e0117a751d6a55fb6dae893b993ef1cd 100644 (file)
@@ -618,40 +618,6 @@ PgSqlTaggedStatement tagged_statements[] = {
       "ORDER BY l.address "
       "LIMIT $3" },
 
-    // GET_RELAY_ID6_LINK
-    { 4, { OID_BYTEA, OID_VARCHAR, OID_VARCHAR, OID_INT8 },
-      "get_relay_id6_link",
-      "SELECT DISTINCT ON(l.address) "
-        "host(l.address), l.duid, l.valid_lifetime, "
-        "extract(epoch from l.expire)::bigint, l.subnet_id, l.pref_lifetime, "
-        "l.lease_type, l.iaid, l.prefix_len, l.fqdn_fwd, l.fqdn_rev, "
-        "l.hostname, l.hwaddr, l.hwtype, l.hwaddr_source, "
-        "l.state, l.user_context, l.pool_id "
-      "FROM lease6 AS l "
-      "INNER JOIN lease6_relay_id AS r "
-      " ON l.address = r.lease_addr "
-      " WHERE r.relay_id = $1 AND r.lease_addr "
-        "BETWEEN cast($2 as inet) and cast($3 as inet) "
-      "ORDER BY l.address "
-      "LIMIT $4" },
-
-    // GET_REMOTE_ID6_LINK
-    { 4, { OID_BYTEA, OID_VARCHAR, OID_VARCHAR, OID_INT8 },
-      "get_remote_id6_link",
-      "SELECT DISTINCT ON(l.address) "
-        "host(l.address), l.duid, l.valid_lifetime, "
-        "extract(epoch from l.expire)::bigint, l.subnet_id, l.pref_lifetime, "
-        "l.lease_type, l.iaid, l.prefix_len, l.fqdn_fwd, l.fqdn_rev, "
-        "l.hostname, l.hwaddr, l.hwtype, l.hwaddr_source, "
-        "l.state, l.user_context, l.pool_id "
-      "FROM lease6 AS l "
-      "INNER JOIN lease6_remote_id AS r "
-      " ON l.address = r.lease_addr "
-      " WHERE r.remote_id = $1 AND r.lease_addr "
-        "BETWEEN cast($2 as inet) and cast($3 as inet) "
-      "ORDER BY l.address "
-      "LIMIT $4" },
-
     // COUNT_RELAY_ID6
     { 0, { OID_NONE },
       "count_relay_id6",
@@ -3459,28 +3425,15 @@ PgSqlLeaseMgr::upgradeExtendedInfo4(const LeasePageSize& page_size) {
 
 Lease6Collection
 PgSqlLeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
-                                   const IOAddress& link_addr,
-                                   uint8_t link_len,
                                    const IOAddress& lower_bound_address,
                                    const LeasePageSize& page_size) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_PGSQL_GET_RELAYID6)
         .arg(page_size.page_size_)
         .arg(lower_bound_address.toText())
-        .arg(relay_id.toText())
-        .arg(link_addr.toText())
-        .arg(static_cast<unsigned>(link_len));
+        .arg(relay_id.toText());
 
-    // Expecting IPv6 valid prefix and address.
-    if (!link_addr.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected IPv6 link address while "
-                  "retrieving leases from the lease database, got "
-                  << link_addr);
-    }
-    if (link_len > 128) {
-        isc_throw(OutOfRange, "invalid IPv6 prefix length "
-                  << static_cast<unsigned>(link_len));
-    }
+    // Expecting IPv6 valid address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 start address while "
                   "retrieving leases from the lease database, got "
@@ -3492,96 +3445,41 @@ PgSqlLeaseMgr::getLeases6ByRelayId(const DUID& relay_id,
         isc_throw(BadValue, "empty relay id");
     }
 
-    Lease6Collection result;
-
-    if (!link_len) {
-        // Set up the WHERE clause value.
-        PsqlBindArray bind_array;
-
-        // Bind the relay id.
-        bind_array.add(relay_id_data);
-
-        // Bind the lower bound address.
-        std::string lb_addr_data = lower_bound_address.toText();
-        bind_array.add(lb_addr_data);
-
-        // Bind page size value.
-        std::string page_size_data =
-            boost::lexical_cast<std::string>(page_size.page_size_);
-        bind_array.add(page_size_data);
-
-        // Get a context.
-        PgSqlLeaseContextAlloc get_context(*this);
-        PgSqlLeaseContextPtr ctx = get_context.ctx_;
-
-        getLeaseCollection(ctx, GET_RELAY_ID6, bind_array, result);
-    } else {
-        const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
-        const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
-        IOAddress start_addr = lower_bound_address;
-        if (lower_bound_address < first_addr) {
-            start_addr = first_addr;
-        } else if (last_addr <= lower_bound_address) {
-            // Range was already done.
-            return (result);
-        } else {
-            // The lower bound address is from the last call so skip it.
-            start_addr = IOAddress::increase(lower_bound_address);
-        }
-
-        // Set up the WHERE clause value.
-        PsqlBindArray bind_array;
-
-        // Bind the relay id.
-        bind_array.add(relay_id_data);
-
-        // Bind the start address.
-        std::string start_addr_data = start_addr.toText();
-        bind_array.add(start_addr_data);
+    // Set up the WHERE clause value.
+    PsqlBindArray bind_array;
 
-        // Bind the last address.
-        std::string last_addr_data = last_addr.toText();
-        bind_array.add(last_addr_data);
+    // Bind the relay id.
+    bind_array.add(relay_id_data);
 
-        // Bind page size value.
-        std::string page_size_data =
-            boost::lexical_cast<std::string>(page_size.page_size_);
-        bind_array.add(page_size_data);
+    // Bind the lower bound address.
+    std::string lb_addr_data = lower_bound_address.toText();
+    bind_array.add(lb_addr_data);
 
-        // Get a context.
-        PgSqlLeaseContextAlloc get_context(*this);
-        PgSqlLeaseContextPtr ctx = get_context.ctx_;
+    // Bind page size value.
+    std::string page_size_data =
+        boost::lexical_cast<std::string>(page_size.page_size_);
+    bind_array.add(page_size_data);
 
-        getLeaseCollection(ctx, GET_RELAY_ID6_LINK, bind_array, result);
-    }
+    // Get a context.
+    PgSqlLeaseContextAlloc get_context(*this);
+    PgSqlLeaseContextPtr ctx = get_context.ctx_;
+    Lease6Collection result;
 
+    getLeaseCollection(ctx, GET_RELAY_ID6, bind_array, result);
     return (result);
 }
 
 Lease6Collection
 PgSqlLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                                    const IOAddress& link_addr,
-                                    uint8_t link_len,
                                     const IOAddress& lower_bound_address,
                                     const LeasePageSize& page_size) {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_PGSQL_GET_REMOTEID6)
         .arg(page_size.page_size_)
         .arg(lower_bound_address.toText())
-        .arg(idToText(remote_id))
-        .arg(link_addr.toText())
-        .arg(static_cast<unsigned>(link_len));
+        .arg(idToText(remote_id));
 
-    // Expecting IPv6 valid prefix and address.
-    if (!link_addr.isV6()) {
-        isc_throw(InvalidAddressFamily, "expected IPv6 link address while "
-                  "retrieving leases from the lease database, got "
-                  << link_addr);
-    }
-    if (link_len > 128) {
-        isc_throw(OutOfRange, "invalid IPv6 prefix length "
-                  << static_cast<unsigned>(link_len));
-    }
+    // Expecting IPv6 valid address.
     if (!lower_bound_address.isV6()) {
         isc_throw(InvalidAddressFamily, "expected IPv6 start address while "
                   "retrieving leases from the lease database, got "
@@ -3592,69 +3490,27 @@ PgSqlLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& remote_id,
         isc_throw(BadValue, "empty remote id");
     }
 
-    Lease6Collection result;
-
-    if (!link_len) {
-        // Set up the WHERE clause value.
-        PsqlBindArray bind_array;
-
-        // Bind the remote id.
-        bind_array.add(remote_id);
-
-        // Bind the lower bound address.
-        std::string lb_addr_data = lower_bound_address.toText();
-        bind_array.add(lb_addr_data);
-
-        // Bind page size value.
-        std::string page_size_data =
-            boost::lexical_cast<std::string>(page_size.page_size_);
-        bind_array.add(page_size_data);
-
-        // Get a context.
-        PgSqlLeaseContextAlloc get_context(*this);
-        PgSqlLeaseContextPtr ctx = get_context.ctx_;
-
-        getLeaseCollection(ctx, GET_REMOTE_ID6, bind_array, result);
-    } else {
-        const IOAddress& first_addr = firstAddrInPrefix(link_addr, link_len);
-        const IOAddress& last_addr = lastAddrInPrefix(link_addr, link_len);
-        IOAddress start_addr = lower_bound_address;
-        if (lower_bound_address < first_addr) {
-            start_addr = first_addr;
-        } else if (last_addr <= lower_bound_address) {
-            // Range was already done.
-            return (result);
-        } else {
-            // The lower bound address is from the last call so skip it.
-            start_addr = IOAddress::increase(lower_bound_address);
-        }
-
-        // Set up the WHERE clause value.
-        PsqlBindArray bind_array;
-
-        // Bind the remote id.
-        bind_array.add(remote_id);
-
-        // Bind the start address.
-        std::string start_addr_data = start_addr.toText();
-        bind_array.add(start_addr_data);
+    // Set up the WHERE clause value.
+    PsqlBindArray bind_array;
 
-        // Bind the last address.
-        std::string last_addr_data = last_addr.toText();
-        bind_array.add(last_addr_data);
+    // Bind the remote id.
+    bind_array.add(remote_id);
 
-        // Bind page size value.
-        std::string page_size_data =
-            boost::lexical_cast<std::string>(page_size.page_size_);
-        bind_array.add(page_size_data);
+    // Bind the lower bound address.
+    std::string lb_addr_data = lower_bound_address.toText();
+    bind_array.add(lb_addr_data);
 
-        // Get a context.
-        PgSqlLeaseContextAlloc get_context(*this);
-        PgSqlLeaseContextPtr ctx = get_context.ctx_;
+    // Bind page size value.
+    std::string page_size_data =
+        boost::lexical_cast<std::string>(page_size.page_size_);
+    bind_array.add(page_size_data);
 
-        getLeaseCollection(ctx, GET_REMOTE_ID6_LINK, bind_array, result);
-    }
+    // Get a context.
+    PgSqlLeaseContextAlloc get_context(*this);
+    PgSqlLeaseContextPtr ctx = get_context.ctx_;
+    Lease6Collection result;
 
+    getLeaseCollection(ctx, GET_REMOTE_ID6, bind_array, result);
     return (result);
 }
 
index 465e2ea0786399ca7405839020680e4cb3143f70..feac211fff3aa1488f9665be730158dba882b52e 100644 (file)
@@ -752,8 +752,6 @@ public:
         ADD_REMOTE_ID6,              // Add a lease6_remote_id entry
         GET_RELAY_ID6,               // Get lease6_relay_id entries
         GET_REMOTE_ID6,              // Get lease6_remote_id entries
-        GET_RELAY_ID6_LINK,          // Get lease6_relay_id entries by link
-        GET_REMOTE_ID6_LINK,         // Get lease6_remote_id entries by link
         COUNT_RELAY_ID6,             // Count the lease6_relay_id number of entries
         COUNT_REMOTE_ID6,            // Count the lease6_remote_id number of entries
         NUM_STATEMENTS               // Number of statements
@@ -1071,8 +1069,6 @@ public:
     /// @brief Returns existing IPv6 leases with a given relay-id.
     ///
     /// @param relay_id DUID for relay_id of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1080,16 +1076,12 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRelayId(const DUID& relay_id,
-                        const asiolink::IOAddress& link_addr,
-                        uint8_t link_len,
                         const asiolink::IOAddress& lower_bound_address,
                         const LeasePageSize& page_size) override;
 
     /// @brief Returns existing IPv6 leases with a given remote-id.
     ///
     /// @param remote_id remote-id option data of interest.
-    /// @param link_addr limit results to leases on this link (prefix).
-    /// @param link_len limit results to leases on this link (length).
     /// @param lower_bound_address IPv4 address used as lower bound for the
     /// returned range.
     /// @param page_size maximum size of the page returned.
@@ -1097,8 +1089,6 @@ public:
     /// @return collection of IPv6 leases
     virtual Lease6Collection
     getLeases6ByRemoteId(const OptionBuffer& remote_id,
-                         const asiolink::IOAddress& link_addr,
-                         uint8_t link_len,
                          const asiolink::IOAddress& lower_bound_address,
                          const LeasePageSize& page_size) override;
 
index b941cb02b54e8a6140195ce8ced57153e5c9c322..a5116835840981d10ffb7e557e1ac8105847cf26 100644 (file)
@@ -844,8 +844,6 @@ MemfileExtendedInfoTest::testGetLeases6ByRelayId() {
     IOAddress lease_addr0(ADDRESS6[0]);
     IOAddress lease_addr1(ADDRESS6[1]);
     IOAddress lease_addr2(ADDRESS6[2]);
-    IOAddress link_addr(ADDRESS6[4]);
-    IOAddress other_link_addr("2001:db8:1::4");
     IOAddress zero = IOAddress::IPV6_ZERO_ADDRESS();
     vector<uint8_t> relay_id_data0 = createFromString(DUIDS[0]);
     DUID relay_id0(relay_id_data0);
@@ -864,34 +862,14 @@ MemfileExtendedInfoTest::testGetLeases6ByRelayId() {
     EXPECT_EQ(6, lease_mgr_->relay_id6_.size());
 
     Lease6Collection got;
-    // Unknown relay id #2, no link: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id2,
-                                                          zero,
-                                                          0,
-                                                          zero,
-                                                          LeasePageSize(100)));
-    EXPECT_EQ(0, got.size());
-
-    // Unknown relay id #2, link: nothing.
+    // Unknown relay id #2: nothing.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id2,
-                                                          link_addr,
-                                                          64,
                                                           zero,
                                                           LeasePageSize(100)));
     EXPECT_EQ(0, got.size());
 
-    // Relay id #0, other link: nothing.
+    // Relay id #0: 3 entries but 2 addresses.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id0,
-                                                          other_link_addr,
-                                                          64,
-                                                          zero,
-                                                          LeasePageSize(100)));
-    EXPECT_EQ(0, got.size());
-
-    // Relay id #0, no link: 3 entries but 2 addresses.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id0,
-                                                          zero,
-                                                          0,
                                                           zero,
                                                           LeasePageSize(100)));
     ASSERT_EQ(2, got.size());
@@ -902,10 +880,8 @@ MemfileExtendedInfoTest::testGetLeases6ByRelayId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Relay id #1, no link, partial: 2 entries.
+    // Relay id #1, partial: 2 entries.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          zero,
-                                                          0,
                                                           zero,
                                                           LeasePageSize(2)));
     ASSERT_EQ(2, got.size());
@@ -918,76 +894,12 @@ MemfileExtendedInfoTest::testGetLeases6ByRelayId() {
 
     // Relay id #1, no link, partial from previous: 1 entry.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          zero,
-                                                          0,
                                                           lease->addr_,
                                                           LeasePageSize(2)));
     ASSERT_EQ(1, got.size());
     lease = got[0];
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Add another entry for last tests.
-    EXPECT_NO_THROW(lease_mgr_->addRelayId6(lease_addr0, relay_id_data1));
-    EXPECT_EQ(7, lease_mgr_->relay_id6_.size());
-
-    // Relay id #1, link: 3 entries.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          zero,
-                                                          LeasePageSize(100)));
-    ASSERT_EQ(3, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-    lease = got[1];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-    lease = got[2];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Relay id #1, link, initial partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          zero,
-                                                          LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-
-    // Relay id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          lease->addr_,
-                                                          LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-
-    // Relay id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          lease->addr_,
-                                                          LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Relay id #1, link, final partial: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          lease->addr_,
-                                                          LeasePageSize(1)));
-    EXPECT_EQ(0, got.size());
 }
 
 TEST_F(MemfileExtendedInfoTest, getLeases6ByRelayId) {
@@ -1011,8 +923,6 @@ MemfileExtendedInfoTest::testGetLeases6ByRemoteId() {
     IOAddress lease_addr0(ADDRESS6[0]);
     IOAddress lease_addr1(ADDRESS6[1]);
     IOAddress lease_addr2(ADDRESS6[2]);
-    IOAddress link_addr(ADDRESS6[4]);
-    IOAddress other_link_addr("2001:db8:1::4");
     IOAddress zero = IOAddress::IPV6_ZERO_ADDRESS();
     vector<uint8_t> remote_id0 = createFromString(DUIDS[0]);
     vector<uint8_t> remote_id1 = createFromString(DUIDS[1]);
@@ -1028,34 +938,14 @@ MemfileExtendedInfoTest::testGetLeases6ByRemoteId() {
     EXPECT_EQ(6, lease_mgr_->remote_id6_.size());
 
     Lease6Collection got;
-    // Unknown remote id #2, no link: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id2,
-                                                           zero,
-                                                           0,
-                                                           zero,
-                                                           LeasePageSize(10)));
-    EXPECT_EQ(0, got.size());
-
-    // Unknown remote id #2, link: nothing.
+    // Unknown remote id #2: nothing.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id2,
-                                                           link_addr,
-                                                           64,
                                                            zero,
                                                            LeasePageSize(10)));
     EXPECT_EQ(0, got.size());
 
-    // Remote id #0, other link: nothing.
+    // Remote id #0: 3 entries but 2 addresses.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id0,
-                                                           other_link_addr,
-                                                           64,
-                                                           zero,
-                                                           LeasePageSize(10)));
-    EXPECT_EQ(0, got.size());
-
-    // Remote id #0, no link: 3 entries but 2 addresses.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id0,
-                                                           zero,
-                                                           0,
                                                            zero,
                                                            LeasePageSize(10)));
     ASSERT_EQ(2, got.size());
@@ -1066,10 +956,8 @@ MemfileExtendedInfoTest::testGetLeases6ByRemoteId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Remote id #1, no link, partial: 2 entries.
+    // Remote id #1, partial: 2 entries.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           zero,
-                                                           0,
                                                            zero,
                                                            LeasePageSize(2)));
     ASSERT_EQ(2, got.size());
@@ -1080,78 +968,14 @@ MemfileExtendedInfoTest::testGetLeases6ByRemoteId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Remote id #1, no link, partial from previous: 1 entry.
+    // Remote id #1, partial from previous: 1 entry.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           zero,
-                                                           0,
                                                            lease->addr_,
                                                            LeasePageSize(2)));
     ASSERT_EQ(1, got.size());
     lease = got[0];
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Add another entry for last tests.
-    EXPECT_NO_THROW(lease_mgr_->addRemoteId6(lease_addr0, remote_id1));
-    EXPECT_EQ(7, lease_mgr_->remote_id6_.size());
-
-    // Remote id #1, link: 3 entries.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           zero,
-                                                           LeasePageSize(10)));
-    ASSERT_EQ(3, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-    lease = got[1];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-    lease = got[2];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Remote id #1, link, initial partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           zero,
-                                                           LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-
-    // Remote id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           lease->addr_,
-                                                           LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-
-    // Remote id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           lease->addr_,
-                                                           LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Remote id #1, link, final partial: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           lease->addr_,
-                                                           LeasePageSize(1)));
-    EXPECT_EQ(0, got.size());
 }
 
 TEST_F(MemfileExtendedInfoTest, getLeases6ByRemoteId) {
index 5e0ce8222e2f6a9481e5f132bea4c3247a793080..84ef3e1ac51b81445ec32eca014397d7dbb8a165 100644 (file)
@@ -267,8 +267,6 @@ ConcreteLeaseMgr::getLeases4ByRemoteId(const OptionBuffer& /* remote_id */,
 
 Lease6Collection
 ConcreteLeaseMgr::getLeases6ByRelayId(const DUID& /* relay_id */,
-                                      const IOAddress& /* link_addr */,
-                                      uint8_t /* link_len */,
                                       const IOAddress& /* lower_bound_address */,
                                       const LeasePageSize& /* page_size */) {
     isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByRelayId not implemented");
@@ -276,9 +274,7 @@ ConcreteLeaseMgr::getLeases6ByRelayId(const DUID& /* relay_id */,
 
 Lease6Collection
 ConcreteLeaseMgr::getLeases6ByRemoteId(const OptionBuffer& /* remote_id */,
-                                       const IOAddress& /* link_addr */,
-                                       uint8_t /* link_len */,
-                         const IOAddress& /* lower_bound_address */,
+                                       const IOAddress& /* lower_bound_address */,
                                        const LeasePageSize& /* page_size*/) {
     isc_throw(NotImplemented, "ConcreteLeaseMgr::getLeases6ByRemoteId not implemented");
 }
index 1b48337e2d59eebcd919b9633c4bf0c28d13f1b8..eee8943935d004c6cda57be13be32aaf46407ab8 100644 (file)
@@ -357,16 +357,12 @@ public:
     /// @brief Stub implementation.
     Lease6Collection
     getLeases6ByRelayId(const DUID& /* relay_id */,
-                        const asiolink::IOAddress& /* link_addr */,
-                        uint8_t /* link_len */,
                         const asiolink::IOAddress& /* lower_bound_address */,
                         const LeasePageSize& /* page_size */) override;
 
     /// @brief Stub implementation.
     Lease6Collection
     getLeases6ByRemoteId(const OptionBuffer& /* remote_id */,
-                         const asiolink::IOAddress& /* link_addr */,
-                         uint8_t /* link_len */,
                          const asiolink::IOAddress& /* lower_bound_address */,
                          const LeasePageSize& /* page_size*/) override;
 
index 4be6e5aedce72b71e9b007b999c87f6b5d23bcbe..c78558174096c44cb5cbd534d43553789331d1ad 100644 (file)
@@ -1083,8 +1083,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRelayId() {
     asiolink::IOAddress lease_addr0(ADDRESS6[0]);
     asiolink::IOAddress lease_addr1(ADDRESS6[1]);
     asiolink::IOAddress lease_addr2(ADDRESS6[2]);
-    asiolink::IOAddress link_addr(ADDRESS6[4]);
-    asiolink::IOAddress other_link_addr("2001:db8:1::4");
     asiolink::IOAddress zero = asiolink::IOAddress::IPV6_ZERO_ADDRESS();
     std::vector<uint8_t> relay_id_data0 = createFromString(DUIDS[0]);
     DUID relay_id0(relay_id_data0);
@@ -1103,34 +1101,14 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRelayId() {
     EXPECT_EQ(6, lease_mgr_->byRelayId6size());
 
     Lease6Collection got;
-    // Unknown relay id #2, no link: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id2,
-                                                          zero,
-                                                          0,
-                                                          zero,
-                                                          LeasePageSize(100)));
-    EXPECT_EQ(0, got.size());
-
-    // Unknown relay id #2, link: nothing.
+    // Unknown relay id #2: nothing.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id2,
-                                                          link_addr,
-                                                          64,
-                                                          zero,
-                                                          LeasePageSize(100)));
-    EXPECT_EQ(0, got.size());
-
-    // Relay id #0, other link: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id0,
-                                                          other_link_addr,
-                                                          64,
                                                           zero,
                                                           LeasePageSize(100)));
     EXPECT_EQ(0, got.size());
 
-    // Relay id #0, no link: 3 entries but 2 addresses.
+    // Relay id #0: 3 entries but 2 addresses.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id0,
-                                                          zero,
-                                                          0,
                                                           zero,
                                                           LeasePageSize(100)));
     ASSERT_EQ(2, got.size());
@@ -1141,10 +1119,8 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRelayId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Relay id #1, no link, partial: 2 entries.
+    // Relay id #1, partial: 2 entries.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          zero,
-                                                          0,
                                                           zero,
                                                           LeasePageSize(2)));
     ASSERT_EQ(2, got.size());
@@ -1155,78 +1131,14 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRelayId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Relay id #1, no link, partial from previous: 1 entry.
+    // Relay id #1, partial from previous: 1 entry.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          zero,
-                                                          0,
                                                           lease->addr_,
                                                           LeasePageSize(2)));
     ASSERT_EQ(1, got.size());
     lease = got[0];
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Add another entry for last tests.
-    EXPECT_NO_THROW(lease_mgr_->addRelayId6(lease_addr0, relay_id_data1));
-    EXPECT_EQ(7, lease_mgr_->byRelayId6size());
-
-    // Relay id #1, link: 3 entries.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          zero,
-                                                          LeasePageSize(100)));
-    ASSERT_EQ(3, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-    lease = got[1];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-    lease = got[2];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Relay id #1, link, initial partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          zero,
-                                                          LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-
-    // Relay id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          lease->addr_,
-                                                          LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-
-    // Relay id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          lease->addr_,
-                                                          LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Relay id #1, link, final partial: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id1,
-                                                          link_addr,
-                                                          64,
-                                                          lease->addr_,
-                                                          LeasePageSize(1)));
-    EXPECT_EQ(0, got.size());
 }
 
 /// @brief Verifies that getLeases6ByRemoteId works as expected.
@@ -1241,8 +1153,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRemoteId() {
     asiolink::IOAddress lease_addr0(ADDRESS6[0]);
     asiolink::IOAddress lease_addr1(ADDRESS6[1]);
     asiolink::IOAddress lease_addr2(ADDRESS6[2]);
-    asiolink::IOAddress link_addr(ADDRESS6[4]);
-    asiolink::IOAddress other_link_addr("2001:db8:1::4");
     asiolink::IOAddress zero = asiolink::IOAddress::IPV6_ZERO_ADDRESS();
     std::vector<uint8_t> remote_id0 = createFromString(DUIDS[0]);
     std::vector<uint8_t> remote_id1 = createFromString(DUIDS[1]);
@@ -1258,34 +1168,14 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRemoteId() {
     EXPECT_EQ(6, lease_mgr_->byRemoteId6size());
 
     Lease6Collection got;
-    // Unknown remote id #2, no link: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id2,
-                                                           zero,
-                                                           0,
-                                                           zero,
-                                                           LeasePageSize(10)));
-    EXPECT_EQ(0, got.size());
-
-    // Unknown remote id #2, link: nothing.
+    // Unknown remote id #2: nothing.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id2,
-                                                           link_addr,
-                                                           64,
-                                                           zero,
-                                                           LeasePageSize(10)));
-    EXPECT_EQ(0, got.size());
-
-    // Remote id #0, other link: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id0,
-                                                           other_link_addr,
-                                                           64,
                                                            zero,
                                                            LeasePageSize(10)));
     EXPECT_EQ(0, got.size());
 
-    // Remote id #0, no link: 3 entries but 2 addresses.
+    // Remote id #0: 3 entries but 2 addresses.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id0,
-                                                           zero,
-                                                           0,
                                                            zero,
                                                            LeasePageSize(10)));
     ASSERT_EQ(2, got.size());
@@ -1296,10 +1186,8 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRemoteId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Remote id #1, no link, partial: 2 entries.
+    // Remote id #1, partial: 2 entries.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           zero,
-                                                           0,
                                                            zero,
                                                            LeasePageSize(2)));
     ASSERT_EQ(2, got.size());
@@ -1310,78 +1198,14 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testGetLeases6ByRemoteId() {
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr1, lease->addr_);
 
-    // Remote id #1, no link, partial from previous: 1 entry.
+    // Remote id #1, partial from previous: 1 entry.
     EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           zero,
-                                                           0,
                                                            lease->addr_,
                                                            LeasePageSize(2)));
     ASSERT_EQ(1, got.size());
     lease = got[0];
     ASSERT_TRUE(lease);
     EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Add another entry for last tests.
-    EXPECT_NO_THROW(lease_mgr_->addRemoteId6(lease_addr0, remote_id1));
-    EXPECT_EQ(7, lease_mgr_->byRemoteId6size());
-
-    // Remote id #1, link: 3 entries.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           zero,
-                                                           LeasePageSize(10)));
-    ASSERT_EQ(3, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-    lease = got[1];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-    lease = got[2];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Remote id #1, link, initial partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           zero,
-                                                           LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr0, lease->addr_);
-
-    // Remote id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           lease->addr_,
-                                                           LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr1, lease->addr_);
-
-    // Remote id #1, link, next partial: 1 entry.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           lease->addr_,
-                                                           LeasePageSize(1)));
-    ASSERT_EQ(1, got.size());
-    lease = got[0];
-    ASSERT_TRUE(lease);
-    EXPECT_EQ(lease_addr2, lease->addr_);
-
-    // Remote id #1, link, final partial: nothing.
-    EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id1,
-                                                           link_addr,
-                                                           64,
-                                                           lease->addr_,
-                                                           LeasePageSize(1)));
-    EXPECT_EQ(0, got.size());
 }
 
 /// @brief Verifies that getLeases6ByLink works as expected.
@@ -1532,8 +1356,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testUpgradeExtendedInfo6(
         std::vector<uint8_t> relay_id_data = createFromString(DUIDS[4]);
         DUID relay_id(relay_id_data);
         EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id,
-                                                              zero,
-                                                              0,
                                                               zero,
                                                               ps100));
         ASSERT_EQ(1, got.size());
@@ -1542,8 +1364,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testUpgradeExtendedInfo6(
         // Check remote id.
         std::vector<uint8_t> remote_id = createFromString(DUIDS[5]);
         EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id,
-                                                               zero,
-                                                               0,
                                                                zero,
                                                                ps100));
         ASSERT_EQ(1, got.size());
@@ -1562,8 +1382,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testUpgradeExtendedInfo6(
 
             DUID relay_id(std::vector<uint8_t>(8, 0x64));
             EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id,
-                                                                  zero,
-                                                                  0,
                                                                   zero,
                                                                   ps100));
             ASSERT_EQ(1, got.size());
@@ -1576,8 +1394,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testUpgradeExtendedInfo6(
 
             std::vector<uint8_t> remote_id = { 1, 2, 3, 4, 5, 6 };
             EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id,
-                                                                   zero,
-                                                                   0,
                                                                    zero,
                                                                    ps100));
             ASSERT_EQ(1, got.size());
@@ -1600,8 +1416,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testUpgradeExtendedInfo6(
 
             DUID relay_id(std::vector<uint8_t>(8, 0x64));
             EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRelayId(relay_id,
-                                                                  zero,
-                                                                  0,
                                                                   zero,
                                                                   ps100));
             ASSERT_EQ(2, got.size());
@@ -1620,8 +1434,6 @@ GenericExtendedInfoTest<NakedLeaseMgrType>::testUpgradeExtendedInfo6(
 
             std::vector<uint8_t> remote_id = { 1, 2, 3, 4, 5, 6 };
             EXPECT_NO_THROW(got = lease_mgr_->getLeases6ByRemoteId(remote_id,
-                                                                   zero,
-                                                                   0,
                                                                    zero,
                                                                    ps100));
             ASSERT_EQ(2, got.size());