From: Eric Leblond Date: Thu, 5 Jul 2012 14:12:52 +0000 (+0200) Subject: Rename 'worker' running mode to 'workers' X-Git-Tag: suricata-1.3~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3465fb971d590c1cee9a88f35d93ebea76aaaf5;p=thirdparty%2Fsuricata.git Rename 'worker' running mode to 'workers' 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. --- diff --git a/src/runmode-ipfw.c b/src/runmode-ipfw.c index cd021ac0ed..c79ab61caa 100644 --- a/src/runmode-ipfw.c +++ b/src/runmode-ipfw.c @@ -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); diff --git a/src/runmode-nfq.c b/src/runmode-nfq.c index 9a69e0445d..58a58b9890 100644 --- a/src/runmode-nfq.c +++ b/src/runmode-nfq.c @@ -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; diff --git a/src/runmodes.c b/src/runmodes.c index f0e9ebbd01..9fab3ee783 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -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) { diff --git a/src/source-ipfw.c b/src/source-ipfw.c index 1b94c1ce59..b2a19633da 100644 --- a/src/source-ipfw.c +++ b/src/source-ipfw.c @@ -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; } diff --git a/src/source-nfq.c b/src/source-nfq.c index a9fd7c1d31..9b3018acb6 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -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; }