From: Victor Julien Date: Wed, 10 Dec 2014 16:31:57 +0000 (+0100) Subject: stream: don't send EOF to AppLayer too soon X-Git-Tag: suricata-2.1beta3~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1247%2Fhead;p=thirdparty%2Fsuricata.git stream: don't send EOF to AppLayer too soon Sending EOF too soon results in the AppLayer cleaning up prematurely. --- diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index 2d1170a14c..5333c3e6ca 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -1919,7 +1919,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) { \ @@ -1937,7 +1940,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) { \