From 0dd5921bc9791ac733c8d264212d69e661309df1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 20 Feb 2021 15:53:51 +0100 Subject: [PATCH] detect/prefilter: fix handling of prefilter as fast_pattern alias --- src/detect-prefilter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/detect-prefilter.c b/src/detect-prefilter.c index d91edcb17f..87e8491e7c 100644 --- a/src/detect-prefilter.c +++ b/src/detect-prefilter.c @@ -71,13 +71,6 @@ static int DetectPrefilterSetup (DetectEngineCtx *de_ctx, Signature *s, const ch SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter needs preceding match"); SCReturnInt(-1); } - if (sigmatch_table[sm->type].SupportsPrefilter == NULL) { - SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter is not supported for %s", - sigmatch_table[sm->type].name); - SCReturnInt(-1); - } - - s->init_data->prefilter_sm = sm; /* if the sig match is content, prefilter should act like * 'fast_pattern' w/o options. */ @@ -95,11 +88,18 @@ static int DetectPrefilterSetup (DetectEngineCtx *de_ctx, Signature *s, const ch } cd->flags |= DETECT_CONTENT_FAST_PATTERN; } else { + if (sigmatch_table[sm->type].SupportsPrefilter == NULL) { + SCLogError(SC_ERR_INVALID_SIGNATURE, "prefilter is not supported for %s", + sigmatch_table[sm->type].name); + SCReturnInt(-1); + } s->flags |= SIG_FLAG_PREFILTER; /* make sure setup function runs for this type. */ de_ctx->sm_types_prefilter[sm->type] = true; } + s->init_data->prefilter_sm = sm; + SCReturnInt(0); }