]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream/segments: change packing to reduce size
authorVictor Julien <victor@inliniac.net>
Thu, 30 Aug 2018 15:25:54 +0000 (17:25 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 17 Sep 2018 06:27:24 +0000 (08:27 +0200)
Change the way fields are ordered to reduce TcpSegment structure
with 8 bytes.

src/app-layer-htp.h
src/stream-tcp-private.h
src/util-streaming-buffer.h

index be30f070393cca7d4f9d30de157544117163d3b8..e0fcce12b7b58ff3ee472567cb42fdc546f74d4e 100644 (file)
@@ -151,8 +151,8 @@ typedef struct HTPCfgRec_ {
 /** Struct used to hold chunks of a body on a request */
 struct HtpBodyChunk_ {
     struct HtpBodyChunk_ *next; /**< Pointer to the next chunk */
-    StreamingBufferSegment sbseg;
     int logged;
+    StreamingBufferSegment sbseg;
 } __attribute__((__packed__));
 typedef struct HtpBodyChunk_ HtpBodyChunk;
 
index 6a6c7702918ff8edc5d0d1f88524c817848560a6..25d010b690613cfb9b598d1e314b2501340104de 100644 (file)
@@ -62,9 +62,9 @@ typedef struct TcpSegment {
     PoolThreadReserved res;
     uint16_t payload_len;       /**< actual size of the payload */
     uint32_t seq;
+    RB_ENTRY(TcpSegment) __attribute__((__packed__)) rb;
     StreamingBufferSegment sbseg;
-    RB_ENTRY(TcpSegment) rb;
-} TcpSegment;
+} __attribute__((__packed__)) TcpSegment;
 
 /** \brief compare function for the Segment tree
  *
index f346e432ab12b20f3575fb2c168b227e9834aa19..3b94a82291504ed8edd5aa6ad4a81ed7a85f0fcf 100644 (file)
@@ -114,8 +114,8 @@ typedef struct StreamingBuffer_ {
 #endif
 
 typedef struct StreamingBufferSegment_ {
-    uint64_t stream_offset;
     uint32_t segment_len;
+    uint64_t stream_offset;
 } __attribute__((__packed__)) StreamingBufferSegment;
 
 StreamingBuffer *StreamingBufferInit(const StreamingBufferConfig *cfg);