From c40df43609becc467e86d756098829b3174c80c7 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 23 Apr 2022 13:59:34 +0200 Subject: [PATCH] stream: improve flow end payload logging Use all available data, including un-ACK'd, when in flow timeout mode. Bug: #5276. --- src/stream-tcp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/stream-tcp.c b/src/stream-tcp.c index eea743d3c9..2bbcafccf2 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -6341,9 +6341,16 @@ int StreamTcpSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback /* for IDS, return ack'd segments. For IPS all. */ TcpSegment *seg; RB_FOREACH(seg, TCPSEG, &stream->seg_tree) { - if (!((stream_config.flags & STREAMTCP_INIT_FLAG_INLINE) - || SEQ_LT(seg->seq, stream->last_ack))) - break; + if (!(stream_config.flags & STREAMTCP_INIT_FLAG_INLINE)) { + if (PKT_IS_PSEUDOPKT(p)) { + /* use un-ACK'd data as well */ + } else { + /* in IDS mode, use ACK'd data */ + if (SEQ_GEQ(seg->seq, stream->last_ack)) { + break; + } + } + } const uint8_t *seg_data; uint32_t seg_datalen;