]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Rename 'worker' running mode to 'workers'
authorEric Leblond <eric@regit.org>
Thu, 5 Jul 2012 14:12:52 +0000 (16:12 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 5 Jul 2012 15:03:52 +0000 (17:03 +0200)
This patch renamed the 'worker' running mode into 'workers'. Thus,
there is only one name in Suricata for the same thing. Backward
compatibility is ensured by replacing "worker" by "workers" when
the old name is used. A warning is printed in the log when the old
name is used.

src/runmode-ipfw.c
src/runmode-nfq.c
src/runmodes.c
src/source-ipfw.c
src/source-nfq.c

index cd021ac0ed74d973fd255c02ee11c96067a5ce3a..c79ab61caae76c078af3911d8ca78a0f551a7926 100644 (file)
@@ -66,7 +66,7 @@ void RunModeIpsIPFWRegister(void)
                               "Multi threaded IPFW IPS mode with respect to flow",
                               RunModeIpsIPFWAutoFp);
 
-    RunModeRegisterNewRunMode(RUNMODE_IPFW, "worker",
+    RunModeRegisterNewRunMode(RUNMODE_IPFW, "workers",
                               "Multi queue IPFW IPS mode with one thread per queue",
                               RunModeIpsIPFWWorker);
 
index 9a69e0445d03775501228bd59071e7c46db66881..58a58b9890860c2c7e5d0d6b74219dd568354226 100644 (file)
@@ -64,7 +64,7 @@ void RunModeIpsNFQRegister(void)
                               "Multi threaded NFQ IPS mode with respect to flow",
                               RunModeIpsNFQAutoFp);
 
-    RunModeRegisterNewRunMode(RUNMODE_NFQ, "worker",
+    RunModeRegisterNewRunMode(RUNMODE_NFQ, "workers",
                               "Multi queue NFQ IPS mode with one thread per queue",
                               RunModeIpsNFQWorker);
     return;
index f0e9ebbd01e9ecbee87f21db20a1e6c678f4c8fa..9fab3ee78389ac8e3cdb55e6fb9c2eb4119fd516 100644 (file)
@@ -270,7 +270,14 @@ void RunModeDispatch(int runmode, const char *custom_mode, DetectEngineCtx *de_c
                 SCLogError(SC_ERR_UNKNOWN_RUN_MODE, "Unknown runtime mode. Aborting");
                 exit(EXIT_FAILURE);
         }
-    } /* if (custom_mode == NULL) */
+    } else { /* if (custom_mode == NULL) */
+        /* Add compability with old 'worker' name */
+        if (!strcmp("worker", custom_mode)) {
+            SCLogWarning(SC_ERR_RUNMODE, "'worker' mode have been renamed "
+                         "to 'workers', please modify your setup.");
+            custom_mode = SCStrdup("workers");
+        }
+    }
 
     RunMode *mode = RunModeGetCustomMode(runmode, custom_mode);
     if (mode == NULL) {
index 1b94c1ce597815eb869d245962b4e46969d7efc3..b2a19633da7e8111ba10bf883d7729cf070bf366 100644 (file)
@@ -193,9 +193,9 @@ static inline void IPFWMutexInit(IPFWQueueVars *nq)
 {
     char *active_runmode = RunmodeGetActive();
 
-    if (active_runmode && !strcmp("worker", active_runmode)) {
+    if (active_runmode && !strcmp("workers", active_runmode)) {
         nq->use_mutex = 0;
-        SCLogInfo("IPFW running in 'worker' runmode, will not use mutex.");
+        SCLogInfo("IPFW running in 'workers' runmode, will not use mutex.");
     } else {
         nq->use_mutex = 1;
     }
index a9fd7c1d31cafc5c2e461b8e53c5d3cddf95ff65..9b3018acb6d93ab59ebee7448ca8e2c4c9a644f4 100644 (file)
@@ -262,9 +262,9 @@ static inline void NFQMutexInit(NFQQueueVars *nq)
 {
     char *active_runmode = RunmodeGetActive();
 
-    if (active_runmode && !strcmp("worker", active_runmode)) {
+    if (active_runmode && !strcmp("workers", active_runmode)) {
         nq->use_mutex = 0;
-        SCLogInfo("NFQ running in 'worker' runmode, will not use mutex.");
+        SCLogInfo("NFQ running in 'workers' runmode, will not use mutex.");
     } else {
         nq->use_mutex = 1;
     }