]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#606, !335] Dropping packets in DROP class implemented. 606-drop-class
authorTomek Mrugalski <tomasz@isc.org>
Thu, 23 May 2019 14:52:09 +0000 (16:52 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Thu, 23 May 2019 14:52:09 +0000 (16:52 +0200)
src/bin/dhcp4/dhcp4_messages.mes
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp6/dhcp6_messages.mes
src/bin/dhcp6/dhcp6_srv.cc

index 40f11675662dce579674ed75f4ec17f15267cda5..7df5a33224950f9cf5005576608f9d5fff106889 100644 (file)
@@ -508,6 +508,12 @@ This debug message is issued when a packet is dropped because it did contain
 option 53 and thus has no DHCP message type. The most likely explanation is
 that it was BOOTP packet.
 
+% DHCP4_PACKET_DROP_0010 %1: Packet dropped, because it was part of built-in class DROP
+This debug message is printed when a packet was classified and the classification
+determined that it belong to a built-in class DROP. This class has a special
+meaning. It instructs Kea to drop the packet. If you feel that packet should
+not been dropped, please look at your client class DROP definition.
+
 % DHCP4_PACKET_NAK_0001 %1: failed to select a subnet for incoming packet, src %2, type %3
 This error message is output when a packet was received from a subnet
 for which the DHCPv4 server has not been configured. The most probable
index a04976c8713d8a67c42153ca4c2dc85d3adad021..957ed30bef2b762babf206a3974fcf0879307d89 100644 (file)
@@ -1006,6 +1006,12 @@ Dhcpv4Srv::processPacket(Pkt4Ptr& query, Pkt4Ptr& rsp, bool allow_packet_park) {
         callout_handle->getArgument("query4", query);
     }
 
+    // If packet belongs to built-in class DROP, let's drop it.
+    if (query->inClass("DROP")) {
+        LOG_INFO(bad_packet4_logger, DHCP4_PACKET_DROP_0010).arg(query->getLabel());
+        return;
+    }
+
     AllocEngine::ClientContext4Ptr ctx;
 
     try {
index d2c202b78795565473e4d3dbdba966aaaa2246e8..91fbd096299cf11a300ebdddc839a93000283f8a 100644 (file)
@@ -519,6 +519,12 @@ because packets of this type must be sent to multicast. The first argument
 specifies the client and transaction identification information, the
 second argument specifies packet type.
 
+% DHCP6_PACKET_DROP_CLASS %1: dropping packet, because it belong to class 'DROP'
+This info message is printed when a packet was classified and the classification
+determined that it belong to a built-in class DROP. This class has a special
+meaning. It instructs Kea to drop the packet. If you feel that packet should
+not been dropped, please look at your client class DROP definition.
+
 % DHCP6_PACKET_OPTIONS_SKIPPED An error upacking an option, caused subsequent options to be skipped: %1
 A debug message issued when an option failed to unpack correctly, making it
 impossible to unpack the remaining options in the packet.  The server will
index 37ad8b9ffa62dd2cd2b4849108499277d4a488df..face5724274bfecc3b2f2663c28cacbae6f4555b 100644 (file)
@@ -700,6 +700,12 @@ Dhcpv6Srv::processPacket(Pkt6Ptr& query, Pkt6Ptr& rsp) {
         return;
     }
 
+    // If packet belongs to built-in class DROP, let's drop it.
+    if (query->inClass("DROP")) {
+        LOG_INFO(bad_packet6_logger, DHCP6_PACKET_DROP_CLASS).arg(query->getLabel());
+        return;
+    }
+
     // Park point here.
 
     try {