summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorRazvan Becheriu <razvan@isc.org>2023-06-29 09:31:35 +0200
committerRazvan Becheriu <razvan@isc.org>2023-06-29 19:54:14 +0200
commit70f4321e4ca7962a2b9eae102920aee19b46d45f (patch)
treef833dc7adc46467fd7c971a1be890bab324ad064 /src/lib
parent[#2725] addressed review comments (diff)
downloadkea-70f4321e4ca7962a2b9eae102920aee19b46d45f.tar.xz
kea-70f4321e4ca7962a2b9eae102920aee19b46d45f.zip
[#2725] fixed v6 reservations
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dhcp/tests/libdhcp++_unittest.cc13
-rw-r--r--src/lib/dhcpsrv/host.cc15
-rw-r--r--src/lib/dhcpsrv/lease.cc4
-rw-r--r--src/lib/dhcpsrv/tests/host_unittest.cc17
-rw-r--r--src/lib/dhcpsrv/tests/lease_unittest.cc6
-rw-r--r--src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc2
-rw-r--r--src/lib/dhcpsrv/tests/mysql_lease_extended_info_unittest.cc2
-rw-r--r--src/lib/dhcpsrv/tests/pgsql_lease_extended_info_unittest.cc2
-rw-r--r--src/lib/dhcpsrv/tests/subnet_unittest.cc2
-rw-r--r--src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc64
10 files changed, 77 insertions, 50 deletions
diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc
index 9f7ff5187f..7c05b97859 100644
--- a/src/lib/dhcp/tests/libdhcp++_unittest.cc
+++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc
@@ -1121,7 +1121,7 @@ TEST_F(LibDhcpTest, splitOptionNoBufferMultiThreading) {
boost::shared_ptr<CallBack> call_back = boost::make_shared<CallBack>(work);
tp.add(call_back);
}
- ASSERT_TRUE(tp.wait(5));
+ ASSERT_TRUE(tp.wait(10));
}
// This test verifies that split options works if there is only one byte
@@ -1177,7 +1177,7 @@ TEST_F(LibDhcpTest, splitOptionOneByteLeftBufferMultiThreading) {
boost::shared_ptr<CallBack> call_back = boost::make_shared<CallBack>(work);
tp.add(call_back);
}
- ASSERT_TRUE(tp.wait(5));
+ ASSERT_TRUE(tp.wait(10));
}
// This test verifies that split options for v4 is working correctly.
@@ -1289,10 +1289,11 @@ TEST_F(LibDhcpTest, splitOptionWithSuboptionAtLimitMultiThreading) {
auto const& work = [&] {
splitOptionWithSuboptionAtLimit(bottom_opt, middle_opt, top_opt);
};
+
boost::shared_ptr<CallBack> call_back = boost::make_shared<CallBack>(work);
tp.add(call_back);
}
- ASSERT_TRUE(tp.wait(5));
+ ASSERT_TRUE(tp.wait(10));
}
// This test verifies that split options for v4 is working correctly.
@@ -1346,7 +1347,7 @@ TEST_F(LibDhcpTest, splitLongOptionMultiThreading) {
boost::shared_ptr<CallBack> call_back = boost::make_shared<CallBack>(work);
tp.add(call_back);
}
- ASSERT_TRUE(tp.wait(5));
+ ASSERT_TRUE(tp.wait(10));
}
// This test verifies that split options for v4 is working correctly even if
@@ -1432,7 +1433,7 @@ TEST_F(LibDhcpTest, splitOptionWithSuboptionWhichOverflowMultiThreading) {
boost::shared_ptr<CallBack> call_back = boost::make_shared<CallBack>(work);
tp.add(call_back);
}
- ASSERT_TRUE(tp.wait(5));
+ ASSERT_TRUE(tp.wait(10));
}
// This test verifies that split options for v4 is working correctly.
@@ -1530,7 +1531,7 @@ TEST_F(LibDhcpTest, splitLongOptionWithLongSuboptionMultiThreading) {
boost::shared_ptr<CallBack> call_back = boost::make_shared<CallBack>(work);
tp.add(call_back);
}
- ASSERT_TRUE(tp.wait(5));
+ ASSERT_TRUE(tp.wait(10));
}
// This test verifies that fuse options for v4 is working correctly.
diff --git a/src/lib/dhcpsrv/host.cc b/src/lib/dhcpsrv/host.cc
index 73f4548578..0f9c4212ef 100644
--- a/src/lib/dhcpsrv/host.cc
+++ b/src/lib/dhcpsrv/host.cc
@@ -6,13 +6,15 @@
#include <config.h>
+#include <asiolink/io_address.h>
+#include <asiolink/addr_utilities.h>
+#include <cryptolink/crypto_rng.h>
#include <dhcp/pkt4.h>
#include <dhcpsrv/host.h>
+#include <exceptions/exceptions.h>
+
#include <util/encode/hex.h>
#include <util/strutil.h>
-#include <asiolink/io_address.h>
-#include <cryptolink/crypto_rng.h>
-#include <exceptions/exceptions.h>
#include <sstream>
@@ -104,6 +106,13 @@ IPv6Resrv::set(const Type& type, const asiolink::IOAddress& prefix,
isc_throw(isc::BadValue, "invalid prefix length '"
<< static_cast<int>(prefix_len)
<< "' for reserved IPv6 address, expected 128");
+ } else if ((type == TYPE_PD) && (prefix_len != 128)) {
+ IOAddress first_address = firstAddrInPrefix(prefix, prefix_len);
+ if (first_address != prefix) {
+ isc_throw(BadValue, "Invalid host address boundaries: " << prefix
+ << " is not the first address in prefix: " << first_address
+ << "/" << static_cast<uint32_t>(prefix_len));
+ }
}
type_ = type;
diff --git a/src/lib/dhcpsrv/lease.cc b/src/lib/dhcpsrv/lease.cc
index 310dd8e8a8..375a6fc032 100644
--- a/src/lib/dhcpsrv/lease.cc
+++ b/src/lib/dhcpsrv/lease.cc
@@ -464,7 +464,7 @@ Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
} else {
IOAddress first_address = firstAddrInPrefix(addr, prefixlen);
if (first_address != addr) {
- isc_throw(BadValue, "Invalid Lease address boundaries: " << addr
+ isc_throw(BadValue, "Invalid lease address boundaries: " << addr
<< " is not the first address in prefix: " << first_address
<< "/" << static_cast<uint32_t>(prefixlen));
}
@@ -496,7 +496,7 @@ Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
} else {
IOAddress first_address = firstAddrInPrefix(addr, prefixlen);
if (first_address != addr) {
- isc_throw(BadValue, "Invalid Lease address boundaries: " << addr
+ isc_throw(BadValue, "Invalid lease address boundaries: " << addr
<< " is not the first address in prefix: " << first_address
<< "/" << static_cast<uint32_t>(prefixlen));
}
diff --git a/src/lib/dhcpsrv/tests/host_unittest.cc b/src/lib/dhcpsrv/tests/host_unittest.cc
index 836824f68d..042e7de244 100644
--- a/src/lib/dhcpsrv/tests/host_unittest.cc
+++ b/src/lib/dhcpsrv/tests/host_unittest.cc
@@ -82,11 +82,17 @@ TEST(IPv6ResrvTest, constructiorInvalidPrefixLength) {
EXPECT_THROW_MSG(IPv6Resrv(IPv6Resrv::TYPE_PD,
IOAddress("2001:db8:1::"), 244),
isc::BadValue, expected);
- expected = "invalid prefix length '64' for reserved IPv6 address, ";
- expected += "expected 128";
+ expected = "invalid prefix length '64' for reserved IPv6 address, expected 128";
EXPECT_THROW_MSG(IPv6Resrv(IPv6Resrv::TYPE_NA,
IOAddress("2001:db8:1::"), 64),
isc::BadValue, expected);
+
+ // Check for extra specified bits in prefix.
+ expected = "Invalid host address boundaries: 2001:db8:1:: is not the first "
+ "address in prefix: 2001:db8::/32";
+ EXPECT_THROW_MSG(IPv6Resrv(IPv6Resrv::TYPE_PD,
+ IOAddress("2001:db8:1::"), 32),
+ isc::BadValue, expected);
}
// This test verifies that it is possible to modify prefix and its
@@ -117,6 +123,13 @@ TEST(IPv6ResrvTest, setPrefix) {
EXPECT_THROW_MSG(resrv.set(IPv6Resrv::TYPE_PD,
IOAddress("2001:db8:1::"), 129),
isc::BadValue, expected);
+
+ // Check for extra specified bits in prefix.
+ expected = "Invalid host address boundaries: 2001:db8:1:: is not the first "
+ "address in prefix: 2001:db8::/32";
+ EXPECT_THROW_MSG(resrv.set(IPv6Resrv::TYPE_PD,
+ IOAddress("2001:db8:1::"), 32),
+ isc::BadValue, expected);
}
// This test checks that the equality operators work fine.
diff --git a/src/lib/dhcpsrv/tests/lease_unittest.cc b/src/lib/dhcpsrv/tests/lease_unittest.cc
index e6d5169e9d..a3cfb86615 100644
--- a/src/lib/dhcpsrv/tests/lease_unittest.cc
+++ b/src/lib/dhcpsrv/tests/lease_unittest.cc
@@ -662,12 +662,14 @@ TEST(Lease6Test, constructorDefault) {
EXPECT_THROW_MSG(lease2.reset(new Lease6(Lease::TYPE_PD, addr,
duid, iaid, 100, 200,
subnet_id, HWAddrPtr(), 16)),
- BadValue, "Invalid Lease address boundaries: 8000::1 is not the first address in prefix: 8000::/16");
+ BadValue, "Invalid lease address boundaries: 8000::1 is not "
+ "the first address in prefix: 8000::/16");
EXPECT_THROW_MSG(lease2.reset(new Lease6(Lease::TYPE_PD, addr,
duid, iaid, 100, 200,
subnet_id, true, true, "", HWAddrPtr(), 16)),
- BadValue, "Invalid Lease address boundaries: 8000::1 is not the first address in prefix: 8000::/16");
+ BadValue, "Invalid lease address boundaries: 8000::1 is not "
+ "the first address in prefix: 8000::/16");
// Lease6 must have a prefixlen set to 128 for non prefix type.
addr = IOAddress(ADDRESS[4]);
diff --git a/src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc
index a272e297f2..4b1efcde68 100644
--- a/src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc
+++ b/src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc
@@ -34,7 +34,7 @@ const vector<string> ADDRESS4 = {
/// @brief IPv6 addresses used in the tests.
const vector<string> ADDRESS6 = {
- "2001:db8::0", "2001:db8::1", "2001:db8::2", "2001:db8::3",
+ "2001:db8::", "2001:db8::1", "2001:db8::2", "2001:db8::3",
"2001:db8::4", "2001:db8::5", "2001:db8::6", "2001:db8::7"
};
diff --git a/src/lib/dhcpsrv/tests/mysql_lease_extended_info_unittest.cc b/src/lib/dhcpsrv/tests/mysql_lease_extended_info_unittest.cc
index 74d668e28f..fda21951b1 100644
--- a/src/lib/dhcpsrv/tests/mysql_lease_extended_info_unittest.cc
+++ b/src/lib/dhcpsrv/tests/mysql_lease_extended_info_unittest.cc
@@ -38,7 +38,7 @@ const vector<string> ADDRESS4 = {
/// @brief IPv6 addresses used in the tests.
const vector<string> ADDRESS6 = {
- "2001:db8::0", "2001:db8::1", "2001:db8::2", "2001:db8::3",
+ "2001:db8::", "2001:db8::1", "2001:db8::2", "2001:db8::3",
"2001:db8::4", "2001:db8::5", "2001:db8::6", "2001:db8::7"
};
diff --git a/src/lib/dhcpsrv/tests/pgsql_lease_extended_info_unittest.cc b/src/lib/dhcpsrv/tests/pgsql_lease_extended_info_unittest.cc
index 7107632428..b6547169f8 100644
--- a/src/lib/dhcpsrv/tests/pgsql_lease_extended_info_unittest.cc
+++ b/src/lib/dhcpsrv/tests/pgsql_lease_extended_info_unittest.cc
@@ -38,7 +38,7 @@ const vector<string> ADDRESS4 = {
/// @brief IPv6 addresses used in the tests.
const vector<string> ADDRESS6 = {
- "2001:db8::0", "2001:db8::1", "2001:db8::2", "2001:db8::3",
+ "2001:db8::", "2001:db8::1", "2001:db8::2", "2001:db8::3",
"2001:db8::4", "2001:db8::5", "2001:db8::6", "2001:db8::7"
};
diff --git a/src/lib/dhcpsrv/tests/subnet_unittest.cc b/src/lib/dhcpsrv/tests/subnet_unittest.cc
index 42229d8ee3..69f762cace 100644
--- a/src/lib/dhcpsrv/tests/subnet_unittest.cc
+++ b/src/lib/dhcpsrv/tests/subnet_unittest.cc
@@ -941,7 +941,7 @@ TEST(Subnet6Test, inRange) {
EXPECT_EQ(4000, subnet.getValid().get());
EXPECT_FALSE(subnet.inRange(IOAddress("2001:db8:0:ffff:ffff:ffff:ffff:ffff")));
- EXPECT_TRUE(subnet.inRange(IOAddress("2001:db8:1::0")));
+ EXPECT_TRUE(subnet.inRange(IOAddress("2001:db8:1::")));
EXPECT_TRUE(subnet.inRange(IOAddress("2001:db8:1::1")));
EXPECT_TRUE(subnet.inRange(IOAddress("2001:db8:1::ffff:ffff:ffff:ffff")));
EXPECT_FALSE(subnet.inRange(IOAddress("2001:db8:1:1::")));
diff --git a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
index 562109d03b..e466dffcd2 100644
--- a/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc
@@ -6,6 +6,7 @@
#include <config.h>
+#include <asiolink/addr_utilities.h>
#include <database/database_connection.h>
#include <database/db_exceptions.h>
#include <dhcp/dhcp6.h>
@@ -1635,7 +1636,8 @@ GenericHostDataSourceTest::testSubnetId6(int subnets, Host::IdentifierType id) {
ASSERT_TRUE(hdsptr_);
HostPtr host;
- IOAddress current_address("2001:db8::0");
+ IOAddress current_address("2001:db8::");
+ ASSERT_LT(subnets, std::numeric_limits<uint16_t>::max()) << "Too many subnets. Broken test?";
for (int i = 0; i < subnets; ++i) {
// Last boolean value set to false indicates that the same identifier
// must be used for each generated host.
@@ -1650,7 +1652,7 @@ GenericHostDataSourceTest::testSubnetId6(int subnets, Host::IdentifierType id) {
// Increase address to make sure we don't assign the same address
// in different subnets.
- current_address = IOAddress::increase(current_address);
+ current_address = offsetAddress(current_address, (uint128_t(1) << 80));
}
// Check that the reservations can be retrieved from each subnet separately.
@@ -1683,13 +1685,13 @@ GenericHostDataSourceTest::testGetByIPv6(Host::IdentifierType id, bool prefix) {
ASSERT_TRUE(hdsptr_);
// Let's create a couple of hosts...
- HostPtr host1 = HostDataSourceUtils::initializeHost6("2001:db8::1",
+ HostPtr host1 = HostDataSourceUtils::initializeHost6("2001:db8:1::",
id, prefix, "key##1");
- HostPtr host2 = HostDataSourceUtils::initializeHost6("2001:db8::2",
+ HostPtr host2 = HostDataSourceUtils::initializeHost6("2001:db8:2::",
id, prefix, "key##2");
- HostPtr host3 = HostDataSourceUtils::initializeHost6("2001:db8::3",
+ HostPtr host3 = HostDataSourceUtils::initializeHost6("2001:db8:3::",
id, prefix, "key##3");
- HostPtr host4 = HostDataSourceUtils::initializeHost6("2001:db8::4",
+ HostPtr host4 = HostDataSourceUtils::initializeHost6("2001:db8:4::",
id, prefix, "key##4");
// ... and add them to the data source.
@@ -1702,10 +1704,10 @@ GenericHostDataSourceTest::testGetByIPv6(Host::IdentifierType id, bool prefix) {
uint8_t len = prefix ? 64 : 128;
// And then try to retrieve them back.
- ConstHostPtr from_hds1 = hdsptr_->get6(IOAddress("2001:db8::1"), len);
- ConstHostPtr from_hds2 = hdsptr_->get6(IOAddress("2001:db8::2"), len);
- ConstHostPtr from_hds3 = hdsptr_->get6(IOAddress("2001:db8::3"), len);
- ConstHostPtr from_hds4 = hdsptr_->get6(IOAddress("2001:db8::4"), len);
+ ConstHostPtr from_hds1 = hdsptr_->get6(IOAddress("2001:db8:1::"), len);
+ ConstHostPtr from_hds2 = hdsptr_->get6(IOAddress("2001:db8:2::"), len);
+ ConstHostPtr from_hds3 = hdsptr_->get6(IOAddress("2001:db8:3::"), len);
+ ConstHostPtr from_hds4 = hdsptr_->get6(IOAddress("2001:db8:4::"), len);
// Make sure we got something back.
ASSERT_TRUE(from_hds1);
@@ -1772,7 +1774,7 @@ GenericHostDataSourceTest::testAddDuplicate6WithSameDUID() {
ASSERT_TRUE(hdsptr_);
// Create a host reservations.
- HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_DUID, true);
+ HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_DUID, true);
// Add this reservation once.
ASSERT_NO_THROW(hdsptr_->add(host));
@@ -1787,7 +1789,7 @@ GenericHostDataSourceTest::testAddDuplicate6WithSameHWAddr() {
ASSERT_TRUE(hdsptr_);
// Create a host reservations.
- HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true);
+ HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_HWADDR, true);
// Add this reservation once.
ASSERT_NO_THROW(hdsptr_->add(host));
@@ -1802,14 +1804,14 @@ GenericHostDataSourceTest::testAddDuplicateIPv6() {
ASSERT_TRUE(hdsptr_);
// Create a host reservation.
- HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true);
+ HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_HWADDR, true);
// Add this reservation once.
ASSERT_NO_THROW(hdsptr_->add(host));
// Create a host with a different identifier but the same IPv6 address. An attempt
// to create the reservation for the same IPv6 address should fail.
- host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true);
+ host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_HWADDR, true);
EXPECT_THROW(hdsptr_->add(host), DuplicateEntry);
}
@@ -1820,8 +1822,8 @@ GenericHostDataSourceTest::testAllowDuplicateIPv6() {
ASSERT_TRUE(hdsptr_->setIPReservationsUnique(false));
// Create a host reservations.
- HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true, true);
- addIPv6Address(host, "2001:db8::2");
+ HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_HWADDR, true, true);
+ addIPv6Address(host, "2001:db8:2::");
auto host_id = host->getHostId();
auto subnet_id = host->getIPv6SubnetID();
@@ -1830,8 +1832,8 @@ GenericHostDataSourceTest::testAllowDuplicateIPv6() {
// Then try to add it again, it should throw an exception because the
// HWADDR is the same.
- host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true, false);
- addIPv6Address(host, "2001:db8::2");
+ host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_HWADDR, true, false);
+ addIPv6Address(host, "2001:db8:2::");
host->setHostId(++host_id);
host->setIPv6SubnetID(subnet_id);
ASSERT_THROW(hdsptr_->add(host), DuplicateEntry);
@@ -1840,21 +1842,21 @@ GenericHostDataSourceTest::testAllowDuplicateIPv6() {
// This update should succeed because we permitted to create
// multiple IP reservations for the same IP address but different
// identifier.
- host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_HWADDR, true, true);
+ host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_HWADDR, true, true);
host->setHostId(++host_id);
host->setIPv6SubnetID(subnet_id);
ASSERT_NO_THROW(hdsptr_->add(host));
ConstHostCollection returned;
- ASSERT_NO_THROW(returned = hdsptr_->getAll6(host->getIPv6SubnetID(), IOAddress("2001:db8::1")));
+ ASSERT_NO_THROW(returned = hdsptr_->getAll6(host->getIPv6SubnetID(), IOAddress("2001:db8:1::")));
EXPECT_EQ(2, returned.size());
EXPECT_NE(returned[0]->getIdentifierAsText(), returned[1]->getIdentifierAsText());
// Let's now try to delete the hosts by subnet_id and address.
bool deleted = false;
- ASSERT_NO_THROW(deleted = hdsptr_->del(subnet_id, IOAddress("2001:db8::1")));
+ ASSERT_NO_THROW(deleted = hdsptr_->del(subnet_id, IOAddress("2001:db8:1::")));
ASSERT_TRUE(deleted);
- ASSERT_NO_THROW(returned = hdsptr_->getAll6(host->getIPv6SubnetID(), IOAddress("2001:db8::1")));
+ ASSERT_NO_THROW(returned = hdsptr_->getAll6(host->getIPv6SubnetID(), IOAddress("2001:db8:1::")));
EXPECT_TRUE(returned.empty());
}
@@ -1945,7 +1947,7 @@ GenericHostDataSourceTest::testAddr6AndPrefix() {
ASSERT_TRUE(hdsptr_);
// Create a host reservations with prefix reservation (prefix = true)
- HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8::1", Host::IDENT_DUID, true);
+ HostPtr host = HostDataSourceUtils::initializeHost6("2001:db8:1::", Host::IDENT_DUID, true);
// Create IPv6 reservation (for an address) and add it to the host
IPv6Resrv resv(IPv6Resrv::TYPE_NA, IOAddress("2001:db8::2"), 128);
@@ -4196,7 +4198,7 @@ HostMgrTest::testGet6ByPrefix(BaseHostDataSource& data_source1,
addHost6(data_source1, duids_[0], SubnetID(2), IOAddress("2001:db8:1::"), 64);
// Add another host having a reservation for prefix 2001:db8:1:0:6::/72.
- addHost6(data_source2, duids_[1], SubnetID(3), IOAddress("2001:db8:1:0:6::"), 72);
+ addHost6(data_source2, duids_[1], SubnetID(3), IOAddress("2001:db8:1:0:6::"), 80);
CfgMgr::instance().commit();
@@ -4212,10 +4214,10 @@ HostMgrTest::testGet6ByPrefix(BaseHostDataSource& data_source1,
EXPECT_FALSE(host);
// Retrieve second reservation.
- host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 72);
+ host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 80);
ASSERT_TRUE(host);
EXPECT_TRUE(host->hasReservation(IPv6Resrv(IPv6Resrv::TYPE_PD,
- IOAddress("2001:db8:1:0:6::"), 72)));
+ IOAddress("2001:db8:1:0:6::"), 80)));
// Make sure the second reservation is not retrieved when the prefix
// length is incorrect.
@@ -4236,11 +4238,11 @@ HostMgrTest::testGet6ByPrefix(BaseHostDataSource& data_source1,
EXPECT_FALSE(host);
}
- host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 72, HostMgrOperationTarget::PRIMARY_SOURCE);
+ host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 80, HostMgrOperationTarget::PRIMARY_SOURCE);
if (is_second_source_primary) {
EXPECT_TRUE(host);
EXPECT_TRUE(host->hasReservation(IPv6Resrv(IPv6Resrv::TYPE_PD,
- IOAddress("2001:db8:1:0:6::"), 72)));
+ IOAddress("2001:db8:1:0:6::"), 80)));
} else {
EXPECT_FALSE(host);
}
@@ -4255,17 +4257,17 @@ HostMgrTest::testGet6ByPrefix(BaseHostDataSource& data_source1,
EXPECT_FALSE(host);
}
- host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 72, HostMgrOperationTarget::ALTERNATE_SOURCES);
+ host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 80, HostMgrOperationTarget::ALTERNATE_SOURCES);
if (!is_second_source_primary) {
EXPECT_TRUE(host);
EXPECT_TRUE(host->hasReservation(IPv6Resrv(IPv6Resrv::TYPE_PD,
- IOAddress("2001:db8:1:0:6::"), 72)));
+ IOAddress("2001:db8:1:0:6::"), 80)));
} else {
EXPECT_FALSE(host);
}
// Select hosts for an unspecified source.
- host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 72, HostMgrOperationTarget::UNSPECIFIED_SOURCE);
+ host = HostMgr::instance().get6(IOAddress("2001:db8:1:0:6::"), 80, HostMgrOperationTarget::UNSPECIFIED_SOURCE);
EXPECT_FALSE(host);
}