|
|
|
@ -40,7 +40,8 @@
|
|
|
|
|
/**
|
|
|
|
|
* \brief Single thread version of the Pcap file processing.
|
|
|
|
|
*/
|
|
|
|
|
int RunModeFilePcap2(DetectEngineCtx *de_ctx) {
|
|
|
|
|
int RunModeFilePcap2(DetectEngineCtx *de_ctx)
|
|
|
|
|
{
|
|
|
|
|
char *file = NULL;
|
|
|
|
|
if (ConfGet("runmode_pcap_file.file", &file) == 0) {
|
|
|
|
|
SCLogError(SC_ERR_RUNMODE, "Failed retrieving pcap_file from Conf");
|
|
|
|
@ -51,7 +52,10 @@ int RunModeFilePcap2(DetectEngineCtx *de_ctx) {
|
|
|
|
|
TimeModeSetOffline();
|
|
|
|
|
|
|
|
|
|
/* create the threads */
|
|
|
|
|
ThreadVars *tv = TmThreadCreatePacketHandler("PcapFile","packetpool","packetpool","packetpool","packetpool","varslot");
|
|
|
|
|
ThreadVars *tv = TmThreadCreatePacketHandler("PcapFile",
|
|
|
|
|
"packetpool", "packetpool",
|
|
|
|
|
"packetpool","packetpool",
|
|
|
|
|
"varslot");
|
|
|
|
|
if (tv == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -62,28 +66,28 @@ int RunModeFilePcap2(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName failed for ReceivePcap\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv,tm_module,file);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv, tm_module, file);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("DecodePcapFile");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName DecodePcap failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("StreamTcp");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName StreamTcp failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("Detect");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName Detect failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv,tm_module,(void *)de_ctx);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv, tm_module, (void *)de_ctx);
|
|
|
|
|
|
|
|
|
|
SetupOutputs(tv);
|
|
|
|
|
|
|
|
|
@ -105,15 +109,15 @@ int RunModeFilePcap2(DetectEngineCtx *de_ctx) {
|
|
|
|
|
* starting from the second cpu available.
|
|
|
|
|
* - Outputs thread
|
|
|
|
|
* By default the threads will use the first cpu available
|
|
|
|
|
* except the Detection threads if we have more than one cpu
|
|
|
|
|
* except the Detection threads if we have more than one cpu.
|
|
|
|
|
*
|
|
|
|
|
* \param de_ctx pointer to the Detection Engine
|
|
|
|
|
* \param file pointer to the name of the file from which we will fetch
|
|
|
|
|
* the packets
|
|
|
|
|
* \retval 0 if all goes well. (If any problem is detected the engine will
|
|
|
|
|
* exit())
|
|
|
|
|
* \param de_ctx Pointer to the Detection Engine.
|
|
|
|
|
*
|
|
|
|
|
* \retval 0 If all goes well. (If any problem is detected the engine will
|
|
|
|
|
* exit()).
|
|
|
|
|
*/
|
|
|
|
|
int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
int RunModeFilePcapAuto(DetectEngineCtx *de_ctx)
|
|
|
|
|
{
|
|
|
|
|
SCEnter();
|
|
|
|
|
char tname[16];
|
|
|
|
|
uint16_t cpu = 0;
|
|
|
|
@ -133,8 +137,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
TimeModeSetOffline();
|
|
|
|
|
|
|
|
|
|
/* create the threads */
|
|
|
|
|
//ThreadVars *tv_receivepcap = TmThreadCreatePacketHandler("ReceivePcapFile","packetpool","packetpool","packetpool","packetpool","1slot");
|
|
|
|
|
ThreadVars *tv_receivepcap = TmThreadCreatePacketHandler("ReceivePcapFile","packetpool","packetpool","pickup-queue","simple","1slot");
|
|
|
|
|
ThreadVars *tv_receivepcap =
|
|
|
|
|
TmThreadCreatePacketHandler("ReceivePcapFile",
|
|
|
|
|
"packetpool", "packetpool",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
|
if (tv_receivepcap == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -144,7 +151,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName failed for ReceivePcap\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
Tm1SlotSetFunc(tv_receivepcap,tm_module,file);
|
|
|
|
|
Tm1SlotSetFunc(tv_receivepcap, tm_module, file);
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_receivepcap, RECEIVE_CPU_SET);
|
|
|
|
|
|
|
|
|
@ -155,10 +162,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
|
|
|
|
|
#if defined(__SC_CUDA_SUPPORT__)
|
|
|
|
|
if (PatternMatchDefaultMatcher() == MPM_B2G_CUDA) {
|
|
|
|
|
ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"decode-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
|
ThreadVars *tv_decode1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Decode",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"decode-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
|
if (tv_decode1 == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed for Decode1\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -177,10 +185,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_cuda_PB = TmThreadCreate("CUDA_PB",
|
|
|
|
|
"decode-queue1", "simple",
|
|
|
|
|
"cuda-pb-queue1", "simple",
|
|
|
|
|
"custom", SCCudaPBTmThreadsSlot1, 0);
|
|
|
|
|
ThreadVars *tv_cuda_PB =
|
|
|
|
|
TmThreadCreate("CUDA_PB",
|
|
|
|
|
"decode-queue1", "simple",
|
|
|
|
|
"cuda-pb-queue1", "simple",
|
|
|
|
|
"custom", SCCudaPBTmThreadsSlot1, 0);
|
|
|
|
|
if (tv_cuda_PB == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed for CUDA_PB\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -201,10 +210,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_stream1 = TmThreadCreatePacketHandler("Stream1",
|
|
|
|
|
"cuda-pb-queue1", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
|
ThreadVars *tv_stream1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Stream1",
|
|
|
|
|
"cuda-pb-queue1", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
|
if (tv_stream1 == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed for Stream1\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -214,7 +224,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName StreamTcp failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
Tm1SlotSetFunc(tv_stream1,tm_module,NULL);
|
|
|
|
|
Tm1SlotSetFunc(tv_stream1, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_stream1, STREAM_CPU_SET);
|
|
|
|
|
|
|
|
|
@ -223,10 +233,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode & Stream",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"varslot");
|
|
|
|
|
ThreadVars *tv_decode1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Decode & Stream",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"varslot");
|
|
|
|
|
if (tv_decode1 == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed for Decode1\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -236,14 +247,14 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName DecodePcap failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("StreamTcp");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName StreamTcp failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_decode1, DECODE_CPU_SET);
|
|
|
|
|
|
|
|
|
@ -252,10 +263,13 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
//#if 0
|
|
|
|
|
//ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode & Stream","pickup-queue","simple","packetpool","packetpool","varslot");
|
|
|
|
|
ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode & Stream","pickup-queue","simple","stream-queue1","simple","varslot");
|
|
|
|
|
ThreadVars *tv_decode1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Decode & Stream",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"varslot");
|
|
|
|
|
if (tv_decode1 == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed for Decode1\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -265,14 +279,14 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName DecodePcap failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("StreamTcp");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName StreamTcp failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_decode1, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_decode1, DECODE_CPU_SET);
|
|
|
|
|
|
|
|
|
@ -280,8 +294,8 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmThreadSpawn failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
//#if 0
|
|
|
|
|
/* start with cpu 1 so that if we're creating an odd number of detect
|
|
|
|
|
* threads we're not creating the most on CPU0. */
|
|
|
|
|
if (ncpus > 0)
|
|
|
|
@ -296,14 +310,18 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
|
|
|
|
|
int thread;
|
|
|
|
|
for (thread = 0; thread < thread_max; thread++) {
|
|
|
|
|
snprintf(tname, sizeof(tname),"Detect%"PRIu16, thread+1);
|
|
|
|
|
snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
|
|
|
|
|
if (tname == NULL)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
char *thread_name = SCStrdup(tname);
|
|
|
|
|
SCLogDebug("Assigning %s affinity to cpu %u", thread_name, cpu);
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_detect_ncpu = TmThreadCreatePacketHandler(thread_name,"stream-queue1","simple","alert-queue1","simple","1slot");
|
|
|
|
|
ThreadVars *tv_detect_ncpu =
|
|
|
|
|
TmThreadCreatePacketHandler(thread_name,
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"alert-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
|
if (tv_detect_ncpu == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -313,7 +331,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName Detect failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
Tm1SlotSetFunc(tv_detect_ncpu,tm_module,(void *)de_ctx);
|
|
|
|
|
Tm1SlotSetFunc(tv_detect_ncpu, tm_module, (void *)de_ctx);
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_detect_ncpu, DETECT_CPU_SET);
|
|
|
|
|
|
|
|
|
@ -335,8 +353,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
cpu++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_outputs = TmThreadCreatePacketHandler("Outputs",
|
|
|
|
|
"alert-queue1", "simple", "packetpool", "packetpool", "varslot");
|
|
|
|
|
ThreadVars *tv_outputs =
|
|
|
|
|
TmThreadCreatePacketHandler("Outputs",
|
|
|
|
|
"alert-queue1", "simple",
|
|
|
|
|
"packetpool", "packetpool",
|
|
|
|
|
"varslot");
|
|
|
|
|
SetupOutputs(tv_outputs);
|
|
|
|
|
|
|
|
|
|
TmThreadSetCPU(tv_outputs, OUTPUT_CPU_SET);
|
|
|
|
@ -345,7 +366,7 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmThreadSpawn failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
//#endif
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -359,15 +380,15 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
* starting from the second cpu available.
|
|
|
|
|
* - Outputs thread
|
|
|
|
|
* By default the threads will use the first cpu available
|
|
|
|
|
* except the Detection threads if we have more than one cpu
|
|
|
|
|
* except the Detection threads if we have more than one cpu.
|
|
|
|
|
*
|
|
|
|
|
* \param de_ctx Pointer to the Detection Engine
|
|
|
|
|
*
|
|
|
|
|
* \param de_ctx pointer to the Detection Engine
|
|
|
|
|
* \param file pointer to the name of the file from which we will fetch
|
|
|
|
|
* the packets
|
|
|
|
|
* \retval 0 if all goes well. (If any problem is detected the engine will
|
|
|
|
|
* exit())
|
|
|
|
|
* \retval 0 If all goes well. (If any problem is detected the engine will
|
|
|
|
|
* exit()).
|
|
|
|
|
*/
|
|
|
|
|
int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx)
|
|
|
|
|
{
|
|
|
|
|
SCEnter();
|
|
|
|
|
char tname[12];
|
|
|
|
|
char qname[12];
|
|
|
|
@ -396,7 +417,7 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
if (strlen(queues) > 0)
|
|
|
|
|
strlcat(queues, ",", sizeof(queues));
|
|
|
|
|
|
|
|
|
|
snprintf(qname, sizeof(qname),"pickup%"PRIu16, thread+1);
|
|
|
|
|
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
|
|
|
|
|
strlcat(queues, qname, sizeof(queues));
|
|
|
|
|
}
|
|
|
|
|
printf("queues %s\n", queues);
|
|
|
|
@ -411,7 +432,11 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
TimeModeSetOffline();
|
|
|
|
|
|
|
|
|
|
/* create the threads */
|
|
|
|
|
ThreadVars *tv_receivepcap = TmThreadCreatePacketHandler("ReceivePcapFile","packetpool","packetpool",queues,"flow","varslot");
|
|
|
|
|
ThreadVars *tv_receivepcap =
|
|
|
|
|
TmThreadCreatePacketHandler("ReceivePcapFile",
|
|
|
|
|
"packetpool", "packetpool",
|
|
|
|
|
queues, "flow",
|
|
|
|
|
"varslot");
|
|
|
|
|
if (tv_receivepcap == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -421,14 +446,14 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName failed for ReceivePcap\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_receivepcap,tm_module,file);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_receivepcap, tm_module, file);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("DecodePcapFile");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName DecodePcap failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_receivepcap,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_receivepcap, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
if (threading_set_cpu_affinity) {
|
|
|
|
|
TmThreadSetCPUAffinity(tv_receivepcap, 0);
|
|
|
|
@ -442,16 +467,19 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (thread = 0; thread < thread_max; thread++) {
|
|
|
|
|
snprintf(tname, sizeof(tname),"Detect%"PRIu16, thread+1);
|
|
|
|
|
snprintf(qname, sizeof(qname),"pickup%"PRIu16, thread+1);
|
|
|
|
|
snprintf(tname, sizeof(tname), "Detect%"PRIu16, thread+1);
|
|
|
|
|
snprintf(qname, sizeof(qname), "pickup%"PRIu16, thread+1);
|
|
|
|
|
|
|
|
|
|
printf("tname %s, qname %s\n", tname, qname);
|
|
|
|
|
|
|
|
|
|
char *thread_name = SCStrdup(tname);
|
|
|
|
|
SCLogDebug("Assigning %s affinity to cpu %u", thread_name, cpu);
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_detect_ncpu = TmThreadCreatePacketHandler(thread_name, qname, "flow","packetpool","packetpool","varslot");
|
|
|
|
|
//ThreadVars *tv_detect_ncpu = TmThreadCreatePacketHandler(thread_name, qname, "flow","alert-queue1","simple","varslot");
|
|
|
|
|
ThreadVars *tv_detect_ncpu =
|
|
|
|
|
TmThreadCreatePacketHandler(thread_name,
|
|
|
|
|
qname, "flow",
|
|
|
|
|
"packetpool", "packetpool",
|
|
|
|
|
"varslot");
|
|
|
|
|
if (tv_detect_ncpu == NULL) {
|
|
|
|
|
printf("ERROR: TmThreadsCreate failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
@ -461,14 +489,14 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName StreamTcp failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_detect_ncpu,tm_module,NULL);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
|
|
|
|
|
|
|
|
|
|
tm_module = TmModuleGetByName("Detect");
|
|
|
|
|
if (tm_module == NULL) {
|
|
|
|
|
printf("ERROR: TmModuleGetByName Detect failed\n");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_detect_ncpu,tm_module,(void *)de_ctx);
|
|
|
|
|
TmVarSlotSetFuncAppend(tv_detect_ncpu, tm_module, (void *)de_ctx);
|
|
|
|
|
|
|
|
|
|
if (threading_set_cpu_affinity) {
|
|
|
|
|
TmThreadSetCPUAffinity(tv_detect_ncpu, (int)cpu);
|
|
|
|
|