From a0d515bfdd5e2cc7427a07170a0c5a54f446a94f Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 24 Jun 2024 11:06:10 +0200 Subject: [PATCH] detect/threshold: regex cleanup --- src/detect-threshold.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/detect-threshold.c b/src/detect-threshold.c index 2748557a22..d368a8dbcb 100644 --- a/src/detect-threshold.c +++ b/src/detect-threshold.c @@ -60,12 +60,13 @@ #include "util-cpu.h" #endif +#define PARSE_REGEX_NAME "(track|type|count|seconds)" +#define PARSE_REGEX_VALUE "(limit|both|threshold|by_dst|by_src|by_both|by_rule|by_flow|\\d+)" + #define PARSE_REGEX \ - "^\\s*(track|type|count|seconds)\\s+(limit|both|threshold|by_dst|by_src|by_both|by_rule|by_" \ - "flow|\\d+)\\s*,\\s*(track|type|count|seconds)\\s+(limit|both|threshold|by_dst|by_src|by_" \ - "both|by_rule|by_flow|\\d+)\\s*,\\s*(track|type|count|seconds)\\s+(limit|both|threshold|by_" \ - "dst|by_src|by_both|by_rule|by_flow|\\d+)\\s*,\\s*(track|type|count|seconds)\\s+(limit|both|" \ - "threshold|by_dst|by_src|by_both|by_rule|by_flow|\\d+)\\s*" + "^\\s*" PARSE_REGEX_NAME "\\s+" PARSE_REGEX_VALUE "\\s*,\\s*" PARSE_REGEX_NAME \ + "\\s+" PARSE_REGEX_VALUE "\\s*,\\s*" PARSE_REGEX_NAME "\\s+" PARSE_REGEX_VALUE \ + "\\s*,\\s*" PARSE_REGEX_NAME "\\s+" PARSE_REGEX_VALUE "\\s*" static DetectParseRegex parse_regex; -- 2.47.3