mpm: add "auto" default for mpm-algo

Setting mpm-algo to "auto" will use "hs" if Suricata was built against
Hyperscan, and "ac" otherwise (or "ac-tile" on Tilera platforms).
pull/2115/head
Justin Viiret 9 years ago committed by Victor Julien
parent 8c6deecc55
commit c9d0d6f698

@ -335,6 +335,9 @@ uint16_t PatternMatchDefaultMatcher(void)
uint16_t u;
if (mpm_algo != NULL) {
if (strcmp("auto", mpm_algo) == 0) {
goto done;
}
for (u = 0; u < MPM_TABLE_SIZE; u++) {
if (mpm_table[u].name == NULL)
continue;

@ -1041,7 +1041,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 == DEFAULT_MPM || de_ctx->mpm_matcher == MPM_AC_TILE ||
if (de_ctx->mpm_matcher == MPM_AC || de_ctx->mpm_matcher == MPM_AC_TILE ||
#ifdef BUILD_HYPERSCAN
de_ctx->mpm_matcher == MPM_HS ||
#endif

@ -43,10 +43,16 @@ enum {
MPM_TABLE_SIZE,
};
#ifdef __tile__
#define DEFAULT_MPM MPM_AC_TILE
/* MPM matcher to use by default, i.e. when "mpm-algo" is set to "auto".
* If Hyperscan is available, use it. Otherwise, use AC. */
#ifdef BUILD_HYPERSCAN
# define DEFAULT_MPM MPM_HS
#else
#define DEFAULT_MPM MPM_AC
# ifdef __tile__
# define DEFAULT_MPM MPM_AC_TILE
# else
# define DEFAULT_MPM MPM_AC
# endif
#endif
/* Internal Pattern Index: 0 to pattern_cnt-1 */

@ -722,8 +722,17 @@ cuda:
cuda-streams: 2
# Select the multi pattern algorithm you want to run for scan/search the
# in the engine. The supported algorithms are b2g, b3g, wumanber,
# ac, ac-bs and ac-gfbs.
# in the engine.
#
# The supported algorithms are:
# "ac" - Aho-Corasick, default implementation
# "ac-bs" - Aho-Corasick, reduced memory implementation
# "ac-cuda" - Aho-Corasick, CUDA implementation
# "ac-tile" - Aho-Corasick, optimized for Tilera architecture
# "hs" - Hyperscan, available when built with Hyperscan support
#
# The default mpm-algo value of "auto" will use "hs" if Hyperscan is available,
# "ac-tile" on Tilera platforms, and "ac" otherwise.
#
# The mpm you choose also decides the distribution of mpm contexts for
# signature groups, specified by the conf - "detect.sgh-mpm-context".
@ -736,7 +745,7 @@ cuda:
# compiled with --enable-cuda: b2g_cuda. Make sure to update your
# max-pending-packets setting above as well if you use b2g_cuda.
mpm-algo: ac
mpm-algo: auto
# Select the matching algorithm you want to use for single-pattern searches.
#

Loading…
Cancel
Save