reclaim mpm contexts if no patterns are added to it, even in non-full mode

remotes/origin/master-1.2.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent 1389cf6913
commit ecc7a769a7

@ -1547,13 +1547,14 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
PatternMatchPreparePopulateMpm(de_ctx, sh);
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
//if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) {
if (sh->mpm_proto_tcp_ctx != NULL) {
if (sh->mpm_proto_tcp_ctx->pattern_cnt == 0) {
MpmFactoryReClaimMpmCtx(sh->mpm_proto_tcp_ctx);
sh->mpm_proto_tcp_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVECONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVECONTENT) {
if (mpm_table[sh->mpm_proto_tcp_ctx->mpm_type].Prepare != NULL) {
mpm_table[sh->mpm_proto_tcp_ctx->mpm_type].
Prepare(sh->mpm_proto_tcp_ctx);
@ -1566,7 +1567,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_proto_udp_ctx);
sh->mpm_proto_udp_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVECONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVECONTENT) {
if (mpm_table[sh->mpm_proto_udp_ctx->mpm_type].Prepare != NULL) {
mpm_table[sh->mpm_proto_udp_ctx->mpm_type].
Prepare(sh->mpm_proto_udp_ctx);
@ -1579,7 +1581,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_proto_other_ctx);
sh->mpm_proto_other_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVECONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVECONTENT) {
if (mpm_table[sh->mpm_proto_other_ctx->mpm_type].Prepare != NULL) {
mpm_table[sh->mpm_proto_other_ctx->mpm_type].
Prepare(sh->mpm_proto_other_ctx);
@ -1592,7 +1595,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_stream_ctx);
sh->mpm_stream_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVESTREAMCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVESTREAMCONTENT) {
if (mpm_table[sh->mpm_stream_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_stream_ctx->mpm_type].Prepare(sh->mpm_stream_ctx);
}
@ -1603,7 +1607,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_uri_ctx);
sh->mpm_uri_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEURICONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEURICONTENT) {
if (mpm_table[sh->mpm_uri_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_uri_ctx->mpm_type].Prepare(sh->mpm_uri_ctx);
}
@ -1614,7 +1619,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hcbd_ctx);
sh->mpm_hcbd_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHCBDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHCBDCONTENT) {
if (mpm_table[sh->mpm_hcbd_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hcbd_ctx->mpm_type].Prepare(sh->mpm_hcbd_ctx);
}
@ -1625,7 +1631,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hsbd_ctx);
sh->mpm_hsbd_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHSBDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHSBDCONTENT) {
if (mpm_table[sh->mpm_hsbd_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hsbd_ctx->mpm_type].Prepare(sh->mpm_hsbd_ctx);
}
@ -1636,7 +1643,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hhd_ctx);
sh->mpm_hhd_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHHDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHHDCONTENT) {
if (mpm_table[sh->mpm_hhd_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hhd_ctx->mpm_type].Prepare(sh->mpm_hhd_ctx);
}
@ -1647,7 +1655,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hrhd_ctx);
sh->mpm_hrhd_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHRHDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHRHDCONTENT) {
if (mpm_table[sh->mpm_hrhd_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hrhd_ctx->mpm_type].Prepare(sh->mpm_hrhd_ctx);
}
@ -1658,7 +1667,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hmd_ctx);
sh->mpm_hmd_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHMDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHMDCONTENT) {
if (mpm_table[sh->mpm_hmd_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hmd_ctx->mpm_type].Prepare(sh->mpm_hmd_ctx);
}
@ -1669,7 +1679,8 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hcd_ctx);
sh->mpm_hcd_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHCDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHCDCONTENT) {
if (mpm_table[sh->mpm_hcd_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hcd_ctx->mpm_type].Prepare(sh->mpm_hcd_ctx);
}
@ -1680,14 +1691,15 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
MpmFactoryReClaimMpmCtx(sh->mpm_hrud_ctx);
sh->mpm_hrud_ctx = NULL;
} else {
if (sh->flags & SIG_GROUP_HAVEHRUDCONTENT) {
if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL &&
sh->flags & SIG_GROUP_HAVEHRUDCONTENT) {
if (mpm_table[sh->mpm_hrud_ctx->mpm_type].Prepare != NULL)
mpm_table[sh->mpm_hrud_ctx->mpm_type].Prepare(sh->mpm_hrud_ctx);
}
}
}
} /* if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) */
//} /* if (de_ctx->sgh_mpm_context == ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL) */
} else {
MpmFactoryReClaimMpmCtx(sh->mpm_proto_tcp_ctx);
sh->mpm_proto_tcp_ctx = NULL;

Loading…
Cancel
Save