From: Razvan Becheriu Date: Thu, 29 Jun 2023 17:09:35 +0000 (+0300) Subject: [#2725] addressed review comments X-Git-Tag: Kea-2.4.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13564c41b52317b29f21cac9074f2d6dbba86b3c;p=thirdparty%2Fkea.git [#2725] addressed review comments --- diff --git a/src/hooks/dhcp/lease_cmds/lease_parser.cc b/src/hooks/dhcp/lease_cmds/lease_parser.cc index 2ba0c39785..7eb4119fd8 100644 --- a/src/hooks/dhcp/lease_cmds/lease_parser.cc +++ b/src/hooks/dhcp/lease_cmds/lease_parser.cc @@ -394,8 +394,8 @@ Lease6Parser::parse(ConstSrvConfigPtr& cfg, if (prefix_len != 128) { IOAddress first_address = firstAddrInPrefix(addr, prefix_len); if (first_address != addr) { - isc_throw(BadValue, "Invalid Pool6 address boundaries: " << addr - << " is not the first address in prefix: " << first_address + isc_throw(BadValue, "Prefix address: " << addr + << " exceeds prefix/prefix-len pair: " << first_address << "/" << static_cast(prefix_len)); } } diff --git a/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc b/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc index 3fa9a5b635..9b95b5e08d 100644 --- a/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc +++ b/src/hooks/dhcp/lease_cmds/tests/lease_cmds6_unittest.cc @@ -712,7 +712,7 @@ void Lease6CmdsTest::testLease6AddBadParams() { " \"iaid\": 1234\n" " }\n" "}"; - exp_rsp = "Invalid Pool6 address boundaries: 2001:db8:1::1 is not the first address in prefix: 2001:db8:1::/48"; + exp_rsp = "Prefix address: 2001:db8:1::1 exceeds prefix/prefix-len pair: 2001:db8:1::/48"; testCommand(txt, CONTROL_RESULT_ERROR, exp_rsp); } @@ -2215,7 +2215,7 @@ void Lease6CmdsTest::testLease6UpdateBadParams() { " \"iaid\": 1234\n" " }\n" "}"; - exp_rsp = "Invalid Pool6 address boundaries: 2001:db8:1::1 is not the first address in prefix: 2001:db8:1::/48"; + exp_rsp = "Prefix address: 2001:db8:1::1 exceeds prefix/prefix-len pair: 2001:db8:1::/48"; testCommand(txt, CONTROL_RESULT_ERROR, exp_rsp); } @@ -3240,7 +3240,7 @@ void Lease6CmdsTest::testLease6BulkApplyAddsOnlyBadParam() { " ]" " }" "}"; - exp_rsp = "Invalid Pool6 address boundaries: 2001:db8:1::123 is not the first address in prefix: 2001:db8:1::/48"; + exp_rsp = "Prefix address: 2001:db8:1::123 exceeds prefix/prefix-len pair: 2001:db8:1::/48"; testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp); // Check that the lease was not inserted. @@ -3340,7 +3340,7 @@ void Lease6CmdsTest::testLease6BulkApplyUpdatesOnlyBadParam() { " ]" " }" "}"; - exp_rsp = "Invalid Pool6 address boundaries: 2001:db8:1234:ab:: is not the first address in prefix: 2001:db8:1234::/56"; + exp_rsp = "Prefix address: 2001:db8:1234:ab:: exceeds prefix/prefix-len pair: 2001:db8:1234::/56"; testCommand(cmd, CONTROL_RESULT_ERROR, exp_rsp); // Check that the lease we inserted is stored. diff --git a/src/lib/dhcpsrv/parsers/host_reservation_parser.cc b/src/lib/dhcpsrv/parsers/host_reservation_parser.cc index ab6f5fc8b2..2be4643971 100644 --- a/src/lib/dhcpsrv/parsers/host_reservation_parser.cc +++ b/src/lib/dhcpsrv/parsers/host_reservation_parser.cc @@ -324,8 +324,8 @@ HostReservationParser6::parseInternal(const SubnetID& subnet_id, IOAddress addr(prefix); IOAddress first_address = firstAddrInPrefix(addr, prefix_len); if (first_address != addr) { - isc_throw(BadValue, "Invalid lease address boundaries: " << addr - << " is not the first address in prefix: " << first_address + isc_throw(BadValue, "Prefix address: " << addr + << " exceeds prefix/prefix-len pair: " << first_address << "/" << static_cast(prefix_len)); } }