Commit 330065ad authored by Francis Dupont's avatar Francis Dupont
Browse files

[606-drop-packets-in-drop-class] Addressed minor comments (checkpoint before rebasing)

parent 217be453
......@@ -90,7 +90,7 @@
resort) definition.
</para></listitem>
<listitem><para>
When the incoming packet belongs the special DROP class it is
When the incoming packet belongs the special class, "DROP", it is
dropped and an informational message is logged with the packet
information.
</para></listitem>
......
......@@ -2534,8 +2534,8 @@ It is merely echoed by the server.
The first step is to assess an incoming packet and assign it to
zero or more classes.
The second step is to choose a subnet, possibly based on the
class information. When the incoming packet is in the "DROP"
special class it is dropped and an information message logged.
class information. When the incoming packet is in the special
class, "DROP", it is dropped and an information message logged.
The next step is to evaluate class expressions depending on the
built-in "KNOWN"/"UNKNOWN" classes after host reservation lookup,
using them for pool selection and assigning classes from host reservations.
......
......@@ -2429,8 +2429,8 @@ should include options from the new option space:
The first step is to assess an incoming packet and assign it to
zero or more classes.
Next, a subnet is chosen, possibly based on the
class information. When the incoming packet is inthe "DROP"
special class it is dropped and an information message logged.
class information. When the incoming packet is in the special
class, "DROP", it is dropped and an information message logged.
After that, class expressions are evaluated depending on the
built-in "KNOWN"/"UNKNOWN" classes after host reservation lookup,
using them for pool/pd-pool selection and assigning classes from host
......
......@@ -1010,7 +1010,8 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp, bool allow_packet_park) {
if (query->inClass("DROP")) {
LOG_INFO(packet4_logger, DHCP4_PACKET_DROP_DROP_CLASS)
.arg(query->toText());
// increase pkt4-receive-drop stats?
isc::stats::StatsMgr::instance().addValue("pkt4-receive-drop",
static_cast<int64_t>(1));
return;
}
......
......@@ -10,6 +10,7 @@
#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcp4/tests/dhcp4_client.h>
#include <dhcp/option_int.h>
#include <stats/stats_mgr.h>
#include <algorithm>
#include <vector>
......@@ -1154,6 +1155,14 @@ TEST_F(ClassifyTest, dropClass) {
// Option, dropped.
EXPECT_FALSE(client2.getContext().response_);
// There should also be pkt4-receive-drop stat bumped up.
stats::StatsMgr& mgr = stats::StatsMgr::instance();
stats::ObservationPtr drop_stat = mgr.getObservation("pkt4-receive-drop");
// This statistic must be present and must be set to 1.
ASSERT_TRUE(drop_stat);
EXPECT_EQ(1, drop_stat->getInteger().first);
}
} // end of anonymous namespace
......@@ -687,7 +687,8 @@ Dhcpv6Srv::processPacket(Pkt6Ptr& query, Pkt6Ptr& rsp) {
if (query->inClass("DROP")) {
LOG_INFO(packet6_logger, DHCP6_PACKET_DROP_DROP_CLASS)
.arg(query->toText());
// increase pkt6-receive-drop stats?
StatsMgr::instance().addValue("pkt6-receive-drop",
static_cast<int64_t>(1));
return;
}
......
......@@ -20,6 +20,7 @@
#include <dhcp6/tests/dhcp6_test_utils.h>
#include <dhcp6/tests/dhcp6_client.h>
#include <asiolink/io_address.h>
#include <stats/stats_mgr.h>
#include <boost/pointer_cast.hpp>
#include <string>
......@@ -2107,6 +2108,14 @@ TEST_F(ClassifyTest, dropClass) {
// Option, dropped.
EXPECT_FALSE(client2.getContext().response_);
// There should also be pkt6-receive-drop stat bumped up.
stats::StatsMgr& mgr = stats::StatsMgr::instance();
stats::ObservationPtr drop_stat = mgr.getObservation("pkt6-receive-drop");
// This statistic must be present and must be set to 1.
ASSERT_TRUE(drop_stat);
EXPECT_EQ(1, drop_stat->getInteger().first);
}
} // end of anonymous namespace
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment