]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/prefilter: fix prefilter when setting is 'mpm'
authorVictor Julien <victor@inliniac.net>
Thu, 9 Aug 2018 15:35:32 +0000 (17:35 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 1 Nov 2018 14:46:10 +0000 (15:46 +0100)
When prefilter is not enabled globally, it is still possible to
enable it per signature. This was broken however, as the setup
code would never be called.

This commit always call the setup code and lets that sort out
which signatures (if any) to enable prefiltering for.

src/detect-engine-prefilter.c

index 5478902cf43ef56afef17cd7f180fb5e65adf56e..b289bc136927718b006720a9361b20fb241ce470 100644 (file)
@@ -380,13 +380,12 @@ void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
     BUG_ON(PatternMatchPrepareGroup(de_ctx, sgh) != 0);
 
-    if (de_ctx->prefilter_setting == DETECT_PREFILTER_AUTO) {
-        int i = 0;
-        for (i = 0; i < DETECT_TBLSIZE; i++)
-        {
-            if (sigmatch_table[i].SetupPrefilter != NULL) {
-                sigmatch_table[i].SetupPrefilter(sgh);
-            }
+    /* set up engines if needed - independent of 'detect.prefilter.default'
+     * setting as the prefilter keyword may have enabled individual sigs */
+    for (int i = 0; i < DETECT_TBLSIZE; i++)
+    {
+        if (sigmatch_table[i].SetupPrefilter != NULL) {
+            sigmatch_table[i].SetupPrefilter(sgh);
         }
     }