From: Razvan Becheriu Date: Fri, 6 Jan 2023 12:01:04 +0000 (+0200) Subject: [#2612] addressed review comments X-Git-Tag: Kea-2.3.4~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f16ef6a6738194af733394b6982f3e6636b3efcf;p=thirdparty%2Fkea.git [#2612] addressed review comments --- diff --git a/src/lib/dhcp/option6_pdexclude.cc b/src/lib/dhcp/option6_pdexclude.cc index dba17dca5f..4baaf55f11 100644 --- a/src/lib/dhcp/option6_pdexclude.cc +++ b/src/lib/dhcp/option6_pdexclude.cc @@ -44,7 +44,7 @@ Option6PDExclude::Option6PDExclude(const isc::asiolink::IOAddress& delegated_pre << static_cast(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 << "/" diff --git a/src/lib/dhcpsrv/pool.cc b/src/lib/dhcpsrv/pool.cc index 5f94a8e392..9323ad9f6b 100644 --- a/src/lib/dhcpsrv/pool.cc +++ b/src/lib/dhcpsrv/pool.cc @@ -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(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(excluded_prefix_len) - << ") must be longer than or equal to the delegated prefix length (" - << static_cast(delegated_len) << ")"); + << static_cast(excluded_prefix_len) + << ") must be longer than the delegated prefix length (" + << static_cast(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 diff --git a/src/lib/dhcpsrv/tests/pool_unittest.cc b/src/lib/dhcpsrv/tests/pool_unittest.cc index e44b7d21be..e079d05c9f 100644 --- a/src/lib/dhcpsrv/tests/pool_unittest.cc +++ b/src/lib/dhcpsrv/tests/pool_unittest.cc @@ -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.