From: Francis Dupont Date: Sat, 6 Jun 2026 08:51:52 +0000 (+0200) Subject: [#4110] Addressed comments X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b1ba9d0fe9bcffca0edd98121d7f45360f58bfb9;p=thirdparty%2Fkea.git [#4110] Addressed comments --- diff --git a/changelog_unreleased/4110-reject-special-class b/changelog_unreleased/4110-reject-special-class index 6830605b07..c761fc7b4e 100644 --- a/changelog_unreleased/4110-reject-special-class +++ b/changelog_unreleased/4110-reject-special-class @@ -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. diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index e6f7812c63..adb3ee3aba 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -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); diff --git a/src/bin/dhcp4/tests/classify_unittest.cc b/src/bin/dhcp4/tests/classify_unittest.cc index 5c22127259..dd83067458 100644 --- a/src/bin/dhcp4/tests/classify_unittest.cc +++ b/src/bin/dhcp4/tests/classify_unittest.cc @@ -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. diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index 09c5f24866..18adebc7a3 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -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); diff --git a/src/bin/dhcp6/tests/classify_unittest.cc b/src/bin/dhcp6/tests/classify_unittest.cc index 37c7a627fb..72649ee5eb 100644 --- a/src/bin/dhcp6/tests/classify_unittest.cc +++ b/src/bin/dhcp6/tests/classify_unittest.cc @@ -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"); diff --git a/src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc b/src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc index 0fc337bb1d..270a90f95d 100644 --- a/src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc +++ b/src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc @@ -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"