spm: add "spm-algo: auto" setting

This will default to Hyperscan when Suricata is built with Hyperscan
support. Otherwise, Boyer-Moore is used by default.
pull/2086/head
Justin Viiret 9 years ago committed by Victor Julien
parent 6a6d019245
commit 91011b30a6

@ -65,6 +65,9 @@ uint16_t SinglePatternMatchDefaultMatcher(void)
char *spm_algo;
if ((ConfGet("spm-algo", &spm_algo)) == 1) {
if (spm_algo != NULL) {
if (strcmp("auto", spm_algo) == 0) {
goto default_matcher;
}
for (uint16_t i = 0; i < SPM_TABLE_SIZE; i++) {
if (spm_table[i].name == NULL) {
continue;
@ -82,7 +85,15 @@ uint16_t SinglePatternMatchDefaultMatcher(void)
exit(EXIT_FAILURE);
}
return SPM_BM; /* default to Boyer-Moore */
default_matcher:
/* When Suricata is built with Hyperscan support, default to using it for
* SPM. */
#ifdef BUILD_HYPERSCAN
return SPM_HS;
#else
/* Otherwise, default to Boyer-Moore */
return SPM_BM;
#endif
}
void SpmTableSetup(void)

@ -729,8 +729,10 @@ mpm-algo: ac
#
# Supported algorithms are "bm" (Boyer-Moore) and "hs" (Hyperscan, only
# available if Suricata has been built with Hyperscan support).
#
# The default of "auto" will use "hs" if available, otherwise "bm".
spm-algo: bm
spm-algo: auto
# Defrag settings:

Loading…
Cancel
Save