]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: handle flow timeout stream end packets
authorVictor Julien <victor@inliniac.net>
Tue, 2 Dec 2014 09:02:27 +0000 (10:02 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 19 Dec 2014 11:18:08 +0000 (12:18 +0100)
Handle flow timeout packets in the stream engine. Previously the flow
timeout code would call reassembly code directly.

src/stream-tcp.c

index 9e3d8fb34cbc85f31c78f9ae8493a382fd230946..2d075797f8e2cee9446869b99ffa2c306bcd42c5 100644 (file)
@@ -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)