diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 834e01d148..b6bae28ada 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -86,6 +86,7 @@ void TmModuleReceiveAFPRegister (void) { tmm_modules[TMM_RECEIVEAFP].ThreadDeinit = NULL; tmm_modules[TMM_RECEIVEAFP].RegisterTests = NULL; tmm_modules[TMM_RECEIVEAFP].cap_flags = 0; + tmm_modules[TMM_RECEIVEAFP].flags = TM_FLAG_RECEIVE_TM; } /** diff --git a/src/source-erf-dag.c b/src/source-erf-dag.c index 4f5826f1b4..2b04cbacdd 100644 --- a/src/source-erf-dag.c +++ b/src/source-erf-dag.c @@ -45,6 +45,7 @@ void TmModuleReceiveErfDagRegister (void) { tmm_modules[TMM_RECEIVEERFDAG].ThreadDeinit = NULL; tmm_modules[TMM_RECEIVEERFDAG].RegisterTests = NULL; tmm_modules[TMM_RECEIVEERFDAG].cap_flags = SC_CAP_NET_ADMIN; + tmm_modules[TMM_RECEIVEERFDAG].flags = TM_FLAG_RECEIVE_TM; } void TmModuleDecodeErfDagRegister (void) { diff --git a/src/source-erf-file.c b/src/source-erf-file.c index 2beea25151..7bb0dd26c8 100644 --- a/src/source-erf-file.c +++ b/src/source-erf-file.c @@ -81,6 +81,7 @@ TmModuleReceiveErfFileRegister(void) tmm_modules[TMM_RECEIVEERFFILE].ThreadDeinit = NULL; tmm_modules[TMM_RECEIVEERFFILE].RegisterTests = NULL; tmm_modules[TMM_RECEIVEERFFILE].cap_flags = 0; + tmm_modules[TMM_RECEIVEERFFILE].flags = TM_FLAG_RECEIVE_TM; } /** diff --git a/src/source-ipfw.c b/src/source-ipfw.c index 88b236c6c9..337dabc3d3 100644 --- a/src/source-ipfw.c +++ b/src/source-ipfw.c @@ -61,6 +61,7 @@ void TmModuleReceiveIPFWRegister (void) { tmm_modules[TMM_RECEIVEIPFW].RegisterTests = NULL; tmm_modules[TMM_RECEIVEIPFW].cap_flags = SC_CAP_NET_ADMIN | SC_CAP_NET_RAW | SC_CAP_NET_BIND_SERVICE | SC_CAP_NET_BROADCAST; /** \todo untested */ + tmm_modules[TMM_RECEIVEIPFW].flags = TM_FLAG_RECEIVE_TM; } void TmModuleVerdictIPFWRegister (void) { diff --git a/src/source-nfq.c b/src/source-nfq.c index a4e295749a..408b13255b 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -65,6 +65,7 @@ void TmModuleReceiveNFQRegister (void) { tmm_modules[TMM_RECEIVENFQ].ThreadDeinit = NULL; tmm_modules[TMM_RECEIVENFQ].RegisterTests = NULL; tmm_modules[TMM_RECEIVENFQ].cap_flags = SC_CAP_NET_ADMIN; + tmm_modules[TMM_RECEIVENFQ].flags = TM_FLAG_RECEIVE_TM; } void TmModuleVerdictNFQRegister (void) { diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index 15ed1406de..5d78b2a424 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -97,6 +97,7 @@ void TmModuleReceivePcapFileRegister (void) { tmm_modules[TMM_RECEIVEPCAPFILE].ThreadDeinit = NULL; tmm_modules[TMM_RECEIVEPCAPFILE].RegisterTests = NULL; tmm_modules[TMM_RECEIVEPCAPFILE].cap_flags = 0; + tmm_modules[TMM_RECEIVEPCAPFILE].flags = TM_FLAG_RECEIVE_TM; } void TmModuleDecodePcapFileRegister (void) { diff --git a/src/source-pcap.c b/src/source-pcap.c index 64c9b2bea9..198f538f23 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -107,6 +107,7 @@ void TmModuleReceivePcapRegister (void) { tmm_modules[TMM_RECEIVEPCAP].ThreadDeinit = NULL; tmm_modules[TMM_RECEIVEPCAP].RegisterTests = NULL; tmm_modules[TMM_RECEIVEPCAP].cap_flags = SC_CAP_NET_RAW; + tmm_modules[TMM_RECEIVEPCAP].flags = TM_FLAG_RECEIVE_TM; } /** diff --git a/src/source-pfring.c b/src/source-pfring.c index 687e187a44..e532d10b76 100644 --- a/src/source-pfring.c +++ b/src/source-pfring.c @@ -69,6 +69,7 @@ void TmModuleReceivePfringRegister (void) { tmm_modules[TMM_RECEIVEPFRING].RegisterTests = NULL; tmm_modules[TMM_RECEIVEPFRING].cap_flags = SC_CAP_NET_ADMIN | SC_CAP_NET_RAW | SC_CAP_NET_BIND_SERVICE | SC_CAP_NET_BROADCAST; + tmm_modules[TMM_RECEIVEPFRING].flags = TM_FLAG_RECEIVE_TM; } void TmModuleDecodePfringRegister (void) { diff --git a/src/tm-modules.h b/src/tm-modules.h index 8c09a36e5d..79ac5cb116 100644 --- a/src/tm-modules.h +++ b/src/tm-modules.h @@ -27,6 +27,9 @@ #include "tm-threads-common.h" #include "threadvars.h" +/* thread flags */ +#define TM_FLAG_RECEIVE_TM 0x01 + typedef struct TmModule_ { char *name; @@ -44,6 +47,8 @@ typedef struct TmModule_ { uint8_t cap_flags; /**< Flags to indicate the capability requierment of the given TmModule */ + /* Other flags used by the module */ + uint8_t flags; } TmModule; TmModule tmm_modules[TMM_SIZE]; diff --git a/src/tm-threads.c b/src/tm-threads.c index 5d7d9068e9..264c073067 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -1444,11 +1444,10 @@ void TmThreadDisableReceiveThreads(void) TmSlot *slots = tv->tm_slots; TmModule *tm = TmModuleGetById(slots->tm_id); - /* Kind of a hack. All packet_acquire/receive TMs in our engine - * have the string "receive" as a substring in their name */ - char *found = strcasestr(tm->name, "receive"); - if (found == NULL) - break; + if (!tm->flags & TM_FLAG_RECEIVE_TM) { + tv = tv->next; + continue; + } /* we found our receive TV. Send it a KILL signal. This is all * we need to do to kill receive threads */