]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
suricata: can't use -l and unix socket runmode
authorEric Leblond <eric@regit.org>
Mon, 14 Dec 2015 14:18:07 +0000 (15:18 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 17 Dec 2015 15:28:44 +0000 (16:28 +0100)
It is not possible to use simultaneously -l and unix socket
runmode because setting the log directory make it final so
not modifable by other call.

It is a implementation limitation but it does not make sense
to set logging directory to have it overwritten by the first
directory specified 'by pcap-file'. So it seems correct to
only trigger an error if this both options are used at the same
time.

src/suricata.c

index b368f21d07f5a5e56c051e03dbe895f43c1a8065..a6ed5736a5bec0412a6e139aec1acbe366ab4b05 100644 (file)
@@ -1108,6 +1108,7 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
     int build_info = 0;
     int conf_test = 0;
     int engine_analysis = 0;
+    int set_log_directory = 0;
     int ret = TM_ECODE_OK;
 
 #ifdef UNITTESTS
@@ -1580,6 +1581,8 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
                         "exist. Shutting down the engine.", optarg, optarg);
                 return TM_ECODE_FAILED;
             }
+            set_log_directory = 1;
+
             break;
         case 'q':
 #ifdef NFQ
@@ -1714,6 +1717,11 @@ static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri)
         return TM_ECODE_FAILED;
     }
 
+    if ((suri->run_mode == RUNMODE_UNIX_SOCKET) && set_log_directory) {
+        SCLogError(SC_ERR_INITIALIZATION, "can't use -l and unix socket runmode at the same time");
+        return TM_ECODE_FAILED;
+    }
+
     if (list_app_layer_protocols)
         suri->run_mode = RUNMODE_LIST_APP_LAYERS;
     if (list_cuda_cards)