From 49bad2cfba46f8a52d69632f559d6a36e1cca4e2 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 16 Jan 2015 19:28:44 +0100 Subject: [PATCH] detect: consolidate more setup into DetectEngineCtxInit Loading of classifications, references and action order was done unconditionally, so can be done in one place. --- src/detect-engine.c | 14 +++++++------- src/suricata.c | 6 ------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/detect-engine.c b/src/detect-engine.c index 248927822a..9b2058ddb6 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -551,13 +551,6 @@ static void *DetectEngineLiveRuleSwap(void *arg) goto error; } - SCClassConfLoadClassficationConfigFile(de_ctx); - SCRConfLoadReferenceConfigFile(de_ctx); - - if (ActionInitConfig() < 0) { - exit(EXIT_FAILURE); - } - if (SigLoadSignatures(de_ctx, NULL, FALSE) < 0) { SCLogError(SC_ERR_NO_RULES_LOADED, "Loading signatures failed."); if (de_ctx->failure_fatal) @@ -879,6 +872,13 @@ DetectEngineCtx *DetectEngineCtxInit(void) SCProfilingKeywordInitCounters(de_ctx); #endif + SCClassConfLoadClassficationConfigFile(de_ctx); + SCRConfLoadReferenceConfigFile(de_ctx); + + if (ActionInitConfig() < 0) { + goto error; + } + return de_ctx; error: return NULL; diff --git a/src/suricata.c b/src/suricata.c index d385b5b381..12458caf70 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -2312,12 +2312,6 @@ int main(int argc, char **argv) CudaVarsSetDeCtx(de_ctx); #endif /* __SC_CUDA_SUPPORT__ */ - SCClassConfLoadClassficationConfigFile(de_ctx); - SCRConfLoadReferenceConfigFile(de_ctx); - - if (ActionInitConfig() < 0) { - exit(EXIT_FAILURE); - } } else { /* disable raw reassembly */ (void)ConfSetFinal("stream.reassembly.raw", "false");