detect/mpm: 'mpm-algo' parsing cleanups

pull/5183/head
Victor Julien 5 years ago
parent f2a3d6d834
commit 4726d7027c

@ -619,8 +619,6 @@ uint16_t PatternMatchDefaultMatcher(void)
/* Get the mpm algo defined in config file by the user */ /* Get the mpm algo defined in config file by the user */
if ((ConfGet("mpm-algo", &mpm_algo)) == 1) { if ((ConfGet("mpm-algo", &mpm_algo)) == 1) {
uint16_t u;
if (mpm_algo != NULL) { if (mpm_algo != NULL) {
#if __BYTE_ORDER == __BIG_ENDIAN #if __BYTE_ORDER == __BIG_ENDIAN
if (strcmp(mpm_algo, "ac-ks") == 0) { if (strcmp(mpm_algo, "ac-ks") == 0) {
@ -631,7 +629,7 @@ uint16_t PatternMatchDefaultMatcher(void)
if (strcmp("auto", mpm_algo) == 0) { if (strcmp("auto", mpm_algo) == 0) {
goto done; goto done;
} }
for (u = 0; u < MPM_TABLE_SIZE; u++) { for (uint16_t u = 0; u < MPM_TABLE_SIZE; u++) {
if (mpm_table[u].name == NULL) if (mpm_table[u].name == NULL)
continue; continue;
@ -643,14 +641,13 @@ uint16_t PatternMatchDefaultMatcher(void)
} }
#ifndef BUILD_HYPERSCAN #ifndef BUILD_HYPERSCAN
if ((mpm_algo != NULL) && (strcmp(mpm_algo, "hs") == 0)) { if ((strcmp(mpm_algo, "hs") == 0)) {
FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for mpm-algo is " FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for mpm-algo is "
"not compiled into Suricata."); "not compiled into Suricata.");
} }
#endif #endif
SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid mpm algo supplied " FatalError(SC_ERR_INVALID_YAML_CONF_ENTRY, "Invalid mpm algo supplied "
"in the yaml conf file: \"%s\"", mpm_algo); "in the yaml conf file: \"%s\"", mpm_algo);
exit(EXIT_FAILURE);
} }
done: done:

Loading…
Cancel
Save