From: Victor Julien Date: Thu, 30 Aug 2018 15:25:54 +0000 (+0200) Subject: stream/segments: change packing to reduce size X-Git-Tag: suricata-4.1.0-rc2~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=269313a53ee1fd7b3f85fcffaadd0c539cf401ac;p=thirdparty%2Fsuricata.git stream/segments: change packing to reduce size Change the way fields are ordered to reduce TcpSegment structure with 8 bytes. --- diff --git a/src/app-layer-htp.h b/src/app-layer-htp.h index be30f07039..e0fcce12b7 100644 --- a/src/app-layer-htp.h +++ b/src/app-layer-htp.h @@ -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; diff --git a/src/stream-tcp-private.h b/src/stream-tcp-private.h index 6a6c770291..25d010b690 100644 --- a/src/stream-tcp-private.h +++ b/src/stream-tcp-private.h @@ -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 * diff --git a/src/util-streaming-buffer.h b/src/util-streaming-buffer.h index f346e432ab..3b94a82291 100644 --- a/src/util-streaming-buffer.h +++ b/src/util-streaming-buffer.h @@ -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);