]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: StreamTcpReassembleRawCheckLimit cleanup
authorVictor Julien <victor@inliniac.net>
Thu, 23 Feb 2017 12:09:46 +0000 (13:09 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 20 Apr 2017 15:41:11 +0000 (17:41 +0200)
src/stream-tcp-reassemble.c

index 3586e3cfc8f6e52f16aec6396d06ac7b2ae18d11..6d38da51e14d2e6a0d0f95e47a08d656dcdf46f2 100644 (file)
@@ -696,21 +696,27 @@ static int StreamTcpReassembleRawCheckLimit(const TcpSession *ssn,
 {
     SCEnter();
 
-    if (stream->flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) {
-        SCLogDebug("reassembling now as STREAMTCP_STREAM_FLAG_NOREASSEMBLY is set, so not expecting any new packets");
-        SCReturnInt(1);
-    }
-
-    if (stream->flags & STREAMTCP_STREAM_FLAG_TRIGGER_RAW) {
-        SCLogDebug("reassembling now as STREAMTCP_STREAM_FLAG_TRIGGER_RAW is set");
-        SCReturnInt(1);
-    }
-
-    if (stream->flags & STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED) {
-        SCLogDebug("reassembling now as STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED is set, "
-                "so no new segments will be considered");
+    /* if any of these flags is set we always inspect immediately */
+#define STREAMTCP_STREAM_FLAG_FLUSH_FLAGS       \
+        (   STREAMTCP_STREAM_FLAG_NOREASSEMBLY  \
+        |   STREAMTCP_STREAM_FLAG_TRIGGER_RAW   \
+        |   STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED)
+
+    if (stream->flags & STREAMTCP_STREAM_FLAG_FLUSH_FLAGS) {
+        if (stream->flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) {
+            SCLogDebug("reassembling now as STREAMTCP_STREAM_FLAG_NOREASSEMBLY "
+                    "is set, so not expecting any new packets");
+        }
+        if (stream->flags & STREAMTCP_STREAM_FLAG_TRIGGER_RAW) {
+            SCLogDebug("reassembling now as STREAMTCP_STREAM_FLAG_TRIGGER_RAW is set");
+        }
+        if (stream->flags & STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED) {
+            SCLogDebug("reassembling now as STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED is set, "
+                    "so no new segments will be considered");
+        }
         SCReturnInt(1);
     }
+#undef STREAMTCP_STREAM_FLAG_FLUSH_FLAGS
 
     /* some states mean we reassemble no matter how much data we have */
     if (ssn->state > TCP_TIME_WAIT)