From: Victor Julien Date: Fri, 22 Mar 2019 19:18:44 +0000 (+0100) Subject: mpm/hs: track maxdepth X-Git-Tag: suricata-5.0.0-beta1~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cea1e4181dadb7527eed31b403d11ebdbc15a70;p=thirdparty%2Fsuricata.git mpm/hs: track maxdepth --- diff --git a/src/util-mpm-hs.c b/src/util-mpm-hs.c index eca73f7cba..194a7bbd78 100644 --- a/src/util-mpm-hs.c +++ b/src/util-mpm-hs.c @@ -313,6 +313,17 @@ static int SCHSAddPattern(MpmCtx *mpm_ctx, uint8_t *pat, uint16_t patlen, mpm_ctx->pattern_cnt++; + if (!(mpm_ctx->flags & MPMCTX_FLAGS_NODEPTH)) { + if (depth) { + mpm_ctx->maxdepth = MAX(mpm_ctx->maxdepth, depth); + SCLogDebug("%p: depth %u max %u", mpm_ctx, depth, mpm_ctx->maxdepth); + } else { + mpm_ctx->flags |= MPMCTX_FLAGS_NODEPTH; + mpm_ctx->maxdepth = 0; + SCLogDebug("%p: alas, no depth for us", mpm_ctx); + } + } + if (mpm_ctx->maxlen < patlen) mpm_ctx->maxlen = patlen;