]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode/tcp: reduce TCPVars by turning bools into bitfields
authorVictor Julien <vjulien@oisf.net>
Thu, 11 Apr 2024 14:44:16 +0000 (16:44 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 26 Apr 2024 18:59:45 +0000 (20:59 +0200)
To reduce Packet size and make similar fields follow the same pattern.

Ticket: #6938.

src/decode-tcp.h

index 4b315144553531d16ead5cdb50ebcc256fce2042..c0ce5c20d265dc7e7dcf56e5441ecfdfd71bcdc7 100644 (file)
@@ -162,20 +162,20 @@ typedef struct TCPHdr_
 typedef struct TCPVars_
 {
     /* commonly used and needed opts */
-    bool md5_option_present;
-    bool ao_option_present;
-    bool ts_set;
-    bool sack_ok;
-    bool mss_set;
-    bool tfo_set;
+    uint8_t md5_option_present : 1;
+    uint8_t ao_option_present : 1;
+    uint8_t ts_set : 1;
+    uint8_t sack_ok : 1;
+    uint8_t mss_set : 1;
+    uint8_t tfo_set : 1;
     uint8_t wscale_set : 1;
-    uint8_t wscale : 4;
-    uint16_t mss; /**< MSS value in host byte order */
+    uint8_t sack_set : 1;
+    uint8_t wscale;
+    uint8_t sack_cnt; /**< number of sack records */
+    uint16_t mss;     /**< MSS value in host byte order */
     uint16_t stream_pkt_flags;
     uint32_t ts_val;    /* host-order */
     uint32_t ts_ecr;    /* host-order */
-    bool sack_set;
-    uint8_t sack_cnt;     /**< number of sack records */
     uint16_t sack_offset; /**< offset relative to tcp header start */
 } TCPVars;