From 157ca89dd7e25b88a25eb64143b8335663817d69 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 28 Oct 2015 08:37:28 +0100 Subject: [PATCH] mpm: remove useless flag from factory --- src/detect-engine-mpm.c | 3 +-- src/detect.c | 12 ++++-------- src/util-mpm.c | 7 +------ src/util-mpm.h | 5 +---- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index 0e1c7839c3..c923b59361 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -116,8 +116,7 @@ void DetectMpmInitializeAppMpms(DetectEngineCtx *de_ctx) for (i = 0; i < APP_MPMS_MAX; i++) { AppLayerMpms *am = &app_mpms[i]; - am->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, am->name, - MPM_CTX_FACTORY_FLAGS_PREPARE_WITH_SIG_GROUP_BUILD); + am->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, am->name); SCLogDebug("AppLayer MPM %s: %u", am->name, am->sgh_mpm_context); } diff --git a/src/detect.c b/src/detect.c index 8acacc1c92..40ba84bbb6 100644 --- a/src/detect.c +++ b/src/detect.c @@ -2731,17 +2731,13 @@ static int SignatureCreateMask(Signature *s) static void SigInitStandardMpmFactoryContexts(DetectEngineCtx *de_ctx) { de_ctx->sgh_mpm_context_proto_tcp_packet = - MpmFactoryRegisterMpmCtxProfile(de_ctx, "packet_proto_tcp", - MPM_CTX_FACTORY_FLAGS_PREPARE_WITH_SIG_GROUP_BUILD); + MpmFactoryRegisterMpmCtxProfile(de_ctx, "packet_proto_tcp"); de_ctx->sgh_mpm_context_proto_udp_packet = - MpmFactoryRegisterMpmCtxProfile(de_ctx, "packet_proto_udp", - MPM_CTX_FACTORY_FLAGS_PREPARE_WITH_SIG_GROUP_BUILD); + MpmFactoryRegisterMpmCtxProfile(de_ctx, "packet_proto_udp"); de_ctx->sgh_mpm_context_proto_other_packet = - MpmFactoryRegisterMpmCtxProfile(de_ctx, "packet_proto_other", - MPM_CTX_FACTORY_FLAGS_PREPARE_WITH_SIG_GROUP_BUILD); + MpmFactoryRegisterMpmCtxProfile(de_ctx, "packet_proto_other"); de_ctx->sgh_mpm_context_stream = - MpmFactoryRegisterMpmCtxProfile(de_ctx, "stream", - MPM_CTX_FACTORY_FLAGS_PREPARE_WITH_SIG_GROUP_BUILD); + MpmFactoryRegisterMpmCtxProfile(de_ctx, "stream"); DetectMpmInitializeAppMpms(de_ctx); diff --git a/src/util-mpm.c b/src/util-mpm.c index 73e13d2260..af2ecffc4a 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -54,7 +54,7 @@ * * \retval id Return the id created for the new MpmCtx profile. */ -int32_t MpmFactoryRegisterMpmCtxProfile(DetectEngineCtx *de_ctx, const char *name, uint8_t flags) +int32_t MpmFactoryRegisterMpmCtxProfile(DetectEngineCtx *de_ctx, const char *name) { void *ptmp; /* the very first entry */ @@ -96,9 +96,6 @@ int32_t MpmFactoryRegisterMpmCtxProfile(DetectEngineCtx *de_ctx, const char *nam * the array */ item[0].id = 0; - /* store the flag */ - item[0].flags = flags; - /* store the newly created item */ de_ctx->mpm_ctx_factory_container->items = item; de_ctx->mpm_ctx_factory_container->no_of_items++; @@ -129,7 +126,6 @@ int32_t MpmFactoryRegisterMpmCtxProfile(DetectEngineCtx *de_ctx, const char *nam memset(items[i].mpm_ctx_tc, 0, sizeof(MpmCtx)); items[i].mpm_ctx_tc->global = 1; } - items[i].flags = flags; return items[i].id; } } @@ -169,7 +165,6 @@ int32_t MpmFactoryRegisterMpmCtxProfile(DetectEngineCtx *de_ctx, const char *nam new_item[0].mpm_ctx_tc->global = 1; new_item[0].id = de_ctx->mpm_ctx_factory_container->no_of_items; - new_item[0].flags = flags; de_ctx->mpm_ctx_factory_container->no_of_items++; /* the newly created id */ diff --git a/src/util-mpm.h b/src/util-mpm.h index 50a0b8a586..d689cc9fc4 100644 --- a/src/util-mpm.h +++ b/src/util-mpm.h @@ -125,14 +125,11 @@ typedef struct MpmCtx_ { * we should supply this as the key */ #define MPM_CTX_FACTORY_UNIQUE_CONTEXT -1 -#define MPM_CTX_FACTORY_FLAGS_PREPARE_WITH_SIG_GROUP_BUILD 0x01 - typedef struct MpmCtxFactoryItem_ { const char *name; MpmCtx *mpm_ctx_ts; MpmCtx *mpm_ctx_tc; int32_t id; - uint8_t flags; } MpmCtxFactoryItem; typedef struct MpmCtxFactoryContainer_ { @@ -224,7 +221,7 @@ void MpmCudaEnvironmentSetup(); struct DetectEngineCtx_; -int32_t MpmFactoryRegisterMpmCtxProfile(struct DetectEngineCtx_ *, const char *, uint8_t); +int32_t MpmFactoryRegisterMpmCtxProfile(struct DetectEngineCtx_ *, const char *); void MpmFactoryReClaimMpmCtx(const struct DetectEngineCtx_ *, MpmCtx *); MpmCtx *MpmFactoryGetMpmCtxForProfile(const struct DetectEngineCtx_ *, int32_t, int); void MpmFactoryDeRegisterAllMpmCtxProfiles(struct DetectEngineCtx_ *);