From de4bda14e6f2b90fd1aa533327ae907205e25dd1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 2 Dec 2014 10:02:27 +0100 Subject: [PATCH] stream: handle flow timeout stream end packets Handle flow timeout packets in the stream engine. Previously the flow timeout code would call reassembly code directly. --- src/stream-tcp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 9e3d8fb34c..2d075797f8 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -4440,6 +4440,23 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt, if (ssn != NULL) SCLogDebug("ssn->alproto %"PRIu16"", p->flow->alproto); } else { + /* special case for PKT_PSEUDO_STREAM_END packets: + * bypass the state handling and various packet checks, + * we care about reassembly here. */ + if (p->flags & PKT_PSEUDO_STREAM_END) { + if (PKT_IS_TOCLIENT(p)) { + ssn->client.last_ack = TCP_GET_ACK(p); + StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, + &ssn->server, p, pq); + } else { + ssn->server.last_ack = TCP_GET_ACK(p); + StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, + &ssn->client, p, pq); + } + /* straight to 'skip' as we already handled reassembly */ + goto skip; + } + /* check if the packet is in right direction, when we missed the SYN packet and picked up midstream session. */ if (ssn->flags & STREAMTCP_FLAG_MIDSTREAM_SYNACK)