]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
suricata: add --disable-hashing option
authorJason Ish <jason.ish@oisf.net>
Mon, 11 Jan 2021 17:26:21 +0000 (11:26 -0600)
committerVictor Julien <victor@inliniac.net>
Wed, 13 Jan 2021 08:00:58 +0000 (09:00 +0100)
The idea with a flag to disable hashing is to provide a way to
get the effect of building Suricata without libnss, which is
sometimes done for performance reasons.

src/suricata.c
src/suricata.h

index f105d01cba4b89dc99468f0ef74cc5707075a410..16d648ece628a7d7f1dd39971606d5096f9c6618 100644 (file)
@@ -233,6 +233,10 @@ int g_disable_randomness = 1;
   * comparing flows */
 uint16_t g_vlan_mask = 0xffff;
 
+/* flag to disable hashing almost globally, to be similar to disabling nss
+ * support */
+bool g_disable_hashing = false;
+
 /** Suricata instance */
 SCInstance suricata;
 
@@ -1225,6 +1229,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
         {"pidfile", required_argument, 0, 0},
         {"init-errors-fatal", 0, 0, 0},
         {"disable-detection", 0, 0, 0},
+        {"disable-hashing", 0, 0, 0},
         {"fatal-unittests", 0, 0, 0},
         {"unittests-coverage", 0, &coverage_unittests, 1},
         {"user", required_argument, 0, 0},
@@ -1427,8 +1432,9 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
             }
             else if(strcmp((long_opts[option_index]).name, "disable-detection") == 0) {
                 g_detect_disabled = suri->disabled_detect = 1;
-            }
-            else if(strcmp((long_opts[option_index]).name, "fatal-unittests") == 0) {
+            } else if (strcmp((long_opts[option_index]).name, "disable-hashing") == 0) {
+                g_disable_hashing = true;
+            } else if (strcmp((long_opts[option_index]).name, "fatal-unittests") == 0) {
 #ifdef UNITTESTS
                 unittests_fatal = 1;
 #else
index 43bb8ab0c525b58d9bb2449a1ad87d3f2e79c320..236c0883ebff5a404c67b779c0b029d051698170 100644 (file)
@@ -171,6 +171,9 @@ extern volatile uint8_t suricata_ctl_flags;
 extern int g_disable_randomness;
 extern uint16_t g_vlan_mask;
 
+/* Flag to disable hashing (almost) globally. */
+extern bool g_disable_hashing;
+
 #include <ctype.h>
 #define u8_tolower(c) tolower((uint8_t)(c))
 #define u8_toupper(c) toupper((uint8_t)(c))