]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: update packet action on protocol change
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 3 Oct 2023 10:39:13 +0000 (12:39 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 18 Mar 2024 09:03:38 +0000 (10:03 +0100)
Ticket: #6305

When running FlowWorkerStreamTCPUpdate, one of the dequeued packet
may set the flow action to drop, without updating the not-pseudo
packet action, as is done usually with a previous call to
FlowHandlePacketUpdate

src/flow-worker.c

index 77fe2b87fe125ff4a787f1ed7217c4ed21a1b580..a34ec725c95e7cd4995ac44cbc5e98138ef6b109 100644 (file)
@@ -410,6 +410,10 @@ static inline void FlowWorkerStreamTCPUpdate(ThreadVars *tv, FlowWorkerThreadDat
             TmqhOutputPacketpool(tv, x);
         }
     }
+    if (FlowChangeProto(p->flow) && p->flow->flags & FLOW_ACTION_DROP) {
+        // in case f->flags & FLOW_ACTION_DROP was set by one of the dequeued packets
+        PacketDrop(p, ACTION_DROP, PKT_DROP_REASON_FLOW_DROP);
+    }
 }
 
 static void FlowWorkerFlowTimeout(ThreadVars *tv, Packet *p, FlowWorkerThreadData *fw,