|
|
|
@ -32,6 +32,8 @@
|
|
|
|
|
#include "runmode-af-packet.h"
|
|
|
|
|
#include "log-httplog.h"
|
|
|
|
|
#include "output.h"
|
|
|
|
|
|
|
|
|
|
#include "detect-engine.h"
|
|
|
|
|
#include "detect-engine-mpm.h"
|
|
|
|
|
|
|
|
|
|
#include "alert-fastlog.h"
|
|
|
|
@ -97,10 +99,8 @@ char *RunmodeAutoFpCreatePickupQueuesString(int n)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \param de_ctx detection engine, can be NULL
|
|
|
|
|
*/
|
|
|
|
|
int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
|
|
|
|
|
ConfigIfaceParserFunc ConfigParser,
|
|
|
|
|
int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
|
|
|
|
|
ConfigIfaceThreadsCountFunc ModThreadsCount,
|
|
|
|
|
char *recv_mod_name,
|
|
|
|
|
char *decode_mod_name, char *thread_name,
|
|
|
|
@ -275,14 +275,13 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
|
|
|
|
|
}
|
|
|
|
|
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
if (de_ctx != NULL) {
|
|
|
|
|
if (DetectEngineEnabled()) {
|
|
|
|
|
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);
|
|
|
|
|
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
|
|
|
|
@ -315,10 +314,8 @@ int RunModeSetLiveCaptureAutoFp(DetectEngineCtx *de_ctx,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \param de_ctx detection engine, can be NULL
|
|
|
|
|
*/
|
|
|
|
|
static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
|
|
|
|
|
ConfigIfaceThreadsCountFunc ModThreadsCount,
|
|
|
|
|
static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc ModThreadsCount,
|
|
|
|
|
char *recv_mod_name,
|
|
|
|
|
char *decode_mod_name, char *thread_name,
|
|
|
|
|
const char *live_dev, void *aconf,
|
|
|
|
@ -382,14 +379,13 @@ static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
|
|
|
|
|
}
|
|
|
|
|
TmSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
if (de_ctx != NULL) {
|
|
|
|
|
if (DetectEngineEnabled()) {
|
|
|
|
|
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);
|
|
|
|
|
TmSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("RespondReject");
|
|
|
|
@ -412,8 +408,7 @@ static int RunModeSetLiveCaptureWorkersForDevice(DetectEngineCtx *de_ctx,
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
|
|
|
|
|
ConfigIfaceParserFunc ConfigParser,
|
|
|
|
|
int RunModeSetLiveCaptureWorkers(ConfigIfaceParserFunc ConfigParser,
|
|
|
|
|
ConfigIfaceThreadsCountFunc ModThreadsCount,
|
|
|
|
|
char *recv_mod_name,
|
|
|
|
|
char *decode_mod_name, char *thread_name,
|
|
|
|
@ -436,8 +431,7 @@ int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
|
|
|
|
|
live_dev_c = LiveGetDeviceName(ldev);
|
|
|
|
|
aconf = ConfigParser(live_dev_c);
|
|
|
|
|
}
|
|
|
|
|
RunModeSetLiveCaptureWorkersForDevice(de_ctx,
|
|
|
|
|
ModThreadsCount,
|
|
|
|
|
RunModeSetLiveCaptureWorkersForDevice(ModThreadsCount,
|
|
|
|
|
recv_mod_name,
|
|
|
|
|
decode_mod_name,
|
|
|
|
|
thread_name,
|
|
|
|
@ -449,8 +443,7 @@ int RunModeSetLiveCaptureWorkers(DetectEngineCtx *de_ctx,
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
|
|
|
|
|
ConfigIfaceParserFunc ConfigParser,
|
|
|
|
|
int RunModeSetLiveCaptureSingle(ConfigIfaceParserFunc ConfigParser,
|
|
|
|
|
ConfigIfaceThreadsCountFunc ModThreadsCount,
|
|
|
|
|
char *recv_mod_name,
|
|
|
|
|
char *decode_mod_name, char *thread_name,
|
|
|
|
@ -473,7 +466,7 @@ int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
|
|
|
|
|
/* \todo Set threads number in config to 1 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RunModeSetLiveCaptureWorkersForDevice(de_ctx,
|
|
|
|
|
return RunModeSetLiveCaptureWorkersForDevice(
|
|
|
|
|
ModThreadsCount,
|
|
|
|
|
recv_mod_name,
|
|
|
|
|
decode_mod_name,
|
|
|
|
@ -485,10 +478,8 @@ int RunModeSetLiveCaptureSingle(DetectEngineCtx *de_ctx,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \param de_ctx detection engine, can be NULL
|
|
|
|
|
*/
|
|
|
|
|
int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
|
|
|
|
|
ConfigIPSParserFunc ConfigParser,
|
|
|
|
|
int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
|
|
|
|
|
char *recv_mod_name,
|
|
|
|
|
char *verdict_mod_name,
|
|
|
|
|
char *decode_mod_name)
|
|
|
|
@ -592,14 +583,13 @@ int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
|
|
|
|
|
}
|
|
|
|
|
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
if (de_ctx != NULL) {
|
|
|
|
|
if (DetectEngineEnabled()) {
|
|
|
|
|
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);
|
|
|
|
|
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
|
|
|
|
@ -665,10 +655,8 @@ int RunModeSetIPSAutoFp(DetectEngineCtx *de_ctx,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \param de_ctx detection engine, can be NULL
|
|
|
|
|
*/
|
|
|
|
|
int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
|
|
|
|
|
ConfigIPSParserFunc ConfigParser,
|
|
|
|
|
int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser,
|
|
|
|
|
char *recv_mod_name,
|
|
|
|
|
char *verdict_mod_name,
|
|
|
|
|
char *decode_mod_name)
|
|
|
|
@ -725,14 +713,13 @@ int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
|
|
|
|
|
}
|
|
|
|
|
TmSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
if (de_ctx != NULL) {
|
|
|
|
|
if (DetectEngineEnabled()) {
|
|
|
|
|
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);
|
|
|
|
|
TmSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName(verdict_mod_name);
|
|
|
|
@ -741,7 +728,7 @@ int RunModeSetIPSWorker(DetectEngineCtx *de_ctx,
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TmSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
|
|
|
|
|
TmSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("RespondReject");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|