From: Thomas Markwalder Date: Fri, 14 Aug 2020 14:37:27 +0000 (-0400) Subject: [#1254] Addressed review comments X-Git-Tag: Kea-1.8.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f41bac10f41891d80d249291947ead1d3bbb5d6c;p=thirdparty%2Fkea.git [#1254] Addressed review comments --- diff --git a/ChangeLog b/ChangeLog index 0df15559ff..6b5eb4a1c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,8 @@ 17xx. [bug]* fdupont When a host reservation in a subnet reserves an address, the - address must in the subnet prefix. This check was previously + address must be within the subnet. This check was previously only done by the host command hook library. Note it does not - applies the prefix delegation. + apply to prefix delegation. (Gitlab #1254) 1787. [bug] razvan diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index 65eab79b77..6c50895062 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -3843,8 +3843,7 @@ DHCPv4 message such as siaddr, sname, or file. .. note:: - Beginning with Kea 1.7.11 the reserved address must be in the subnet - prefix. + Beginning with Kea 1.7.11 the reserved address must be within the subnet. The following example shows how to reserve addresses for specific hosts in a subnet: diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index 86a5b1fe85..59556fec1a 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -3356,8 +3356,8 @@ specify a hostname and DHCPv6 options for a given host. .. note:: - Beginning with Kea 1.7.11 all reserved addresses must be in the subnet - prefix. This does not apply to reserved prefixes. + Beginning with Kea 1.7.11 all reserved addresses must be within the subnet. + This does not apply to reserved prefixes. The following example shows how to reserve addresses and prefixes for specific hosts: diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 83277c0c2a..4987b35030 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -936,7 +936,7 @@ Subnet4ConfigParser::validateResv(const Subnet4Ptr& subnet, ConstHostPtr host) { const IOAddress& address = host->getIPv4Reservation(); if (!address.isV4Zero() && !subnet->inRange(address)) { isc_throw(DhcpConfigError, "specified reservation '" << address - << "' is not matching the IPv4 subnet prefix '" + << "' is not within the IPv4 subnet '" << subnet->toText() << "'"); } } @@ -1346,7 +1346,7 @@ Subnet6ConfigParser::validateResvs(const Subnet6Ptr& subnet, ConstHostPtr host) const IOAddress& address = it->second.getPrefix(); if (!subnet->inRange(address)) { isc_throw(DhcpConfigError, "specified reservation '" << address - << "' is not matching the IPv6 subnet prefix '" + << "' is not within the IPv6 subnet '" << subnet->toText() << "'"); } } diff --git a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc index 75b0ba2c28..57afe98c1d 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc @@ -1953,8 +1953,8 @@ TEST(CfgSubnets4Test, outOfRangeHost) { << "invalid JSON:" << json << "\n test is broken"; Subnet4ConfigParser parser; - std::string msg = "specified reservation '10.2.2.1' is not matching "; - msg += "the IPv4 subnet prefix '10.1.2.0/24'"; + std::string msg = "specified reservation '10.2.2.1' is not within "; + msg += "the IPv4 subnet '10.1.2.0/24'"; EXPECT_THROW_MSG(parser.parse(elems), DhcpConfigError, msg); } diff --git a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc index d32d8555d8..4bf52c5a5c 100644 --- a/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc @@ -1830,7 +1830,7 @@ TEST(CfgSubnets6Test, outOfRangeHost) { Subnet6ConfigParser parser; std::string msg = "specified reservation '2001:db8:2::1' is "; - msg += "not matching the IPv6 subnet prefix '2001:db8:1::/48'"; + msg += "not within the IPv6 subnet '2001:db8:1::/48'"; EXPECT_THROW_MSG(parser.parse(elems), DhcpConfigError, msg); }