detect: move app_mpms array to init data

pull/1980/head
Victor Julien 10 years ago
parent 9b3d4f7e24
commit c804102a9a

@ -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++;

@ -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;

Loading…
Cancel
Save