]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Increase max pattern ID allowed in MPM AC-tile to 28-bits
authorKen Steele <ken@tilera.com>
Fri, 17 Oct 2014 21:25:30 +0000 (17:25 -0400)
committerVictor Julien <victor@inliniac.net>
Thu, 15 Jan 2015 10:52:04 +0000 (11:52 +0100)
src/util-mpm-ac-tile.c

index a3e0c7c5b3c44d6130f803a6317b4e096ae59ed5..b1f8cd9257cda75ebcaa3305a685d0deb7ba1e71 100644 (file)
@@ -1081,8 +1081,8 @@ static inline void SCACTileInsertCaseSensitiveEntriesForPatterns(MpmCtx *mpm_ctx
         for (k = 0; k < ctx->output_table[state].no_of_entries; k++) {
             if (ctx->pattern_list[ctx->output_table[state].patterns[k]].cs != NULL) {
               /* TODO - Find better way to store this. */
-                ctx->output_table[state].patterns[k] &= 0x0000FFFF;
-                ctx->output_table[state].patterns[k] |= 1 << 16;
+                ctx->output_table[state].patterns[k] &= 0x0FFFFFFF;
+                ctx->output_table[state].patterns[k] |= 1 << 31;
             }
         }
     }
@@ -1478,7 +1478,7 @@ int CheckMatch(SCACTileSearchCtx *ctx, PatternMatcherQueue *pmq,
     uint32_t k;
 
     for (k = 0; k < no_of_entries; k++) {
-        MpmPatternIndex pindex = patterns[k] & 0x0000FFFF;
+        MpmPatternIndex pindex = patterns[k] & 0x0FFFFFFF;
         if (mpm_bitarray[pindex / 8] & (1 << (pindex % 8))) {
             /* Pattern already seen by this MPM. */
             /* NOTE: This is faster then rechecking if it is a case-sensitive match
@@ -1492,7 +1492,7 @@ int CheckMatch(SCACTileSearchCtx *ctx, PatternMatcherQueue *pmq,
         }
         uint32_t pid = pattern_list[pindex].pid;
         /* Double check case-sensitve match now. */
-        if (patterns[k] & 0xFFFF0000) {
+        if (patterns[k] >> 31) {
             uint16_t patlen = pattern_list[pindex].patlen;
             if (SCMemcmpNZ(pattern_list[pindex].cs, buf_offset - patlen, patlen) != 0) {
                 /* Case-sensitive match failed. */