}
TmSlotSetFuncAppend(tv, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- printf("ERROR: TmModuleGetByName Detect failed\n");
- exit(EXIT_FAILURE);
+ if (de_ctx != NULL) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ printf("ERROR: TmModuleGetByName Detect failed\n");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
}
- TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
SetupOutputs(tv);
}
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- printf("ERROR: TmModuleGetByName Detect failed\n");
- exit(EXIT_FAILURE);
+ if (de_ctx != NULL) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ printf("ERROR: TmModuleGetByName Detect failed\n");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
}
- TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
if (threading_set_cpu_affinity) {
TmThreadSetCPUAffinity(tv_detect_ncpu, (int)cpu);
}
TmSlotSetFuncAppend(tv, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
- exit(EXIT_FAILURE);
+ if (de_ctx) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
}
- TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
SetupOutputs(tv);
TmModule *tm_module;
RunModeInitialize();
+ if (de_ctx == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "can't mix runmode 'auto' and disabled detect");
+ return -1;
+ }
+
/* Available cpus */
uint16_t ncpus = UtilCpuGetNumProcessorsOnline();
}
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
- exit(EXIT_FAILURE);
+ if (de_ctx) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
}
- TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
-
char *thread_group_name = SCStrdup("Detect");
if (unlikely(thread_group_name == NULL)) {
char tname[TM_THREAD_NAME_MAX];
int thread;
+ if (de_ctx == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "can't use runmode 'auto' when detection is disabled");
+ return -1;
+ }
+
if ((nlive <= 1) && (live_dev != NULL)) {
void *aconf;
SCLogDebug("live_dev %s", live_dev);
return queues;
}
+/**
+ * \param de_ctx detection engine, can be NULL
+ */
int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
ConfigIfaceParserFunc ConfigParser,
ConfigIfaceThreadsCountFunc ModThreadsCount,
}
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
- exit(EXIT_FAILURE);
+ if (de_ctx != NULL) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppendDelayed(tv_detect_ncpu, tm_module,
+ (void *)de_ctx, de_ctx->delayed_detect);
}
- TmSlotSetFuncAppendDelayed(tv_detect_ncpu, tm_module,
- (void *)de_ctx, de_ctx->delayed_detect);
TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
return 0;
}
+/**
+ * \param de_ctx detection engine, can be NULL
+ */
static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
ConfigIfaceThreadsCountFunc ModThreadsCount,
char *recv_mod_name,
}
TmSlotSetFuncAppend(tv, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
- exit(EXIT_FAILURE);
+ if (de_ctx != NULL) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppendDelayed(tv, tm_module,
+ (void *)de_ctx, de_ctx->delayed_detect);
}
- TmSlotSetFuncAppendDelayed(tv, tm_module,
- (void *)de_ctx, de_ctx->delayed_detect);
tm_module = TmModuleGetByName("RespondReject");
if (tm_module == NULL) {
uint16_t ncpus = UtilCpuGetNumProcessorsOnline();
int nqueue = LiveGetDeviceCount();
+ if (de_ctx == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "can't use runmode 'auto' when detection is disabled");
+ return -1;
+ }
+
for (int i = 0; i < nqueue; i++) {
/* create the threads */
cur_queue = LiveGetDeviceName(i);
}
+/**
+ * \param de_ctx detection engine, can be NULL
+ */
int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
ConfigIPSParserFunc ConfigParser,
char *recv_mod_name,
}
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
- exit(EXIT_FAILURE);
+ if (de_ctx != NULL) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppendDelayed(tv_detect_ncpu, tm_module,
+ (void *)de_ctx, de_ctx->delayed_detect);
}
- TmSlotSetFuncAppendDelayed(tv_detect_ncpu, tm_module,
- (void *)de_ctx, de_ctx->delayed_detect);
TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
return 0;
}
+/**
+ * \param de_ctx detection engine, can be NULL
+ */
int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
ConfigIPSParserFunc ConfigParser,
char *recv_mod_name,
}
TmSlotSetFuncAppend(tv, tm_module, NULL);
- tm_module = TmModuleGetByName("Detect");
- if (tm_module == NULL) {
- SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
- exit(EXIT_FAILURE);
+ if (de_ctx != NULL) {
+ tm_module = TmModuleGetByName("Detect");
+ if (tm_module == NULL) {
+ SCLogError(SC_ERR_RUNMODE, "TmModuleGetByName Detect failed");
+ exit(EXIT_FAILURE);
+ }
+ TmSlotSetFuncAppendDelayed(tv, tm_module,
+ (void *)de_ctx, de_ctx->delayed_detect);
}
- TmSlotSetFuncAppendDelayed(tv, tm_module,
- (void *)de_ctx, de_ctx->delayed_detect);
tm_module = TmModuleGetByName(verdict_mod_name);
if (tm_module == NULL) {