return filedata_logger_count > 0;
}
+bool IsRunModeOffline(int run_mode_to_check)
+{
+ switch(run_mode_to_check) {
+ case RUNMODE_PCAP_FILE:
+ case RUNMODE_ERF_FILE:
+ case RUNMODE_ENGINE_ANALYSIS:
+ case RUNMODE_UNIX_SOCKET:
+ return true;
+ break;
+ default:
+ return false;
+ }
+}
+
/**
* Cleanup the run mode.
*/
int RunModeOutputFileEnabled(void);
/* bool indicating if filedata logger is enabled */
int RunModeOutputFiledataEnabled(void);
+/** bool indicating if run mode is offline */
+bool IsRunModeOffline(int run_mode_to_check);
#include "runmode-pcap.h"
#include "runmode-pcap-file.h"
/** Run mode selected */
int run_mode = RUNMODE_UNKNOWN;
-/** Is this an offline run mode. */
-int run_mode_offline = 0;
-
/** Engine mode: inline (ENGINE_MODE_IPS) or just
* detection mode (ENGINE_MODE_IDS by default) */
static enum EngineMode g_engine_mode = ENGINE_MODE_IDS;
if (engine_analysis)
suri->run_mode = RUNMODE_ENGINE_ANALYSIS;
+ suri->offline = IsRunModeOffline(suri->run_mode);
+
ret = SetBpfString(optind, argv);
if (ret != TM_ECODE_OK)
return ret;
static int FinalizeRunMode(SCInstance *suri, char **argv)
{
switch (suri->run_mode) {
- case RUNMODE_PCAP_FILE:
- case RUNMODE_ERF_FILE:
- case RUNMODE_ENGINE_ANALYSIS:
- suri->offline = 1;
- break;
case RUNMODE_UNKNOWN:
PrintUsage(argv[0]);
return TM_ECODE_FAILED;
}
/* Set the global run mode and offline flag. */
run_mode = suri->run_mode;
- run_mode_offline = suri->offline;
if (!CheckValidDaemonModes(suri->daemon, suri->run_mode)) {
return TM_ECODE_FAILED;
int IsRuleReloadSet(int quiet);
extern int run_mode;
-extern int run_mode_offline;
void PreRunInit(const int runmode);
void PreRunPostPrivsDropInit(const int runmode);
#ifdef BUILD_WITH_UNIXSOCKET
/* If a socket and running live, do non-blocking writes. */
- if (log_ctx->is_sock && run_mode_offline == 0) {
+ if (log_ctx->is_sock && !IsRunModeOffline(RunmodeGetCurrent())) {
SCLogInfo("Setting logging socket of non-blocking in live mode.");
log_ctx->send_flags |= MSG_DONTWAIT;
}