diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index c7aa845cc39d..59c85374108a 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -508,7 +508,7 @@ uint16_t PatternMatchDefaultMatcher(void) done: #ifdef __tile__ if (mpm_algo_val == MPM_AC) - mpm_algo_val = MPM_AC_TILE; + mpm_algo_val = MPM_AC_KS; #endif return mpm_algo_val; diff --git a/src/detect-engine.c b/src/detect-engine.c index 0f7539905623..b3cf753b951d 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -1822,7 +1822,7 @@ static int DetectEngineCtxLoadConf(DetectEngineCtx *de_ctx) if (sgh_mpm_context == NULL || strcmp(sgh_mpm_context, "auto") == 0) { /* for now, since we still haven't implemented any intelligence into * understanding the patterns and distributing mpm_ctx across sgh */ - if (de_ctx->mpm_matcher == MPM_AC || de_ctx->mpm_matcher == MPM_AC_TILE || + if (de_ctx->mpm_matcher == MPM_AC || de_ctx->mpm_matcher == MPM_AC_KS || #ifdef BUILD_HYPERSCAN de_ctx->mpm_matcher == MPM_HS || #endif diff --git a/src/util-mpm-ac-tile.c b/src/util-mpm-ac-tile.c index 0d8c8887af89..22b8222b82e4 100644 --- a/src/util-mpm-ac-tile.c +++ b/src/util-mpm-ac-tile.c @@ -1495,21 +1495,21 @@ void SCACTilePrintInfo(MpmCtx *mpm_ctx) void MpmACTileRegister(void) { #ifdef __tile__ - mpm_table[MPM_AC_TILE].name = "ac-tile"; + mpm_table[MPM_AC_KS].name = "ac-tile"; #else - mpm_table[MPM_AC_TILE].name = "ac-ks"; + mpm_table[MPM_AC_KS].name = "ac-ks"; #endif - mpm_table[MPM_AC_TILE].InitCtx = SCACTileInitCtx; - mpm_table[MPM_AC_TILE].InitThreadCtx = SCACTileInitThreadCtx; - mpm_table[MPM_AC_TILE].DestroyCtx = SCACTileDestroyCtx; - mpm_table[MPM_AC_TILE].DestroyThreadCtx = SCACTileDestroyThreadCtx; - mpm_table[MPM_AC_TILE].AddPattern = SCACTileAddPatternCS; - mpm_table[MPM_AC_TILE].AddPatternNocase = SCACTileAddPatternCI; - mpm_table[MPM_AC_TILE].Prepare = SCACTilePreparePatterns; - mpm_table[MPM_AC_TILE].Search = SCACTileSearch; - mpm_table[MPM_AC_TILE].PrintCtx = SCACTilePrintInfo; - mpm_table[MPM_AC_TILE].PrintThreadCtx = SCACTilePrintSearchStats; - mpm_table[MPM_AC_TILE].RegisterUnittests = SCACTileRegisterTests; + mpm_table[MPM_AC_KS].InitCtx = SCACTileInitCtx; + mpm_table[MPM_AC_KS].InitThreadCtx = SCACTileInitThreadCtx; + mpm_table[MPM_AC_KS].DestroyCtx = SCACTileDestroyCtx; + mpm_table[MPM_AC_KS].DestroyThreadCtx = SCACTileDestroyThreadCtx; + mpm_table[MPM_AC_KS].AddPattern = SCACTileAddPatternCS; + mpm_table[MPM_AC_KS].AddPatternNocase = SCACTileAddPatternCI; + mpm_table[MPM_AC_KS].Prepare = SCACTilePreparePatterns; + mpm_table[MPM_AC_KS].Search = SCACTileSearch; + mpm_table[MPM_AC_KS].PrintCtx = SCACTilePrintInfo; + mpm_table[MPM_AC_KS].PrintThreadCtx = SCACTilePrintSearchStats; + mpm_table[MPM_AC_KS].RegisterUnittests = SCACTileRegisterTests; } @@ -1526,7 +1526,7 @@ static int SCACTileTest01(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1560,7 +1560,7 @@ static int SCACTileTest02(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1593,7 +1593,7 @@ static int SCACTileTest03(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1630,7 +1630,7 @@ static int SCACTileTest04(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); MpmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1664,7 +1664,7 @@ static int SCACTileTest05(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); MpmAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -1698,7 +1698,7 @@ static int SCACTileTest06(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); MpmAddPatternCS(&mpm_ctx, (uint8_t *)"abcd", 4, 0, 0, 0, 0, 0); @@ -1730,7 +1730,7 @@ static int SCACTileTest07(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* should match 30 times */ @@ -1775,7 +1775,7 @@ static int SCACTileTest08(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1807,7 +1807,7 @@ static int SCACTileTest09(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1839,7 +1839,7 @@ static int SCACTileTest10(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1876,7 +1876,7 @@ static int SCACTileTest11(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); if (MpmAddPatternCS(&mpm_ctx, (uint8_t *)"he", 2, 0, 0, 1, 0, 0) == -1) @@ -1923,7 +1923,7 @@ static int SCACTileTest12(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1958,7 +1958,7 @@ static int SCACTileTest13(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -1992,7 +1992,7 @@ static int SCACTileTest14(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -2026,7 +2026,7 @@ static int SCACTileTest15(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -2060,7 +2060,7 @@ static int SCACTileTest16(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -2094,7 +2094,7 @@ static int SCACTileTest17(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -2128,7 +2128,7 @@ static int SCACTileTest18(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -2162,7 +2162,7 @@ static int SCACTileTest19(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 */ @@ -2196,7 +2196,7 @@ static int SCACTileTest20(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 */ @@ -2230,7 +2230,7 @@ static int SCACTileTest21(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 */ @@ -2262,7 +2262,7 @@ static int SCACTileTest22(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 match */ @@ -2297,7 +2297,7 @@ static int SCACTileTest23(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 */ @@ -2329,7 +2329,7 @@ static int SCACTileTest24(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 1 */ @@ -2361,7 +2361,7 @@ static int SCACTileTest25(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); MpmAddPatternCI(&mpm_ctx, (uint8_t *)"ABCD", 4, 0, 0, 0, 0, 0); @@ -2395,7 +2395,7 @@ static int SCACTileTest26(void) memset(&mpm_ctx, 0x00, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); MpmAddPatternCI(&mpm_ctx, (uint8_t *)"Works", 5, 0, 0, 0, 0, 0); @@ -2428,7 +2428,7 @@ static int SCACTileTest27(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 0 match */ @@ -2461,7 +2461,7 @@ static int SCACTileTest28(void) memset(&mpm_ctx, 0, sizeof(MpmCtx)); memset(&mpm_thread_ctx, 0, sizeof(MpmThreadCtx)); - MpmInitCtx(&mpm_ctx, MPM_AC_TILE); + MpmInitCtx(&mpm_ctx, MPM_AC_KS); SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx); /* 0 match */ diff --git a/src/util-mpm-ac-tile.h b/src/util-mpm-ac-tile.h index b594f63fedd7..da2e21b407a7 100644 --- a/src/util-mpm-ac-tile.h +++ b/src/util-mpm-ac-tile.h @@ -23,8 +23,8 @@ * */ -#ifndef __UTIL_MPM_AC_TILE__H__ -#define __UTIL_MPM_AC_TILE__H__ +#ifndef __UTIL_MPM_AC_KS__H__ +#define __UTIL_MPM_AC_KS__H__ typedef struct SCACTilePatternList_ { uint8_t *cs; @@ -155,4 +155,4 @@ typedef struct SCACTileThreadCtx_ { void MpmACTileRegister(void); -#endif /* __UTIL_MPM_AC_TILE__H__ */ +#endif /* __UTIL_MPM_AC_KS__H__ */ diff --git a/src/util-mpm.c b/src/util-mpm.c index 12e9f0f32cce..88a2087c814d 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -269,13 +269,13 @@ void MpmInitCtx (MpmCtx *mpm_ctx, uint16_t matcher) #ifdef BUILD_HYPERSCAN # define DEFAULT_MPM MPM_HS # ifdef __tile__ -# define DEFAULT_MPM_AC MPM_AC_TILE +# define DEFAULT_MPM_AC MPM_AC_KS # else # define DEFAULT_MPM_AC MPM_AC # endif #else # ifdef __tile__ -# define DEFAULT_MPM MPM_AC_TILE +# define DEFAULT_MPM MPM_AC_KS # else # define DEFAULT_MPM MPM_AC # endif diff --git a/src/util-mpm.h b/src/util-mpm.h index 3a48021697ae..e8a22cbf08b2 100644 --- a/src/util-mpm.h +++ b/src/util-mpm.h @@ -34,7 +34,7 @@ enum { /* aho-corasick */ MPM_AC, MPM_AC_BS, - MPM_AC_TILE, + MPM_AC_KS, MPM_HS, /* table size */ MPM_TABLE_SIZE,