]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
instance: set system vs user mode
authorVictor Julien <victor@inliniac.net>
Fri, 5 Apr 2019 09:20:24 +0000 (11:20 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 5 Apr 2019 12:39:06 +0000 (14:39 +0200)
src/runmodes.c
src/runmodes.h
src/suricata.c
src/suricata.h

index 90f986cca4b279907359cce34e1ba2477b6ae4fb..7c5ec897bebaff3bfcaaca84483b791425054bbb 100644 (file)
@@ -492,6 +492,19 @@ int RunModeOutputFiledataEnabled(void)
     return filedata_logger_count > 0;
 }
 
+bool IsRunModeSystem(enum RunModes run_mode_to_check)
+{
+    switch (run_mode_to_check) {
+        case RUNMODE_PCAP_FILE:
+        case RUNMODE_ERF_FILE:
+        case RUNMODE_ENGINE_ANALYSIS:
+            return false;
+            break;
+        default:
+            return true;
+    }
+}
+
 bool IsRunModeOffline(int run_mode_to_check)
 {
     switch(run_mode_to_check) {
index 8fe8fa1d6090215ad4aa0670477f1b751a60875a..4ad83be94d1adfa5bf048632a7816fb073266f56 100644 (file)
@@ -90,6 +90,7 @@ int RunModeOutputFileEnabled(void);
 int RunModeOutputFiledataEnabled(void);
 /** bool indicating if run mode is offline */
 bool IsRunModeOffline(int run_mode_to_check);
+bool IsRunModeSystem(enum RunModes run_mode_to_check);
 
 void RunModeEnablesBypassManager(void);
 int RunModeNeedsBypassManager(void);
index e00df93615fd9dd943fe2d96f1df306bb81310d8..02bc9c8398a4ad523a701bc7a504daa88f6914fa 100644 (file)
@@ -2096,6 +2096,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
         suri->run_mode = RUNMODE_ENGINE_ANALYSIS;
 
     suri->offline = IsRunModeOffline(suri->run_mode);
+    suri->system = IsRunModeSystem(suri->run_mode);
 
     ret = SetBpfString(optind, argv);
     if (ret != TM_ECODE_OK)
index e62956698b048498014c0827cca2031c93ff6b21..2a11960a7322bd3626208aa23ba26f56590d4f2f 100644 (file)
@@ -150,6 +150,7 @@ typedef struct SCInstance_ {
     uint32_t userid;
     uint32_t groupid;
 #endif /* OS_WIN32 */
+    bool system;
     int delayed_detect;
     int disabled_detect;
     int daemon;