|
|
|
@ -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);
|
|
|
|
@ -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 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 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);
|
|
|
|
@ -155,7 +162,8 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
|
|
|
|
|
#if defined(__SC_CUDA_SUPPORT__)
|
|
|
|
|
if (PatternMatchDefaultMatcher() == MPM_B2G_CUDA) {
|
|
|
|
|
ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode",
|
|
|
|
|
ThreadVars *tv_decode1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Decode",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"decode-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
@ -177,7 +185,8 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_cuda_PB = TmThreadCreate("CUDA_PB",
|
|
|
|
|
ThreadVars *tv_cuda_PB =
|
|
|
|
|
TmThreadCreate("CUDA_PB",
|
|
|
|
|
"decode-queue1", "simple",
|
|
|
|
|
"cuda-pb-queue1", "simple",
|
|
|
|
|
"custom", SCCudaPBTmThreadsSlot1, 0);
|
|
|
|
@ -201,7 +210,8 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadVars *tv_stream1 = TmThreadCreatePacketHandler("Stream1",
|
|
|
|
|
ThreadVars *tv_stream1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Stream1",
|
|
|
|
|
"cuda-pb-queue1", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"1slot");
|
|
|
|
@ -223,7 +233,8 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ThreadVars *tv_decode1 = TmThreadCreatePacketHandler("Decode & Stream",
|
|
|
|
|
ThreadVars *tv_decode1 =
|
|
|
|
|
TmThreadCreatePacketHandler("Decode & Stream",
|
|
|
|
|
"pickup-queue", "simple",
|
|
|
|
|
"stream-queue1", "simple",
|
|
|
|
|
"varslot");
|
|
|
|
@ -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);
|
|
|
|
@ -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)
|
|
|
|
@ -303,7 +317,11 @@ int RunModeFilePcapAuto(DetectEngineCtx *de_ctx) {
|
|
|
|
|
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);
|
|
|
|
@ -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];
|
|
|
|
@ -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);
|
|
|
|
@ -450,8 +475,11 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) {
|
|
|
|
|
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);
|
|
|
|
|