]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: move app_mpms array to init data
authorVictor Julien <victor@inliniac.net>
Thu, 15 Oct 2015 12:52:01 +0000 (14:52 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 5 Apr 2016 07:30:12 +0000 (09:30 +0200)
src/detect-engine-mpm.c
src/detect.h

index 776622ab6e930ec4753c3922e17e149a25a041a0..e861e0ba5d88933c4304795dbcaa6f376644f7df 100644 (file)
@@ -1620,34 +1620,34 @@ MpmStore *MpmStorePrepareBuffer2(DetectEngineCtx *de_ctx, SigGroupHead *sgh, App
 void MpmStoreFixup(SigGroupHead *sgh)
 {
     int i = 0;
-    sgh->mpm_uri_ctx_ts = sgh->app_mpms[i++];
-    sgh->mpm_hrud_ctx_ts = sgh->app_mpms[i++];
+    sgh->mpm_uri_ctx_ts = sgh->init->app_mpms[i++];
+    sgh->mpm_hrud_ctx_ts = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hhd_ctx_ts = sgh->app_mpms[i++];
-    sgh->mpm_hhd_ctx_tc = sgh->app_mpms[i++];
+    sgh->mpm_hhd_ctx_ts = sgh->init->app_mpms[i++];
+    sgh->mpm_hhd_ctx_tc = sgh->init->app_mpms[i++];
 
-    sgh->mpm_huad_ctx_ts = sgh->app_mpms[i++];
+    sgh->mpm_huad_ctx_ts = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hrhd_ctx_ts = sgh->app_mpms[i++];
-    sgh->mpm_hrhd_ctx_tc = sgh->app_mpms[i++];
+    sgh->mpm_hrhd_ctx_ts = sgh->init->app_mpms[i++];
+    sgh->mpm_hrhd_ctx_tc = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hmd_ctx_ts = sgh->app_mpms[i++];
+    sgh->mpm_hmd_ctx_ts = sgh->init->app_mpms[i++];
 
-    sgh->mpm_smtp_filedata_ctx_ts = sgh->app_mpms[i++];
-    sgh->mpm_hsbd_ctx_tc = sgh->app_mpms[i++];
+    sgh->mpm_smtp_filedata_ctx_ts = sgh->init->app_mpms[i++];
+    sgh->mpm_hsbd_ctx_tc = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hsmd_ctx_tc = sgh->app_mpms[i++];
-    sgh->mpm_hscd_ctx_tc = sgh->app_mpms[i++];
+    sgh->mpm_hsmd_ctx_tc = sgh->init->app_mpms[i++];
+    sgh->mpm_hscd_ctx_tc = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hcbd_ctx_ts = sgh->app_mpms[i++];
+    sgh->mpm_hcbd_ctx_ts = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hhhd_ctx_ts = sgh->app_mpms[i++];
-    sgh->mpm_hrhhd_ctx_ts = sgh->app_mpms[i++];
+    sgh->mpm_hhhd_ctx_ts = sgh->init->app_mpms[i++];
+    sgh->mpm_hrhhd_ctx_ts = sgh->init->app_mpms[i++];
 
-    sgh->mpm_hcd_ctx_ts = sgh->app_mpms[i++];
-    sgh->mpm_hcd_ctx_tc = sgh->app_mpms[i++];
+    sgh->mpm_hcd_ctx_ts = sgh->init->app_mpms[i++];
+    sgh->mpm_hcd_ctx_tc = sgh->init->app_mpms[i++];
 
-    sgh->mpm_dnsquery_ctx_ts = sgh->app_mpms[i++];
+    sgh->mpm_dnsquery_ctx_ts = sgh->init->app_mpms[i++];
 
     BUG_ON(APP_MPMS_MAX != 18 || i != 18);
 }
@@ -1724,8 +1724,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
     while (a->name != NULL) {
         mpm_store = MpmStorePrepareBuffer2(de_ctx, sh, a);
         if (mpm_store != NULL) {
-            sh->app_mpms[a->id] = mpm_store->mpm_ctx;
-            if (sh->app_mpms[a->id] != NULL)
+            sh->init->app_mpms[a->id] = mpm_store->mpm_ctx;
+            if (sh->init->app_mpms[a->id] != NULL)
                 sh->flags |= a->flags;
         }
         a++;
index f728e9bd8b664e537b6feadf8191d1c1e6d0971b..cad6f7c6bb61de83a04cd282da47616482619e6e 100644 (file)
@@ -962,6 +962,8 @@ typedef struct SigGroupHeadInitData_ {
     uint32_t direction;     /**< set to SIG_FLAG_TOSERVER, SIG_FLAG_TOCLIENT or both */
     int whitelist;          /**< try to make this group a unique one */
 
+    MpmCtx *app_mpms[APP_MPMS_MAX];
+
     /* port ptr */
     struct DetectPort_ *port;
 } SigGroupHeadInitData;
@@ -1020,8 +1022,6 @@ typedef struct SigGroupHead_ {
     /** Array with sig ptrs... size is sig_cnt * sizeof(Signature *) */
     Signature **match_array;
 
-    MpmCtx *app_mpms[APP_MPMS_MAX];
-
     /* ptr to our init data we only use at... init :) */
     SigGroupHeadInitData *init;
 } SigGroupHead;