]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
exceptions: ignore policy if stream.midstream=true
authorJuliana Fajardini <jufajardini@oisf.net>
Thu, 19 Jan 2023 14:18:16 +0000 (11:18 -0300)
committerVictor Julien <vjulien@oisf.net>
Wed, 25 Jan 2023 19:26:38 +0000 (20:26 +0100)
Set the engine to ignore the stream.midstream-policy if stream.midstream
is enabled.

If we had both stream.midstream AND stream.midstream_policy enabled,
this could lead to midstream flows being dropped (or bypassed, or...)
instead of being accepted by the engine, as it was probably meant when
the user enabled midstream flows.

Bug #5765

(cherry picked from commit 8e9905e0d833858a5053285c8ffe6ed4ed30fc12)

src/stream-tcp.c

index 4f4024585ab7f0804d320113a3789c59ee7df099..6732c18a2c92e2ed835adf5722fa108405cd5f0d 100644 (file)
@@ -474,9 +474,15 @@ void StreamTcpInitConfig(char quiet)
     stream_config.ssn_memcap_policy = ExceptionPolicyParse("stream.memcap-policy", true);
     stream_config.reassembly_memcap_policy =
             ExceptionPolicyParse("stream.reassembly.memcap-policy", true);
-    stream_config.midstream_policy = ExceptionPolicyParse("stream.midstream-policy", true);
     SCLogConfig("memcap-policy: %u/%u", stream_config.ssn_memcap_policy,
             stream_config.reassembly_memcap_policy);
+    stream_config.midstream_policy = ExceptionPolicyParse("stream.midstream-policy", true);
+    if (stream_config.midstream && stream_config.midstream_policy != EXCEPTION_POLICY_IGNORE) {
+        SCLogWarning(SC_WARN_COMPATIBILITY,
+                "stream.midstream_policy setting conflicting with stream.midstream enabled. "
+                "Ignoring stream.midstream_policy.");
+        stream_config.midstream_policy = EXCEPTION_POLICY_IGNORE;
+    }
 
     if (!quiet) {
         SCLogConfig("stream.\"inline\": %s",