]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
runmodes: simply default runmode logic
authorVictor Julien <victor@inliniac.net>
Tue, 9 Jul 2019 11:20:44 +0000 (13:20 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 9 Jul 2019 11:56:40 +0000 (13:56 +0200)
src/runmode-af-packet.c
src/runmode-erf-dag.c
src/runmode-erf-file.c
src/runmode-ipfw.c
src/runmode-napatech.c
src/runmode-nflog.c
src/runmode-nfq.c
src/runmode-pcap-file.c
src/runmode-pcap.c
src/runmode-unix-socket.c
src/runmode-windivert.c

index 480c833f3b53483531b0ded9fc20aec8fa35c12f..4e6400b9f5b283e585b025790a7f3e13744e4d13 100644 (file)
 
 extern int max_pending_packets;
 
-static const char *default_mode_workers = NULL;
-
 const char *RunModeAFPGetDefaultMode(void)
 {
-    return default_mode_workers;
+    return "workers";
 }
 
 void RunModeIdsAFPRegister(void)
@@ -76,7 +74,6 @@ void RunModeIdsAFPRegister(void)
                               "Workers af-packet mode, each thread does all"
                               " tasks from acquisition to logging",
                               RunModeIdsAFPWorkers);
-    default_mode_workers = "workers";
     RunModeRegisterNewRunMode(RUNMODE_AFP_DEV, "autofp",
                               "Multi socket AF_PACKET mode.  Packets from "
                               "each flow are assigned to a single detect "
index a27544f22fabf7651994062e30ac57165df0678f..f19709abb6d74849130a6a50ce45cec9978eb26f 100644 (file)
@@ -30,8 +30,6 @@
 #include "util-affinity.h"
 #include "util-runmodes.h"
 
-static const char *default_mode;
-
 static int DagConfigGetThreadCount(void *conf)
 {
     return 1;
@@ -44,13 +42,11 @@ static void *ParseDagConfig(const char *iface)
 
 const char *RunModeErfDagGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 void RunModeErfDagRegister(void)
 {
-    default_mode = "autofp";
-
     RunModeRegisterNewRunMode(RUNMODE_DAG, "autofp",
         "Multi threaded DAG mode.  Packets from "
         "each flow are assigned to a single detect "
index 5002030976c0ee62d1f18a985a20075b1bde75ee..b3b97ea277d4b0ba8d52e78735e3c1c56831399e 100644 (file)
 
 #include "util-runmodes.h"
 
-static const char *default_mode;
-
 const char *RunModeErfFileGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 void RunModeErfFileRegister(void)
 {
-    default_mode = "autofp";
-
     RunModeRegisterNewRunMode(RUNMODE_ERF_FILE, "single",
         "Single threaded ERF file mode",
         RunModeErfFileSingle);
index 841692e1166b57ff32234165c99711c4ae56c21d..88a9187c11f2bcc45d497d6f405617a2541f5372 100644 (file)
 #include "source-ipfw.h"
 #include "util-device.h"
 
-static const char *default_mode;
-
 const char *RunModeIpsIPFWGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 void RunModeIpsIPFWRegister(void)
 {
-    default_mode = "autofp";
-
     RunModeRegisterNewRunMode(RUNMODE_IPFW, "autofp",
                               "Multi threaded IPFW IPS mode with respect to flow",
                               RunModeIpsIPFWAutoFp);
index 2400ca4f62692c3c41ed619638cae4a613146eaf..e017e135cea35801c3c91403c820abf8487e71bc 100644 (file)
@@ -40,8 +40,6 @@
 #define NT_RUNMODE_AUTOFP  1
 #define NT_RUNMODE_WORKERS 2
 
-static const char *default_mode = "workers";
-
 #ifdef HAVE_NAPATECH
 
 #define MAX_STREAMS 256
@@ -74,7 +72,7 @@ bool NapatechIsAutoConfigEnabled(void)
 
 const char *RunModeNapatechGetDefaultMode(void)
 {
-    return default_mode;
+    return "workers";
 }
 
 void RunModeNapatechRegister(void)
index 578eb715d5611af4a96adb8e6f0f7f67ab688a64..569dcd78f749100ef2c56f8dbd5142907c71b396 100644 (file)
 
 #include "source-nflog.h"
 
-static const char *default_mode = NULL;
-
 const char *RunModeIdsNflogGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 void RunModeIdsNflogRegister(void)
 {
-    default_mode = "autofp";
     RunModeRegisterNewRunMode(RUNMODE_NFLOG, "autofp",
                               "Multi threaded nflog mode",
                               RunModeIdsNflogAutoFp);
index 67fa5bcbe969b1a30cc4ccac30a643ce9b1fbb83..f1c6b19410c990b0de7c63835e7a0abd457f4f66 100644 (file)
 #include "util-runmodes.h"
 #include "util-device.h"
 
-static const char *default_mode;
-
 const char *RunModeIpsNFQGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 void RunModeIpsNFQRegister(void)
 {
-    default_mode = "autofp";
     RunModeRegisterNewRunMode(RUNMODE_NFQ, "autofp",
                               "Multi threaded NFQ IPS mode with respect to flow",
                               RunModeIpsNFQAutoFp);
index ae5cb84c71e91fa25986ed942d52b63e5696f5b8..3de5c98e519ba302273f31608ef543f690f5ff0f 100644 (file)
 
 #include "util-runmodes.h"
 
-static const char *default_mode = NULL;
-
 const char *RunModeFilePcapGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 void RunModeFilePcapRegister(void)
@@ -44,7 +42,6 @@ void RunModeFilePcapRegister(void)
     RunModeRegisterNewRunMode(RUNMODE_PCAP_FILE, "single",
                               "Single threaded pcap file mode",
                               RunModeFilePcapSingle);
-    default_mode = "autofp";
     RunModeRegisterNewRunMode(RUNMODE_PCAP_FILE, "autofp",
                               "Multi threaded pcap file mode.  Packets from "
                               "each flow are assigned to a single detect thread, "
index 04325ee383f49dda7ba3c2fee73b4f4bc5e36070..db22d2f0a178e6a403f6b412857a87010ec935c6 100644 (file)
 #include "util-atomic.h"
 #include "util-misc.h"
 
-static const char *default_mode = NULL;
-
 const char *RunModeIdsGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 int RunModeIdsPcapWorkers(void);
@@ -46,7 +44,6 @@ void RunModeIdsPcapRegister(void)
     RunModeRegisterNewRunMode(RUNMODE_PCAP_DEV, "single",
                               "Single threaded pcap live mode",
                               RunModeIdsPcapSingle);
-    default_mode = "autofp";
     RunModeRegisterNewRunMode(RUNMODE_PCAP_DEV, "autofp",
                               "Multi threaded pcap live mode.  Packets from "
                               "each flow are assigned to a single detect thread, "
index 53bb4cefc775f7b10bcbbbfb2f5c25d067fe74f0..04257b44084b411e87c13baed87b4185c08ab3c7 100644 (file)
@@ -49,8 +49,6 @@
 
 #include "conf-yaml-loader.h"
 
-static const char *default_mode = NULL;
-
 int unix_socket_mode_is_running = 0;
 
 typedef struct PcapFiles_ {
@@ -79,7 +77,7 @@ typedef struct MemcapCommand_ {
 
 const char *RunModeUnixSocketGetDefaultMode(void)
 {
-    return default_mode;
+    return "autofp";
 }
 
 #ifdef BUILD_UNIX_SOCKET
@@ -594,7 +592,6 @@ void RunModeUnixSocketRegister(void)
     RunModeRegisterNewRunMode(RUNMODE_UNIX_SOCKET, "autofp",
                               "Unix socket mode",
                               RunModeUnixSocketMaster);
-    default_mode = "autofp";
 #endif
 }
 
index adccdb8b7f072865e613fd5afe5ee3b7a0e7c0e3..6b96da0c11ca33f34373ede8dd4a0d0088031809 100644 (file)
 #include "util-runmodes.h"
 #include "util-time.h"
 
-
-static const char *default_mode;
-
-
-const char *RunModeIpsWinDivertGetDefaultMode(void) { return default_mode; }
+const char *RunModeIpsWinDivertGetDefaultMode(void)
+{
+    return "autofp";
+}
 
 void RunModeIpsWinDivertRegister(void)
 {
-    default_mode = "autofp";
-
     RunModeRegisterNewRunMode(
             RUNMODE_WINDIVERT, "autofp",
             "Multi-threaded WinDivert IPS mode load-balanced by flow",