Skip to content

Commit

Permalink
detect: only apply ConfigApplyTx with app-layers
Browse files Browse the repository at this point in the history
Ticket: 4972

Otherwise, it makes no sense to look for a tx...
  • Loading branch information
catenacyber authored and victorjulien committed Mar 4, 2022
1 parent e5838b8 commit c3a2206
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/detect-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,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);

Expand Down
8 changes: 8 additions & 0 deletions src/detect-engine-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -560,6 +561,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;
}
}
}

Expand Down

0 comments on commit c3a2206

Please sign in to comment.