Skip to content

Commit 2b0c047

Browse files
committed
flow/timeout: add frame awareness
If there are still frames in the flow, the detection and logging logic needs to be able to evaluate them. To do this, make the flow timeout logic aware of the frames. If frames still exist in a direction, trigger a FFR packet to be created.
1 parent 3d0345d commit 2b0c047

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/flow-timeout.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include "detect-engine-state.h"
6060
#include "stream.h"
6161

62+
#include "app-layer-frames.h"
6263
#include "app-layer-parser.h"
6364
#include "app-layer.h"
6465

@@ -287,7 +288,6 @@ Packet *FlowPseudoPacketGet(int direction, Flow *f, const TcpSession *ssn)
287288
*/
288289
bool FlowNeedsReassembly(Flow *f)
289290
{
290-
291291
if (f == NULL || f->protoctx == NULL) {
292292
return false;
293293
}
@@ -318,6 +318,15 @@ bool FlowNeedsReassembly(Flow *f)
318318
}
319319
}
320320

321+
/* if any frame is present we assume it still needs work */
322+
FramesContainer *frames_container = AppLayerFramesGetContainer(f);
323+
if (frames_container) {
324+
if (frames_container->toserver.cnt)
325+
client = STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION;
326+
if (frames_container->toclient.cnt)
327+
server = STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION;
328+
}
329+
321330
/* nothing to do */
322331
if (client == STREAM_HAS_UNPROCESSED_SEGMENTS_NONE &&
323332
server == STREAM_HAS_UNPROCESSED_SEGMENTS_NONE) {

0 commit comments

Comments
 (0)