'auto' running mode does not support 'threads' var.

This patch modifies the RunModeSetLiveCaptureAuto() prototype to
be able to detect that a 'threads' variable (telling how much
threads must listen to one socket in IDS mode) has been used
in the configuration file. It then print a warning message
if this is the case.
remotes/origin/master-1.2.x
Eric Leblond 14 years ago committed by Victor Julien
parent 6f0ca120d1
commit 6c55af847b

@ -246,7 +246,9 @@ int RunModeIdsAFPAuto(DetectEngineCtx *de_ctx)
ConfGet("af-packet.live-interface", &live_dev); ConfGet("af-packet.live-interface", &live_dev);
ret = RunModeSetLiveCaptureAuto(de_ctx, ret = RunModeSetLiveCaptureAuto(de_ctx,
ParseAFPConfig, "ReceiveAFP", ParseAFPConfig,
AFPConfigGeThreadsCount,
"ReceiveAFP",
"DecodeAFP", "RecvAFP", "DecodeAFP", "RecvAFP",
live_dev); live_dev);
if (ret != 0) { if (ret != 0) {

@ -215,7 +215,9 @@ int RunModeIdsPcapAuto(DetectEngineCtx *de_ctx)
ConfGet("pcap.single_pcap_dev", &live_dev); ConfGet("pcap.single_pcap_dev", &live_dev);
ret = RunModeSetLiveCaptureAuto(de_ctx, ret = RunModeSetLiveCaptureAuto(de_ctx,
ParsePcapConfig, "ReceivePcap", ParsePcapConfig,
PcapConfigGeThreadsCount,
"ReceivePcap",
"DecodePcap", "RecvPcap", "DecodePcap", "RecvPcap",
live_dev); live_dev);
if (ret != 0) { if (ret != 0) {

@ -403,7 +403,8 @@ int RunModeIdsPfringAuto(DetectEngineCtx *de_ctx)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
ret = RunModeSetLiveCaptureAuto(de_ctx, tparser, "ReceivePfring", "DecodePfring", ret = RunModeSetLiveCaptureAuto(de_ctx, tparser, PfringConfigGeThreadsCount,
"ReceivePfring", "DecodePfring",
"RxPFR", live_dev); "RxPFR", live_dev);
if (ret != 0) { if (ret != 0) {
SCLogError(SC_ERR_RUNMODE, "Runmode start failed"); SCLogError(SC_ERR_RUNMODE, "Runmode start failed");

@ -50,7 +50,9 @@
#include "util-runmodes.h" #include "util-runmodes.h"
int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx, int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
ConfigIfaceParserFunc ConfigParser, char *recv_mod_name, ConfigIfaceParserFunc ConfigParser,
ConfigIfaceThreadsCountFunc ModThreadsCount,
char *recv_mod_name,
char *decode_mod_name, char *thread_name, char *decode_mod_name, char *thread_name,
const char *live_dev) const char *live_dev)
{ {
@ -71,6 +73,13 @@ int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (ModThreadsCount(aconf) > 1) {
SCLogWarning(SC_ERR_UNIMPLEMENTED, "'Auto' running mode does not honor 'threads'"
" variable (set on '%s'). Please use an other mode as"
" 'autofp' or 'worker'",
live_dev);
}
/* create the threads */ /* create the threads */
ThreadVars *tv_receive = ThreadVars *tv_receive =
TmThreadCreatePacketHandler(recv_mod_name, TmThreadCreatePacketHandler(recv_mod_name,
@ -115,6 +124,13 @@ int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (ModThreadsCount(aconf) > 1) {
SCLogWarning(SC_ERR_UNIMPLEMENTED, "'Auto' running mode does not honor 'threads'"
" variable (set on '%s'). Please use an other mode as"
" 'autofp' or 'worker'",
live_dev);
}
snprintf(tname, sizeof(tname),"%s-%s", thread_name, live_dev); snprintf(tname, sizeof(tname),"%s-%s", thread_name, live_dev);
tnamec = SCStrdup(tname); tnamec = SCStrdup(tname);
if (tnamec == NULL) { if (tnamec == NULL) {

@ -28,7 +28,9 @@ typedef void *(*ConfigIfaceParserFunc) (const char *);
typedef int (*ConfigIfaceThreadsCountFunc) (void *); typedef int (*ConfigIfaceThreadsCountFunc) (void *);
int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx, int RunModeSetLiveCaptureAuto(DetectEngineCtx *de_ctx,
ConfigIfaceParserFunc configparser, char *recv_mod_name, ConfigIfaceParserFunc configparser,
ConfigIfaceThreadsCountFunc ModThreadsCount,
char *recv_mod_name,
char *decode_mod_name, char *thread_name, char *decode_mod_name, char *thread_name,
const char *live_dev); const char *live_dev);

Loading…
Cancel
Save