From: Thomas Markwalder Date: Mon, 14 Jul 2025 19:33:52 +0000 (-0400) Subject: [#3770] V4 option cmds parse and use client-classes X-Git-Tag: Kea-3.1.0~31 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=dab54162e33dca7306ca46dee8b90181758f9ede;p=thirdparty%2Fkea.git [#3770] V4 option cmds parse and use client-classes /src/hooks/dhcp/cb_cmds/cb_cmds_dhcp4.cc ConfigCmdsDhcp4Impl::delSharedNetworkOption4() ConfigCmdsDhcp4Impl::delSubnetOption4() ConfigCmdsDhcp4Impl::delPoolOption4() - added client-classes parameter /src/hooks/dhcp/cb_cmds/cb_cmds_dhcp6.cc ConfigCmdsDhcp6Impl::delGlobalOption6() ConfigCmdsDhcp6Impl::getGlobalOption6() ConfigCmdsDhcp4Impl::delSharedNetworkOption6() ConfigCmdsDhcp4Impl::delSubnetOption6() ConfigCmdsDhcp4Impl::delPoolOption6() - added client-classes parameter /src/hooks/dhcp/cb_cmds/cb_cmds_impl.h makeOptionInfoElement(const OptionDefinition& def) makeOptionInfoElement(const OptionDescriptor& desc) - new convenience functions Use makeOptionInfoElement() for set() respsonses Update parseInputListElement() for shared-networks, subnets, pools /src/hooks/dhcp/cb_cmds/tests/cb_cmds_test.h void checkOptionInfo() - new test func /src/hooks/dhcp/cb_cmds/tests/option4_cmds_unittest.cc udpated test /src/hooks/dhcp/cb_cmds/tests/option4_network_cmds_unittest.cc TEST_F(OptionNetwork4CmdsTest, networkOption4WithClientClasses) /src/hooks/dhcp/cb_cmds/tests/option4_pool_cmds_unittest.cc TEST_F(OptionPool4CmdsTest, poolOption4WithClientClasses) /src/hooks/dhcp/cb_cmds/tests/option4_subnet_cmds_unittest.cc TEST_F(OptionSubnet4CmdsTest, subnetOption4WithClientClasses) /src/hooks/dhcp/cb_cmds/tests/option6_cmds_unittest.cc Use makeOptionInfoElement() for set() respsonses --- diff --git a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc index 29d29cbb4d..ffb172e177 100644 --- a/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc +++ b/src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc @@ -747,6 +747,7 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se for (auto option_it = option_it_pair.first; option_it != option_it_pair.second; ++option_it) { +/// @todo TKM - shouldn't this also compare client_classes_? if ((option_it->space_name_ == option->space_name_) && (option_it->hasServerTag(ServerTag(tag)))) { index.replace(option_it, *option); @@ -794,7 +795,8 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se << " not present in a selected server"); } - shared_network->getCfgOption()->del(option->space_name_, option->option_->getType()); + shared_network->getCfgOption()->del(option->space_name_, option->option_->getType(), + option->client_classes_); shared_network->getCfgOption()->add(*option, option->space_name_); } @@ -835,7 +837,8 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se << " not present in a selected server"); } - subnet->getCfgOption()->del(option->space_name_, option->option_->getType()); + subnet->getCfgOption()->del(option->space_name_, option->option_->getType(), + option->client_classes_); subnet->getCfgOption()->add(*option, option->space_name_); } @@ -875,7 +878,8 @@ TestConfigBackendDHCPv4::createUpdateOption4(const db::ServerSelector& server_se } // Update the option. - pool->getCfgOption()->del(option->space_name_, option->option_->getType()); + pool->getCfgOption()->del(option->space_name_, option->option_->getType(), + option->client_classes_); pool->getCfgOption()->add(*option, option->space_name_); return;