]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: only apply ConfigApplyTx with app-layers
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 17 Jan 2022 13:47:48 +0000 (14:47 +0100)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 21 Apr 2022 07:31:56 +0000 (13:01 +0530)
Ticket: 4972

Otherwise, it makes no sense to look for a tx...

(cherry picked from commit c3a220647b31b453b0fc14ecfb028defad2778dc)

src/detect-config.c
src/detect-engine-build.c

index f5bea5b92239cbf8b6cee1ee4057e7b272cef026..c7d63a66412d5c61bdc1ab2552857b97866a0fe5 100644 (file)
@@ -283,6 +283,10 @@ static int DetectConfigSetup (DetectEngineCtx *de_ctx, Signature *s, const char
         fd->scope = CONFIG_SCOPE_TX;
     }
 
+    if (fd->scope == CONFIG_SCOPE_TX) {
+        s->flags |= SIG_FLAG_APPLAYER;
+    }
+
     sm->ctx = (SigMatchCtx*)fd;
     SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_POSTMATCH);
 
index 238f8449563f8b5f83f73fe1a6436a09a3f07b3a..9d8f05c98e2ddaf272b0fdf146e5ebf3167d5226 100644 (file)
@@ -33,6 +33,7 @@
 #include "detect-dsize.h"
 #include "detect-tcp-flags.h"
 #include "detect-flow.h"
+#include "detect-config.h"
 #include "detect-flowbits.h"
 
 #include "util-profiling.h"
@@ -562,6 +563,13 @@ static int SignatureCreateMask(Signature *s)
             case DETECT_ENGINE_EVENT:
                 s->mask |= SIG_MASK_REQUIRE_ENGINE_EVENT;
                 break;
+            case DETECT_CONFIG: {
+                DetectConfigData *fd = (DetectConfigData *)sm->ctx;
+                if (fd->scope == CONFIG_SCOPE_FLOW) {
+                    s->mask |= SIG_MASK_REQUIRE_FLOW;
+                }
+                break;
+            }
         }
     }