From: Victor Julien Date: Mon, 24 Jun 2024 09:06:10 +0000 (+0200) Subject: detect/threshold: regex cleanup X-Git-Tag: suricata-8.0.0-beta1~1079 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0d515bfdd5e2cc7427a07170a0c5a54f446a94f;p=thirdparty%2Fsuricata.git detect/threshold: regex cleanup --- 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;