]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: don't send EOF to AppLayer too soon 1248/head
authorVictor Julien <victor@inliniac.net>
Wed, 10 Dec 2014 16:31:57 +0000 (17:31 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 10 Dec 2014 17:42:30 +0000 (18:42 +0100)
Sending EOF too soon results in the AppLayer cleaning up prematurely.

src/stream-tcp-reassemble.c

index 7dc7b7696a24c6da2991f8fc7ce20a7cd8ddbf01..3eb7547611d5f081dba4d5abd7acaf2f8317413c 100644 (file)
@@ -1911,7 +1911,10 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
     if (!(stream->flags & STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED)) {\
         flag |= STREAM_START; \
     } \
-    if (stream->flags & STREAMTCP_STREAM_FLAG_CLOSE_INITIATED) {    \
+    if (ssn->state == TCP_CLOSED) { \
+        flag |= STREAM_EOF; \
+    } \
+    if (p->flags & PKT_PSEUDO_STREAM_END) { \
         flag |= STREAM_EOF; \
     } \
     if ((p)->flowflags & FLOW_PKT_TOSERVER) { \
@@ -1929,7 +1932,10 @@ int StreamTcpReassembleHandleSegmentHandleData(ThreadVars *tv, TcpReassemblyThre
     if (!(stream->flags & STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED)) {\
         flag |= STREAM_START; \
     } \
-    if (stream->flags & STREAMTCP_STREAM_FLAG_CLOSE_INITIATED) {    \
+    if (ssn->state == TCP_CLOSED) { \
+        flag |= STREAM_EOF; \
+    } \
+    if (p->flags & PKT_PSEUDO_STREAM_END) { \
         flag |= STREAM_EOF; \
     } \
     if ((p)->flowflags & FLOW_PKT_TOSERVER) { \