runmodes: simply default runmode logic

pull/4015/head
Victor Julien 7 years ago
parent 3282fb4967
commit 8c6251ea6c

@ -60,11 +60,9 @@
extern int max_pending_packets; extern int max_pending_packets;
static const char *default_mode_workers = NULL;
const char *RunModeAFPGetDefaultMode(void) const char *RunModeAFPGetDefaultMode(void)
{ {
return default_mode_workers; return "workers";
} }
void RunModeIdsAFPRegister(void) void RunModeIdsAFPRegister(void)
@ -76,7 +74,6 @@ void RunModeIdsAFPRegister(void)
"Workers af-packet mode, each thread does all" "Workers af-packet mode, each thread does all"
" tasks from acquisition to logging", " tasks from acquisition to logging",
RunModeIdsAFPWorkers); RunModeIdsAFPWorkers);
default_mode_workers = "workers";
RunModeRegisterNewRunMode(RUNMODE_AFP_DEV, "autofp", RunModeRegisterNewRunMode(RUNMODE_AFP_DEV, "autofp",
"Multi socket AF_PACKET mode. Packets from " "Multi socket AF_PACKET mode. Packets from "
"each flow are assigned to a single detect " "each flow are assigned to a single detect "

@ -30,8 +30,6 @@
#include "util-affinity.h" #include "util-affinity.h"
#include "util-runmodes.h" #include "util-runmodes.h"
static const char *default_mode;
static int DagConfigGetThreadCount(void *conf) static int DagConfigGetThreadCount(void *conf)
{ {
return 1; return 1;
@ -44,13 +42,11 @@ static void *ParseDagConfig(const char *iface)
const char *RunModeErfDagGetDefaultMode(void) const char *RunModeErfDagGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
void RunModeErfDagRegister(void) void RunModeErfDagRegister(void)
{ {
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_DAG, "autofp", RunModeRegisterNewRunMode(RUNMODE_DAG, "autofp",
"Multi threaded DAG mode. Packets from " "Multi threaded DAG mode. Packets from "
"each flow are assigned to a single detect " "each flow are assigned to a single detect "

@ -31,17 +31,13 @@
#include "util-runmodes.h" #include "util-runmodes.h"
static const char *default_mode;
const char *RunModeErfFileGetDefaultMode(void) const char *RunModeErfFileGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
void RunModeErfFileRegister(void) void RunModeErfFileRegister(void)
{ {
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_ERF_FILE, "single", RunModeRegisterNewRunMode(RUNMODE_ERF_FILE, "single",
"Single threaded ERF file mode", "Single threaded ERF file mode",
RunModeErfFileSingle); RunModeErfFileSingle);

@ -41,17 +41,13 @@
#include "source-ipfw.h" #include "source-ipfw.h"
#include "util-device.h" #include "util-device.h"
static const char *default_mode;
const char *RunModeIpsIPFWGetDefaultMode(void) const char *RunModeIpsIPFWGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
void RunModeIpsIPFWRegister(void) void RunModeIpsIPFWRegister(void)
{ {
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_IPFW, "autofp", RunModeRegisterNewRunMode(RUNMODE_IPFW, "autofp",
"Multi threaded IPFW IPS mode with respect to flow", "Multi threaded IPFW IPS mode with respect to flow",
RunModeIpsIPFWAutoFp); RunModeIpsIPFWAutoFp);

@ -40,8 +40,6 @@
#define NT_RUNMODE_AUTOFP 1 #define NT_RUNMODE_AUTOFP 1
#define NT_RUNMODE_WORKERS 2 #define NT_RUNMODE_WORKERS 2
static const char *default_mode = "workers";
#ifdef HAVE_NAPATECH #ifdef HAVE_NAPATECH
#define MAX_STREAMS 256 #define MAX_STREAMS 256
@ -74,7 +72,7 @@ bool NapatechIsAutoConfigEnabled(void)
const char *RunModeNapatechGetDefaultMode(void) const char *RunModeNapatechGetDefaultMode(void)
{ {
return default_mode; return "workers";
} }
void RunModeNapatechRegister(void) void RunModeNapatechRegister(void)

@ -34,16 +34,13 @@
#include "source-nflog.h" #include "source-nflog.h"
static const char *default_mode = NULL;
const char *RunModeIdsNflogGetDefaultMode(void) const char *RunModeIdsNflogGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
void RunModeIdsNflogRegister(void) void RunModeIdsNflogRegister(void)
{ {
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_NFLOG, "autofp", RunModeRegisterNewRunMode(RUNMODE_NFLOG, "autofp",
"Multi threaded nflog mode", "Multi threaded nflog mode",
RunModeIdsNflogAutoFp); RunModeIdsNflogAutoFp);

@ -39,16 +39,13 @@
#include "util-runmodes.h" #include "util-runmodes.h"
#include "util-device.h" #include "util-device.h"
static const char *default_mode;
const char *RunModeIpsNFQGetDefaultMode(void) const char *RunModeIpsNFQGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
void RunModeIpsNFQRegister(void) void RunModeIpsNFQRegister(void)
{ {
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_NFQ, "autofp", RunModeRegisterNewRunMode(RUNMODE_NFQ, "autofp",
"Multi threaded NFQ IPS mode with respect to flow", "Multi threaded NFQ IPS mode with respect to flow",
RunModeIpsNFQAutoFp); RunModeIpsNFQAutoFp);

@ -32,11 +32,9 @@
#include "util-runmodes.h" #include "util-runmodes.h"
static const char *default_mode = NULL;
const char *RunModeFilePcapGetDefaultMode(void) const char *RunModeFilePcapGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
void RunModeFilePcapRegister(void) void RunModeFilePcapRegister(void)
@ -44,7 +42,6 @@ void RunModeFilePcapRegister(void)
RunModeRegisterNewRunMode(RUNMODE_PCAP_FILE, "single", RunModeRegisterNewRunMode(RUNMODE_PCAP_FILE, "single",
"Single threaded pcap file mode", "Single threaded pcap file mode",
RunModeFilePcapSingle); RunModeFilePcapSingle);
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_PCAP_FILE, "autofp", RunModeRegisterNewRunMode(RUNMODE_PCAP_FILE, "autofp",
"Multi threaded pcap file mode. Packets from " "Multi threaded pcap file mode. Packets from "
"each flow are assigned to a single detect thread, " "each flow are assigned to a single detect thread, "

@ -32,11 +32,9 @@
#include "util-atomic.h" #include "util-atomic.h"
#include "util-misc.h" #include "util-misc.h"
static const char *default_mode = NULL;
const char *RunModeIdsGetDefaultMode(void) const char *RunModeIdsGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
int RunModeIdsPcapWorkers(void); int RunModeIdsPcapWorkers(void);
@ -46,7 +44,6 @@ void RunModeIdsPcapRegister(void)
RunModeRegisterNewRunMode(RUNMODE_PCAP_DEV, "single", RunModeRegisterNewRunMode(RUNMODE_PCAP_DEV, "single",
"Single threaded pcap live mode", "Single threaded pcap live mode",
RunModeIdsPcapSingle); RunModeIdsPcapSingle);
default_mode = "autofp";
RunModeRegisterNewRunMode(RUNMODE_PCAP_DEV, "autofp", RunModeRegisterNewRunMode(RUNMODE_PCAP_DEV, "autofp",
"Multi threaded pcap live mode. Packets from " "Multi threaded pcap live mode. Packets from "
"each flow are assigned to a single detect thread, " "each flow are assigned to a single detect thread, "

@ -49,8 +49,6 @@
#include "conf-yaml-loader.h" #include "conf-yaml-loader.h"
static const char *default_mode = NULL;
int unix_socket_mode_is_running = 0; int unix_socket_mode_is_running = 0;
typedef struct PcapFiles_ { typedef struct PcapFiles_ {
@ -79,7 +77,7 @@ typedef struct MemcapCommand_ {
const char *RunModeUnixSocketGetDefaultMode(void) const char *RunModeUnixSocketGetDefaultMode(void)
{ {
return default_mode; return "autofp";
} }
#ifdef BUILD_UNIX_SOCKET #ifdef BUILD_UNIX_SOCKET
@ -594,7 +592,6 @@ void RunModeUnixSocketRegister(void)
RunModeRegisterNewRunMode(RUNMODE_UNIX_SOCKET, "autofp", RunModeRegisterNewRunMode(RUNMODE_UNIX_SOCKET, "autofp",
"Unix socket mode", "Unix socket mode",
RunModeUnixSocketMaster); RunModeUnixSocketMaster);
default_mode = "autofp";
#endif #endif
} }

@ -37,16 +37,13 @@
#include "util-runmodes.h" #include "util-runmodes.h"
#include "util-time.h" #include "util-time.h"
const char *RunModeIpsWinDivertGetDefaultMode(void)
static const char *default_mode; {
return "autofp";
}
const char *RunModeIpsWinDivertGetDefaultMode(void) { return default_mode; }
void RunModeIpsWinDivertRegister(void) void RunModeIpsWinDivertRegister(void)
{ {
default_mode = "autofp";
RunModeRegisterNewRunMode( RunModeRegisterNewRunMode(
RUNMODE_WINDIVERT, "autofp", RUNMODE_WINDIVERT, "autofp",
"Multi-threaded WinDivert IPS mode load-balanced by flow", "Multi-threaded WinDivert IPS mode load-balanced by flow",

Loading…
Cancel
Save