]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream-tcp: use flags field to store bypass info
authorEric Leblond <eric@regit.org>
Fri, 12 May 2017 17:53:49 +0000 (19:53 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 6 Jun 2017 14:26:31 +0000 (16:26 +0200)
src/stream-tcp.c
src/stream-tcp.h

index f061b9224dddc345c8b1aa7d83add2b8031f63f7..0f205756a94b2b75981d847681fe32c094cca6e8 100644 (file)
@@ -428,12 +428,14 @@ void StreamTcpInitConfig(char quiet)
     int bypass = 0;
     if ((ConfGetBool("stream.bypass", &bypass)) == 1) {
         if (bypass == 1) {
-            stream_config.bypass = 1;
-        } else {
-            stream_config.bypass = 0;
+            stream_config.flags |= STREAMTCP_INIT_FLAG_BYPASS;
         }
-    } else {
-        stream_config.bypass = 0;
+    }
+
+    if (!quiet) {
+        SCLogConfig("stream \"bypass\": %s",
+                    (stream_config.flags & STREAMTCP_INIT_FLAG_BYPASS)
+                    ? "enabled" : "disabled");
     }
 
     int drop_invalid = 0;
@@ -445,10 +447,6 @@ void StreamTcpInitConfig(char quiet)
         stream_config.flags |= STREAMTCP_INIT_FLAG_DROP_INVALID;
     }
 
-    if (!quiet) {
-        SCLogConfig("stream \"bypass\": %s", bypass ? "enabled" : "disabled");
-    }
-
     if ((ConfGetInt("stream.max-synack-queued", &value)) == 1) {
         if (value >= 0 && value <= 255) {
             stream_config.max_synack_queued = (uint8_t)value;
@@ -5919,7 +5917,7 @@ int StreamTcpSegmentForEach(const Packet *p, uint8_t flag, StreamSegmentCallback
 
 int StreamTcpBypassEnabled(void)
 {
-    return stream_config.bypass;
+    return (stream_config.flags & STREAMTCP_INIT_FLAG_BYPASS);
 }
 
 void TcpSessionSetReassemblyDepth(TcpSession *ssn, uint32_t size)
index 52cb034cbb83c1cd42dae909fe143197c612b2ce..620059d92ba4aea078ff8f4f66ef83c9aca49a47 100644 (file)
@@ -35,6 +35,7 @@
    has been enabled */
 #define STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION    BIT_U8(0)
 #define STREAMTCP_INIT_FLAG_DROP_INVALID           BIT_U8(1)
+#define STREAMTCP_INIT_FLAG_BYPASS                 BIT_U8(2)
 
 /*global flow data*/
 typedef struct TcpStreamCnf_ {
@@ -47,6 +48,7 @@ typedef struct TcpStreamCnf_ {
 
     uint16_t stream_init_flags; /**< new stream flags will be initialized to this */
 
+    /* coccinelle: TcpStreamCnf:flags:STREAMTCP_INIT_ */
     uint8_t flags;
     uint8_t max_synack_queued;
 
@@ -59,7 +61,6 @@ typedef struct TcpStreamCnf_ {
     uint16_t reassembly_toserver_chunk_size;
     uint16_t reassembly_toclient_chunk_size;
 
-    int bypass;
     bool streaming_log_api;
 
     StreamingBufferConfig sbcnf;