]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4110] Addressed comments
authorFrancis Dupont <fdupont@isc.org>
Sat, 6 Jun 2026 08:51:52 +0000 (10:51 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 8 Jun 2026 15:24:17 +0000 (17:24 +0200)
changelog_unreleased/4110-reject-special-class
src/bin/dhcp4/dhcp4_srv.h
src/bin/dhcp4/tests/classify_unittest.cc
src/bin/dhcp6/dhcp6_srv.h
src/bin/dhcp6/tests/classify_unittest.cc
src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc

index 6830605b07914c74c1e4963a7acb0f1f25501a6c..c761fc7b4efa2826bef988042241ee12b6489818 100644 (file)
@@ -1,7 +1,7 @@
 [func]         fdupont
        Added a new special client class "REJECT" which makes
        incoming requests in this class to skip the resource
-       allocation part in processing e.g. return DHCPNAK on
+       allocation part in processing and return DHCPNAK on
        DHCPREQUEST by the DHCPv4 server, or put status code
        NoAddrsAvail in all ia-na options by the DHCPv6 server.
        Proposed by Philip Prindeville.
index e6f7812c637b6e946648f62952f5382c6f03d12b..adb3ee3aba6934f6f7903baeee0ccf3ca50103c8 100644 (file)
@@ -702,7 +702,9 @@ protected:
 
     /// @brief Return a NAK.
     ///
-    /// Called when the query is in the REJECT class.
+    /// Called when the query is in the REJECT class: adds a DHCPNAK response
+    /// to the exchange.
+    ///
     /// @param ex The exchange.
     void reject(Dhcpv4Exchange& ex);
 
index 5c221272599491a71eb2029ad38e7ac7f434a040..dd830674586eef1c1664e8b6c20d7d8d84c707a6 100644 (file)
@@ -2761,8 +2761,8 @@ TEST_F(ClassifyTest, templateDependOnKnown) {
     EXPECT_EQ(response->getYiaddr(), IOAddress("192.0.2.1"));
 }
 
-// This test checks the handling for the REJECT special class in a Solicit.
-TEST_F(ClassifyTest, rejectClassSolicit) {
+// This test checks the handling for the REJECT special class in a Discover.
+TEST_F(ClassifyTest, rejectClassDiscover) {
     Dhcp4Client client(srv_, Dhcp4Client::SELECTING);
 
     // Configure DHCP server.
index 09c5f248663432bbc2ce89bff87d12679a4b5b17..18adebc7a3adf8778bfc78af91492aaf0b11d179 100644 (file)
@@ -641,7 +641,9 @@ protected:
 
     /// @brief Reject query.
     ///
-    /// Called when the query is in the REJECT class.
+    /// Called when the query is in the REJECT class: adds a NoAddrsAvail
+    /// or NoPrefixAvail status code to the response.
+    ///
     /// @param query client's message
     /// @param answer server's message
     void reject(const Pkt6Ptr& query, Pkt6Ptr& answer);
index 37c7a627fbf1a9b6c27e5f79b77b9149dee22acd..72649ee5eb05ac70f0e03642f481ff451df08705 100644 (file)
@@ -1501,7 +1501,7 @@ TEST_F(ClassifyTest, clientClassifySubnet) {
 
     Pkt6Ptr sol = createSolicit("2001:db8:1::3");
 
-    // This discover does not belong to foo class, so it will not
+    // This Solicit does not belong to foo class, so it will not
     // be serviced
     bool drop = false;
     EXPECT_FALSE(srv_->selectSubnet(sol, drop));
@@ -1568,7 +1568,7 @@ TEST_F(ClassifyTest, clientClassifyPool) {
     Pkt6Ptr query2 = createSolicit("2001:db8:1::3");
     Pkt6Ptr query3 = createSolicit("2001:db8:1::3");
 
-    // This discover does not belong to foo class, so it will not
+    // This Solicit does not belong to foo class, so it will not
     // be serviced
     srv_->classifyPacket(query1);
     AllocEngine::ClientContext6 ctx1;
@@ -3726,8 +3726,8 @@ TEST_F(ClassifyTest, templateDependOnKnown) {
     EXPECT_EQ(iaddr->getAddress(), IOAddress("2001:db8:1::"));
 }
 
-// This test checks the handling for the REJECT special class in a Discover.
-TEST_F(ClassifyTest, rejectClassDiscover) {
+// This test checks the handling for the REJECT special class in a Solicit.
+TEST_F(ClassifyTest, rejectClassSolicit) {
     Dhcp6Client client(srv_);
     client.setDUID("01:02:03:04");
     client.setInterface("eth1");
index 0fc337bb1d24c3b18e65e33233230dfa58a6ffd5..270a90f95d006c02a009310c89307d5a4f691ec3 100644 (file)
@@ -1946,7 +1946,7 @@ TEST_F(ClientClassDefListParserTest, builtinCheckError) {
     EXPECT_THROW(parseClientClassDefList(cfg_text, AF_INET6), DhcpConfigError);
 }
 
-// Verifies that the special DROP class can't be required.
+// Verifies that the special DROP class can't be marked as only-in-additional.
 TEST_F(ClientClassDefListParserTest, dropCheckError) {
     std::string cfg_text =
         "[ \n"
@@ -1980,7 +1980,7 @@ TEST_F(ClientClassDefListParserTest, dropCheckError) {
     EXPECT_NO_THROW(parseClientClassDefList(cfg_text, AF_INET6));
 }
 
-// Verifies that the special REJECT class can't be required.
+// Verifies that the special REJECT class can't be marked as only-in-additional.
 TEST_F(ClientClassDefListParserTest, rejectCheckError) {
     std::string cfg_text =
         "[ \n"
@@ -2002,7 +2002,7 @@ TEST_F(ClientClassDefListParserTest, rejectCheckError) {
 
     EXPECT_THROW(parseClientClassDefList(cfg_text, AF_INET), DhcpConfigError);
 
-    // This constraint was relaxed in #1815.
+    // Same as for the DROP class for allowed dependencies.
     cfg_text =
         "[ \n"
         "   { \n"