]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2612] addressed review comments
authorRazvan Becheriu <razvan@isc.org>
Fri, 6 Jan 2023 12:01:04 +0000 (14:01 +0200)
committerRazvan Becheriu <razvan@isc.org>
Tue, 17 Jan 2023 08:41:58 +0000 (10:41 +0200)
src/lib/dhcp/option6_pdexclude.cc
src/lib/dhcpsrv/pool.cc
src/lib/dhcpsrv/tests/pool_unittest.cc

index dba17dca5ffde2c3b25e6c5619916d9722e90ded..4baaf55f113305c8f8f6f351857d6aec2de7b9af 100644 (file)
@@ -44,7 +44,7 @@ Option6PDExclude::Option6PDExclude(const isc::asiolink::IOAddress& delegated_pre
                   << static_cast<int>(excluded_prefix_length_));
     }
 
-    // Excluded prefix must be longer than or equal to the delegated prefix.
+    // Excluded prefix must be longer than the delegated prefix length.
     if (excluded_prefix_length_ <= delegated_prefix_length) {
         isc_throw(BadValue, "length of the excluded prefix "
                   << excluded_prefix << "/"
index 5f94a8e39266154df67c5f5c4e1b1d0b87f72449..9323ad9f6bf23a9178325685014290b55907b211 100644 (file)
@@ -151,7 +151,6 @@ Pool4::toElement() const {
     return (map);
 }
 
-
 Pool6::Pool6(Lease::Type type, const isc::asiolink::IOAddress& first,
              const isc::asiolink::IOAddress& last)
     : Pool(type, first, last), prefix_len_(128), pd_exclude_option_() {
@@ -299,7 +298,8 @@ Pool6::init(const Lease::Type& type,
                   << static_cast<int>(prefix_len) << ")");
     }
 
-    if (((type == Lease::TYPE_NA) || (type == Lease::TYPE_TA)) && (delegated_len != 128)) {
+    if (((type == Lease::TYPE_NA) || (type == Lease::TYPE_TA)) &&
+        (delegated_len != 128)) {
         isc_throw(BadValue, "For IA or TA pools, delegated prefix length must"
                   << " be 128.");
     }
@@ -307,9 +307,9 @@ Pool6::init(const Lease::Type& type,
     // excluded_prefix_len == 0 means there's no excluded prefix at all.
     if (excluded_prefix_len && (excluded_prefix_len <= delegated_len)) {
         isc_throw(BadValue, "Excluded prefix ("
-                                << static_cast<int>(excluded_prefix_len)
-                                << ") must be longer than or equal to the delegated prefix length ("
-                                << static_cast<int>(delegated_len) << ")");
+                  << static_cast<int>(excluded_prefix_len)
+                  << ") must be longer than the delegated prefix length ("
+                  << static_cast<int>(delegated_len) << ")");
     }
 
     /// @todo: We should probably implement checks against weird addresses
@@ -408,7 +408,6 @@ Pool6::toElement() const {
     return (map);
 }
 
-
 std::string
 Pool6::toText() const {
     std::ostringstream s;
@@ -423,5 +422,5 @@ Pool6::toText() const {
     return (s.str());
 }
 
-}; // end of isc::dhcp namespace
-}; // end of isc namespace
+} // end of isc::dhcp namespace
+} // end of isc namespace
index e44b7d21be79f6c36d781aa4337e0aa825d1fa05..e079d05c9f261bf70446238b57859491133f4cef 100644 (file)
@@ -363,10 +363,10 @@ TEST(Pool6Test, PD) {
     EXPECT_THROW(Pool6 pool2(Lease::TYPE_PD, IOAddress("2001:db8:1::1"),
                              IOAddress("2001:db8:1::f")), BadValue);
 
-    // Check that it's not allowed to specify bigger prefix than the pool
-    // prefix len
+    // Check that it's not allowed to specify bigger prefix address than the
+    // pool prefix length
     // Should not be able to compute prefix if first address is not starting
-    // from prefix len 32 (2001:db8::)
+    // from prefix length 32 (2001:db8::)
     EXPECT_THROW(Pool6 pool3(Lease::TYPE_PD, IOAddress("2001:db8:1::"),
                              32, 56), BadValue);
 
@@ -423,7 +423,7 @@ TEST(Pool6Test, PDExclude) {
     // Again, the excluded prefix length must be greater than main prefix
     // length.
     EXPECT_THROW(Pool6(IOAddress("2001:db8:1::"), 96, 112,
-                       IOAddress("2001:db8:1::"), 112),
+                       IOAddress("2001:db8:1::"), 104),
                  BadValue);
 
     // The "unspecified" excluded prefix must have both values set to 0.