From: Victor Julien Date: Thu, 15 Oct 2015 12:52:01 +0000 (+0200) Subject: detect: move app_mpms array to init data X-Git-Tag: suricata-3.1RC1~332 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c804102a9a2cf3b53bc45fb912cfa462dc52f5b3;p=thirdparty%2Fsuricata.git detect: move app_mpms array to init data --- diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index 776622ab6e..e861e0ba5d 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -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++; diff --git a/src/detect.h b/src/detect.h index f728e9bd8b..cad6f7c6bb 100644 --- a/src/detect.h +++ b/src/detect.h @@ -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;