]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: optimize Signature layout
authorVictor Julien <victor@inliniac.net>
Thu, 16 Jul 2015 09:22:04 +0000 (11:22 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 22 Jul 2015 10:13:43 +0000 (12:13 +0200)
src/detect.h

index d8d884751a93eb44daa1a496ca8125918a4eaaac..223b6d31a47fd52a72d5ea4c76ffc7c37ee0b04e 100644 (file)
@@ -384,40 +384,44 @@ typedef struct Signature_ {
     uint8_t action;
     uint8_t file_flags;
 
+    /** addresses, ports and proto this sig matches on */
+    DetectProto proto;
+
+    /** classification id **/
+    uint8_t class;
+
     /** ipv4 match arrays */
     uint16_t addr_dst_match4_cnt;
     uint16_t addr_src_match4_cnt;
+    uint16_t addr_dst_match6_cnt;
+    uint16_t addr_src_match6_cnt;
     DetectMatchAddressIPv4 *addr_dst_match4;
     DetectMatchAddressIPv4 *addr_src_match4;
     /** ipv6 match arrays */
     DetectMatchAddressIPv6 *addr_dst_match6;
     DetectMatchAddressIPv6 *addr_src_match6;
-    uint16_t addr_dst_match6_cnt;
-    uint16_t addr_src_match6_cnt;
 
     uint32_t id;  /**< sid, set by the 'sid' rule keyword */
+    uint32_t gid; /**< generator id */
+    uint32_t rev;
+    int prio;
+
     /** port settings for this signature */
     DetectPort *sp, *dp;
 
-    /** addresses, ports and proto this sig matches on */
-    DetectProto proto;
-
-    /** classification id **/
-    uint8_t class;
-
 #ifdef PROFILING
     uint16_t profiling_id;
 #endif
+    /** number of sigmatches in the match and pmatch list */
+    uint16_t sm_cnt;
 
-    uint32_t gid; /**< generator id */
+    /* used to hold flags that are predominantly used during init */
+    uint32_t init_flags;
+    /* coccinelle: Signature:init_flags:SIG_FLAG_INIT_ */
 
     /** netblocks and hosts specified at the sid, in CIDR format */
     IPOnlyCIDRItem *CidrSrc, *CidrDst;
 
-    uint32_t rev;
-
-    int prio;
-
     /* Hold copies of the sm lists for Match() */
     SigMatchData *sm_arrays[DETECT_SM_LIST_MAX];
 
@@ -438,12 +442,6 @@ typedef struct Signature_ {
     /** address settings for this signature */
     DetectAddressHead src, dst;
 
-    /* used to hold flags that are predominantly used during init */
-    uint32_t init_flags;
-    /* coccinelle: Signature:init_flags:SIG_FLAG_INIT_ */
-
-    /** number of sigmatches in the match and pmatch list */
-    uint16_t sm_cnt;
     /* used at init to determine max dsize */
     SigMatch *dsize_sm;
     /* the fast pattern added from this signature */
@@ -452,12 +450,12 @@ typedef struct Signature_ {
     uint16_t mpm_content_maxlen;
     uint16_t mpm_uricontent_maxlen;
 
+    int list;
+
     /* Be careful, this pointer is only valid while parsing the sig,
      * to warn the user about any possible problem */
     char *sig_str;
 
-    int list;
-
     /** ptr to the next sig in the list */
     struct Signature_ *next;
 } Signature;