]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: apply flow to packet on flow lookup
authorVictor Julien <vjulien@oisf.net>
Wed, 31 May 2023 13:45:40 +0000 (15:45 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 2 Jun 2023 09:21:47 +0000 (11:21 +0200)
Issue drop to packet as early as possible.

src/flow.c

index 8bb8d4a9e5452c078cee4d7d6fc86fae42f72efe..75e77d8ed93b6acdb200e8b3a20db9f97c801ebb 100644 (file)
@@ -25,6 +25,9 @@
 
 #include "suricata-common.h"
 #include "suricata.h"
+
+#include "action-globals.h"
+#include "packet.h"
 #include "decode.h"
 #include "conf.h"
 #include "threadvars.h"
@@ -505,6 +508,9 @@ void FlowHandlePacketUpdate(Flow *f, Packet *p, ThreadVars *tv, DecodeThreadVars
         FlowUpdateState(f, FLOW_STATE_ESTABLISHED);
     }
 
+    if (f->flags & FLOW_ACTION_DROP) {
+        PacketDrop(p, ACTION_DROP, PKT_DROP_REASON_FLOW_DROP);
+    }
     /*set the detection bypass flags*/
     if (f->flags & FLOW_NOPACKET_INSPECTION) {
         SCLogDebug("setting FLOW_NOPACKET_INSPECTION flag on flow %p", f);