void PatternMatchThreadDestroy(MpmThreadCtx *mpm_thread_ctx, uint16_t mpm_matcher)
{
SCLogDebug("mpm_thread_ctx %p, mpm_matcher %"PRIu16"", mpm_thread_ctx, mpm_matcher);
- mpm_table[mpm_matcher].DestroyThreadCtx(NULL, mpm_thread_ctx);
+ if (mpm_table[mpm_matcher].DestroyThreadCtx != NULL)
+ mpm_table[mpm_matcher].DestroyThreadCtx(NULL, mpm_thread_ctx);
}
void PatternMatchThreadPrepare(MpmThreadCtx *mpm_thread_ctx, uint16_t mpm_matcher, uint32_t max_id)
{
SCReturn;
}
-DetectEngineCtx *DetectEngineCtxInit(void)
+static DetectEngineCtx *DetectEngineCtxInitReal(int minimal)
{
DetectEngineCtx *de_ctx;
memset(de_ctx,0,sizeof(DetectEngineCtx));
+ if (minimal) {
+ de_ctx->minimal = 1;
+ de_ctx->id = detect_engine_ctx_id++;
+ return de_ctx;
+ }
+
if (ConfGetBool("engine.init-failure-fatal", (int *)&(de_ctx->failure_fatal)) != 1) {
SCLogDebug("ConfGetBool could not load the value.");
}
goto error;
}
- de_ctx->id = detect_engine_ctx_id++;
-
/* init iprep... ignore errors for now */
(void)SRepInit(de_ctx);
goto error;
}
+ de_ctx->id = detect_engine_ctx_id++;
return de_ctx;
error:
return NULL;
+
+}
+
+DetectEngineCtx *DetectEngineCtxInitMinimal(void)
+{
+ return DetectEngineCtxInitReal(1);
+}
+
+DetectEngineCtx *DetectEngineCtxInit(void)
+{
+ return DetectEngineCtxInitReal(0);
}
static void DetectEngineCtxFreeThreadKeywordData(DetectEngineCtx *de_ctx)
#endif
}
- if (ThreadCtxDoInit(det_ctx->de_ctx, det_ctx) != TM_ECODE_OK) {
- DetectEngineThreadCtxDeinit(tv, det_ctx);
- return TM_ECODE_FAILED;
+ if (det_ctx->de_ctx->minimal == 0) {
+ if (ThreadCtxDoInit(det_ctx->de_ctx, det_ctx) != TM_ECODE_OK) {
+ DetectEngineThreadCtxDeinit(tv, det_ctx);
+ return TM_ECODE_FAILED;
+ }
}
/** alert counter setup */
void DetectEngineRegisterAppInspectionEngines(void);
void DetectEngineSpawnLiveRuleSwapMgmtThread(void);
DetectEngineCtx *DetectEngineCtxInit(void);
+DetectEngineCtx *DetectEngineCtxInitMinimal(void);
void DetectEngineCtxFree(DetectEngineCtx *);
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **);
struct SCProfileKeywordDetectCtx_ *profile_keyword_ctx_per_list[DETECT_SM_LIST_MAX];
#endif
+ /** minimal: essentially a stub */
+ int minimal;
+
/** how many de_ctx' are referencing this */
uint32_t ref_cnt;
/** list in master: either active or freelist */
DetectEngineCtx *de_ctx = NULL;
if (!suri.disabled_detect) {
- de_ctx = DetectEngineCtxInit();
+ SetupDelayedDetect(&suri);
+ if (!suri.delayed_detect) {
+ de_ctx = DetectEngineCtxInit();
+ } else {
+ de_ctx = DetectEngineCtxInitMinimal();
+ }
if (de_ctx == NULL) {
SCLogError(SC_ERR_INITIALIZATION, "initializing detection engine "
"context failed.");
CudaVarsSetDeCtx(de_ctx);
#endif /* __SC_CUDA_SUPPORT__ */
- SetupDelayedDetect(&suri);
if (!suri.delayed_detect) {
if (LoadSignatures(de_ctx, &suri) != TM_ECODE_OK)
exit(EXIT_FAILURE);