]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: set drop reason for rule based drops 7553/head
authorVictor Julien <vjulien@oisf.net>
Thu, 16 Jun 2022 15:27:35 +0000 (17:27 +0200)
committerVictor Julien <vjulien@oisf.net>
Thu, 16 Jun 2022 15:29:11 +0000 (17:29 +0200)
Call `PacketDrop` with drop reason for drops, keep old logic
in place for the rest.

src/detect-engine-alert.c

index 1e5c7127300030be5d215147daa7318978db0c4f..e51d70c9c10081476138e4b4f74c75eb4a053836 100644 (file)
@@ -178,9 +178,10 @@ static void PacketApplySignatureActions(Packet *p, const Signature *s, const uin
 {
     SCLogDebug("packet %" PRIu64 " sid %u action %02x alert_flags %02x", p->pcap_cnt, s->id,
             s->action, alert_flags);
-    PacketUpdateAction(p, s->action);
 
     if (s->action & ACTION_DROP) {
+        PacketDrop(p, PKT_DROP_REASON_RULES);
+
         if (p->alerts.drop.action == 0) {
             p->alerts.drop.num = s->num;
             p->alerts.drop.action = s->action;
@@ -189,8 +190,11 @@ static void PacketApplySignatureActions(Packet *p, const Signature *s, const uin
         if ((p->flow != NULL) && (alert_flags & PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW)) {
             RuleActionToFlow(s->action, p->flow);
         }
-    } else if (s->action & ACTION_PASS) {
-        if ((p->flow != NULL) && (alert_flags & PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW)) {
+    } else {
+        PacketUpdateAction(p, s->action);
+
+        if ((s->action & ACTION_PASS) && (p->flow != NULL) &&
+                (alert_flags & PACKET_ALERT_FLAG_APPLY_ACTION_TO_FLOW)) {
             RuleActionToFlow(s->action, p->flow);
         }
     }