]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
disable live rule swap when -s or -S option's used at startup
authorAnoop Saldanha <poonaatsoc@gmail.com>
Fri, 22 Jun 2012 18:09:02 +0000 (23:39 +0530)
committerVictor Julien <victor@inliniac.net>
Tue, 26 Jun 2012 07:36:11 +0000 (09:36 +0200)
src/detect-engine.c
src/suricata.c

index db1c0697dd6f7e509390182d3fd7a9d1333b3dc7..6ae7d848466d8db6fc23cdc9fecfa71b58c79417 100644 (file)
@@ -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;
index 818cb9e6a413c18943629ba12eed59148163f249..8c4586db8f5b8187a41fd70aa64cfd27e6a8515b 100644 (file)
@@ -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);