]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2725] fixed v6 reservations
authorRazvan Becheriu <razvan@isc.org>
Thu, 29 Jun 2023 07:31:35 +0000 (10:31 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 29 Jun 2023 17:54:14 +0000 (20:54 +0300)
src/lib/dhcp/tests/libdhcp++_unittest.cc
src/lib/dhcpsrv/host.cc
src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/tests/host_unittest.cc
src/lib/dhcpsrv/tests/lease_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc
src/lib/dhcpsrv/tests/mysql_lease_extended_info_unittest.cc
src/lib/dhcpsrv/tests/pgsql_lease_extended_info_unittest.cc
src/lib/dhcpsrv/tests/subnet_unittest.cc
src/lib/dhcpsrv/testutils/generic_host_data_source_unittest.cc

index 9f7ff5187f85a67d9ab6ebcc51459c3034fdb634..7c05b9785965a95d9b7dc058b738ace31a9b17b5 100644 (file)
@@ -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.
index 73f454857821556e9554682ea9928870e15e91d6..0f9c4212efa2bd57b7093bfa5ce84b937fcf9f71 100644 (file)
@@ -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;
index 310dd8e8a8f4c7a9a51648f46192ea36445507dc..375a6fc032064ab8d534826d6b2b791a216158a1 100644 (file)
@@ -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));
             }
index 836824f68d1f6adb365ef59a61b5f33e3abbaf30..042e7de2440bd8df8e8cea0837687c9dfe579d77 100644 (file)
@@ -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.
index e6d5169e9df3a333304ce15a40a7fef8de605ec8..a3cfb866156688e63c657b0fe4947ffa8438d006 100644 (file)
@@ -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]);
index a272e297f299491122bc396d1741c933fef916fe..4b1efcde6871b4f6a3332c610f5d20daa54239d2 100644 (file)
@@ -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"
 };
 
index 74d668e28feae1c3de9a17030f8da1842b7b3804..fda21951b1563ed6f4d40ce46c7c0cf54d8d11a4 100644 (file)
@@ -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"
 };
 
index 7107632428e3fc627c14eb55a33d03b008caa094..b6547169f8acfe75fe439ab7cf57c556821ee897 100644 (file)
@@ -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"
 };
 
index 42229d8ee33d5c18e1c0340535dbcd094954dbbc..69f762cace67620c85566dff8441692bc66250a6 100644 (file)
@@ -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::")));
index 562109d03b05a28d5381b2d63ecf66a5999a6163..e466dffcd22dc210e3681e2f66ad986e89cc7101 100644 (file)
@@ -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);
 }