From: Francis Dupont Date: Thu, 23 Jul 2026 14:24:13 +0000 (+0200) Subject: [#4143] Checkpoint: addressed comments X-Git-Tag: Kea-3.3.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78e29984e7bb1400731ebb28957113447e52f15f;p=thirdparty%2Fkea.git [#4143] Checkpoint: addressed comments --- diff --git a/src/hooks/dhcp/flex_option/flex_option.cc b/src/hooks/dhcp/flex_option/flex_option.cc index f7d9c05a46..1b8ce9a320 100644 --- a/src/hooks/dhcp/flex_option/flex_option.cc +++ b/src/hooks/dhcp/flex_option/flex_option.cc @@ -314,7 +314,7 @@ FlexOptionImpl::parseOptionConfig(ConstElementPtr option) { // Consistency: if the destination is the query the source must be // the query too. if (!opt_cfg->getDestination() && !opt_cfg->getSource()) { - isc_throw(BadValue, "destination 'query' requires source 'query'"); + isc_throw(BadValue, "destination 'query' requires source 'query'"); } // Not working as expected: the destination is the query and classes @@ -598,7 +598,6 @@ FlexOptionImpl::parseSubOption(ConstElementPtr sub_option, break; } } - } void diff --git a/src/hooks/dhcp/flex_option/flex_option.dox b/src/hooks/dhcp/flex_option/flex_option.dox index d458f499bd..8dd7fafe52 100644 --- a/src/hooks/dhcp/flex_option/flex_option.dox +++ b/src/hooks/dhcp/flex_option/flex_option.dox @@ -102,11 +102,11 @@ The sole parameter is a options list of options with: - @b source - Specifies what is the source for expression evaluation. The default is the query but this can be changed to the response. Note that if an expression includes a member clause the query classes - are copied to the response to make this to work. + are copied to the response to make this work. - @b destination - Specifies what is the destination of option changes. The default is the response but this can be changed to the query. Note the change is performed before the classification so - @ client-class or a member clause in expression is very likely + @b client-class or a member clause in expression is very likely to not work as expected. A warning is emitted when this situation is detected when the configuration is parsed. diff --git a/src/hooks/dhcp/flex_option/flex_option.h b/src/hooks/dhcp/flex_option/flex_option.h index 5a95dce2d4..41642060f6 100644 --- a/src/hooks/dhcp/flex_option/flex_option.h +++ b/src/hooks/dhcp/flex_option/flex_option.h @@ -592,7 +592,6 @@ public: } } - /// @brief Log the client class for option. /// /// @param client_class The client class aka guard name. diff --git a/src/hooks/dhcp/flex_option/flex_option_messages.mes b/src/hooks/dhcp/flex_option/flex_option_messages.mes index 7402f50c0e..b91cb2b54e 100644 --- a/src/hooks/dhcp/flex_option/flex_option_messages.mes +++ b/src/hooks/dhcp/flex_option/flex_option_messages.mes @@ -20,7 +20,7 @@ class name are displayed. This warning message indicates the config specifies an expression with a member clause when the destination is the query but the callout point for patching queries is before the classification so it will very likely -not work as expected. The code of the sub-option and option, and the +not work as expected. The codes of the sub-option and option, and the expression are displayed. % FLEX_OPTION_CONFIG_USELESS_CLASS For the option code %1 the client class %2 is required before classification for a query destination diff --git a/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc b/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc index b180181f0e..a7e009ee01 100644 --- a/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc +++ b/src/hooks/dhcp/flex_option/tests/flex_option_unittests.cc @@ -2008,7 +2008,7 @@ TEST_F(FlexOptionLogTest, classWarning) { EXPECT_EQ(0U, countFile("FLEX_OPTION_CONFIG_USELESS_MEMBER")); } -// Verify that client-classes does not trigger a warning by default. +// Verify that TokenMember triggers a warning with query destination. TEST_F(FlexOptionLogTest, memberWarning) { ElementPtr options = Element::createList(); ElementPtr option = Element::createMap(); diff --git a/src/hooks/dhcp/flex_option/tests/sub_option_unittests.cc b/src/hooks/dhcp/flex_option/tests/sub_option_unittests.cc index 57de021a00..d092d00ca6 100644 --- a/src/hooks/dhcp/flex_option/tests/sub_option_unittests.cc +++ b/src/hooks/dhcp/flex_option/tests/sub_option_unittests.cc @@ -1115,7 +1115,6 @@ TEST_F(FlexSubOptionTest, subProcessNoResponse) { EXPECT_TRUE(impl_->getErrMsg().empty()) << impl_->getErrMsg(); Pkt4Ptr query(new Pkt4(DHCPDISCOVER, 12345)); - EXPECT_NO_THROW(impl_->process(Option::V4, query, Pkt4Ptr())); } @@ -3488,7 +3487,7 @@ TEST_F(FlexSubOptionLogTest, classWarning) { EXPECT_EQ(0U, countFile("FLEX_OPTION_CONFIG_SUB_USELESS_MEMBER")); } -// Verify that client-classes does not trigger a warning by default. +// Verify that TokenMember triggers a warning with query destination. TEST_F(FlexSubOptionLogTest, memberWarning) { OptionDefSpaceContainer defs; OptionDefinitionPtr def(new OptionDefinition("my-container", 222,