diff --git a/src/detect-pcre.c b/src/detect-pcre.c index ed66a9f1e6..c9733deb62 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -57,6 +57,7 @@ #include "stream-tcp-reassemble.h" #include "app-layer-protos.h" #include "app-layer-parser.h" +#include "util-pages.h" #define PARSE_CAPTURE_REGEX "\\(\\?P\\<([A-z]+)\\_([A-z0-9_]+)\\>" #define PARSE_REGEX "(?sd = pcre_study(pd->re, PCRE_STUDY_JIT_COMPILE, &eb); + if (pcre_use_jit) + options |= PCRE_STUDY_JIT_COMPILE; +#endif + pd->sd = pcre_study(pd->re, options, &eb); if(eb != NULL) { SCLogError(SC_ERR_PCRE_STUDY, "pcre study failed : %s", eb); goto error; } +#ifdef PCRE_HAVE_JIT int jit = 0; ret = pcre_fullinfo(pd->re, pd->sd, PCRE_INFO_JIT, &jit); if (ret != 0 || jit != 1) { @@ -520,12 +538,6 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, char *regexstr, "Falling back to regular PCRE handling (%s:%d)", regexstr, de_ctx->rule_file, de_ctx->rule_line); } -#else - pd->sd = pcre_study(pd->re, 0, &eb); - if(eb != NULL) { - SCLogError(SC_ERR_PCRE_STUDY, "pcre study failed : %s", eb); - goto error; - } #endif /*PCRE_HAVE_JIT*/ if (pd->sd == NULL)