]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3770] V4 option cmds parse and use client-classes
authorThomas Markwalder <tmark@isc.org>
Mon, 14 Jul 2025 19:33:52 +0000 (15:33 -0400)
committerThomas Markwalder <tmark@isc.org>
Tue, 15 Jul 2025 14:02:03 +0000 (14:02 +0000)
/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

src/lib/dhcpsrv/testutils/test_config_backend_dhcp4.cc

index 29d29cbb4dd8448ce4bbd397ab44568372786187..ffb172e177b701053a383ec368265a298c26dbdf 100644 (file)
@@ -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;