[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.
/// @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);
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.
/// @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);
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));
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;
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");
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"
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"
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"