From: Anoop Saldanha Date: Fri, 22 Jun 2012 18:09:02 +0000 (+0530) Subject: disable live rule swap when -s or -S option's used at startup X-Git-Tag: suricata-1.3rc1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fb2040eee301909d5c88c2f298fd9a050707611;p=thirdparty%2Fsuricata.git disable live rule swap when -s or -S option's used at startup --- diff --git a/src/detect-engine.c b/src/detect-engine.c index db1c0697dd..6ae7d84846 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -715,6 +715,13 @@ TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data) { return TM_ECODE_OK; } +/** + * \internal + * \brief This thread is an exact duplicate of DetectEngineThreadCtxInit(), + * except that the counters API 2 calls doesn't let us use the same + * init function. Once we have the new counters API it should let + * us use the same init function. + */ static TmEcode DetectEngineThreadCtxInitForLiveRuleSwap(ThreadVars *tv, void *initdata, void **data) { DetectEngineCtx *de_ctx = (DetectEngineCtx *)initdata; diff --git a/src/suricata.c b/src/suricata.c index 818cb9e6a4..8c4586db8f 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -248,6 +248,13 @@ void SignalHandlerSigusr2EngineShutdown(int sig) return; } +void SignalHandlerSigusr2SigFileStartup(int sig) +{ + SCLogInfo("Live rule not possible if -s or -S option used at runtime."); + + return; +} + static void SignalHandlerSigusr2Idle(int sig) { if (run_mode == RUNMODE_UNKNOWN || run_mode == RUNMODE_UNITTEST) { @@ -1455,7 +1462,10 @@ int main(int argc, char **argv) AppLayerHtpNeedFileInspection(); - UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2Idle); + if (sig_file == NULL) + UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2Idle); + else + UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2SigFileStartup); #ifdef UNITTESTS @@ -1696,7 +1706,8 @@ int main(int argc, char **argv) /* registering singal handlers we use. We register usr2 here, so that one * can't call it during the first sig load phase */ - UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2); + if (sig_file == NULL) + UtilSignalHandlerSetup(SIGUSR2, SignalHandlerSigusr2); #ifdef PROFILING SCProfilingInitRuleCounters(de_ctx);