This will default to Hyperscan when Suricata is built with Hyperscan
support. Otherwise, Boyer-Moore is used by default.
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;
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)
#
# 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: