am->app_v2.tx_min_progress = t->app_v2.tx_min_progress;
am->priority = t->priority;
am->sgh_mpm_context = t->sgh_mpm_context;
- am->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, am->name, am->sm_list);
+ am->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(
+ de_ctx, am->name, am->sm_list, am->app_v2.alproto);
am->next = t->next;
if (transforms) {
memcpy(&am->transforms, transforms, sizeof(*transforms));
n->sgh_mpm_context = MPM_CTX_FACTORY_UNIQUE_CONTEXT;
} else {
SCLogDebug("using shared mpm ctx' for %s", n->name);
- n->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, n->name, n->sm_list);
+ n->sgh_mpm_context =
+ MpmFactoryRegisterMpmCtxProfile(de_ctx, n->name, n->sm_list, n->app_v2.alproto);
}
list = list->next;
if (shared == 0) {
am->sgh_mpm_context = MPM_CTX_FACTORY_UNIQUE_CONTEXT;
} else {
- am->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, am->name, am->sm_list);
+ am->sgh_mpm_context =
+ MpmFactoryRegisterMpmCtxProfile(de_ctx, am->name, am->sm_list, alproto);
}
if (de_ctx->frame_mpms_list == NULL) {
n->sgh_mpm_context = MPM_CTX_FACTORY_UNIQUE_CONTEXT;
} else {
SCLogDebug("using shared mpm ctx' for %s", n->name);
- n->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, n->name, n->sm_list);
+ n->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(
+ de_ctx, n->name, n->sm_list, n->frame_v1.alproto);
}
list = list->next;
n->sgh_mpm_context = MPM_CTX_FACTORY_UNIQUE_CONTEXT;
} else {
SCLogDebug("using shared mpm ctx' for %s", n->name);
- n->sgh_mpm_context = MpmFactoryRegisterMpmCtxProfile(de_ctx, n->name, n->sm_list);
+ n->sgh_mpm_context =
+ MpmFactoryRegisterMpmCtxProfile(de_ctx, n->name, n->sm_list, ALPROTO_UNKNOWN);
}
list = list->next;
ctx = MPM_CTX_FACTORY_UNIQUE_CONTEXT;
SCLogDebug("using unique mpm ctx' for %s", name);
} else {
- ctx = MpmFactoryRegisterMpmCtxProfile(de_ctx, name, DETECT_SM_LIST_PMATCH);
+ ctx = MpmFactoryRegisterMpmCtxProfile(de_ctx, name, DETECT_SM_LIST_PMATCH, ALPROTO_UNKNOWN);
SCLogDebug("using shared mpm ctx' for %s", name);
}
return ctx;
*
* \param name A new profile to be registered to store this MpmCtx.
* \param sm_list sm_list for this name (might be variable with xforms)
+ * \param alproto app proto or ALPROTO_UNKNOWN if not for app-layer
*
* \retval id Return the id created for the new MpmCtx profile.
*/
int32_t MpmFactoryRegisterMpmCtxProfile(
- DetectEngineCtx *de_ctx, const char *name, const int sm_list)
+ DetectEngineCtx *de_ctx, const char *name, const int sm_list, const AppProto alproto)
{
/* the very first entry */
if (de_ctx->mpm_ctx_factory_container == NULL) {
MpmCtxFactoryItem *item = de_ctx->mpm_ctx_factory_container->items;
MpmCtxFactoryItem *pitem = NULL;
while (item) {
- if (item->sm_list == sm_list && item->name != NULL && strcmp(item->name, name) == 0) {
+ if (item->sm_list == sm_list && item->alproto == alproto && item->name != NULL &&
+ strcmp(item->name, name) == 0) {
return item->id;
}
pitem = item;
nitem->name = name;
nitem->sm_list = sm_list;
nitem->id = de_ctx->mpm_ctx_factory_container->max_id++;
+ nitem->alproto = alproto;
/* toserver */
nitem->mpm_ctx_ts = SCCalloc(1, sizeof(MpmCtx));
#ifndef __UTIL_MPM_H__
#define __UTIL_MPM_H__
+#include "app-layer-protos.h"
#include "util-prefilter.h"
#define MPM_INIT_HASH_SIZE 65536
MpmCtx *mpm_ctx_tc;
int32_t id;
int32_t sm_list;
+ AppProto alproto; /**< ALPROTO_UNKNOWN is not an app item */
struct MpmCtxFactoryItem *next;
} MpmCtxFactoryItem;
struct DetectEngineCtx_;
-int32_t MpmFactoryRegisterMpmCtxProfile(struct DetectEngineCtx_ *, const char *, const int);
+int32_t MpmFactoryRegisterMpmCtxProfile(
+ struct DetectEngineCtx_ *, const char *, const int, const AppProto);
void MpmFactoryReClaimMpmCtx(const struct DetectEngineCtx_ *, MpmCtx *);
MpmCtx *MpmFactoryGetMpmCtxForProfile(const struct DetectEngineCtx_ *, int32_t, int);
void MpmFactoryDeRegisterAllMpmCtxProfiles(struct DetectEngineCtx_ *);