]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2725] removed strict check
authorRazvan Becheriu <razvan@isc.org>
Thu, 29 Jun 2023 16:14:27 +0000 (19:14 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 29 Jun 2023 17:54:14 +0000 (20:54 +0300)
src/lib/dhcpsrv/host.cc
src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/tests/host_unittest.cc
src/lib/dhcpsrv/tests/lease_unittest.cc

index 458d100810b85a8ce5d46a8818ece0fc5c6c23a8..1d0f85548536454a0fd80a11ac0685f39963435f 100644 (file)
@@ -107,16 +107,6 @@ IPv6Resrv::set(const Type& type, const asiolink::IOAddress& prefix,
                   << static_cast<int>(prefix_len)
                   << "' for reserved IPv6 address, expected 128");
     }
-    /* uncomment if strict prefix and prefix length is required. see #2943
-    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;
     prefix_ = prefix;
index 6dfeaaa2deee0a31c791393ed4388acf63f8f9fc..9dad4083d187951be414ede2d68777c7e5594927 100644 (file)
@@ -462,16 +462,6 @@ Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
         if (type != Lease::TYPE_PD) {
             isc_throw(BadValue, "prefixlen must be 128 for non prefix type");
         }
-        /* uncomment if strict prefix and prefix length is required. see #2943
-        else {
-            IOAddress first_address = firstAddrInPrefix(addr, prefixlen);
-            if (first_address != addr) {
-                isc_throw(BadValue, "Invalid lease address boundaries: " << addr
-                          << " is not the first address in prefix: " << first_address
-                          << "/" << static_cast<uint32_t>(prefixlen));
-            }
-        }
-        */
     }
 
     cltt_ = time(NULL);
@@ -497,16 +487,6 @@ Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
         if (type != Lease::TYPE_PD) {
             isc_throw(BadValue, "prefixlen must be 128 for non prefix type");
         }
-        /* uncomment if strict prefix and prefix length is required. see #2943
-        else {
-            IOAddress first_address = firstAddrInPrefix(addr, prefixlen);
-            if (first_address != addr) {
-                isc_throw(BadValue, "Invalid lease address boundaries: " << addr
-                          << " is not the first address in prefix: " << first_address
-                          << "/" << static_cast<uint32_t>(prefixlen));
-            }
-        }
-        */
     }
 
     cltt_ = time(NULL);
index 170d9b3eb3109ea910bff531c05ecae8ebeadac4..690c6d2974073deaf2b0ab9c8c8daff60e9f4526 100644 (file)
@@ -86,14 +86,6 @@ TEST(IPv6ResrvTest, constructiorInvalidPrefixLength) {
     EXPECT_THROW_MSG(IPv6Resrv(IPv6Resrv::TYPE_NA,
                                IOAddress("2001:db8:1::"), 64),
                      isc::BadValue, expected);
-    /* uncomment if strict prefix and prefix length is required. see #2943
-    // 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
@@ -124,14 +116,6 @@ TEST(IPv6ResrvTest, setPrefix) {
     EXPECT_THROW_MSG(resrv.set(IPv6Resrv::TYPE_PD,
                                IOAddress("2001:db8:1::"), 129),
                      isc::BadValue, expected);
-    /* uncomment if strict prefix and prefix length is required. see #2943
-    // 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 7608d40f4cefaaa6ec0093c6ed527dc0eb76a707..e50db582bbae8941ed086dda34493ededc306d08 100644 (file)
@@ -657,22 +657,6 @@ TEST(Lease6Test, constructorDefault) {
                                              subnet_id, true, true, "", HWAddrPtr())),
                      BadValue, "DUID is mandatory for an IPv6 lease");
 
-    /* uncomment if strict prefix and prefix length is required. see #2943
-    // Lease6 must have a valid prefix and prefix length.
-    addr = IOAddress(ADDRESS[5]);
-    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");
-
-    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");
-    */
-
     // Lease6 must have a prefixlen set to 128 for non prefix type.
     addr = IOAddress(ADDRESS[4]);
     EXPECT_THROW_MSG(lease2.reset(new Lease6(Lease::TYPE_NA, addr,