]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
#482 - use decode_flag for all decode TMs. Use the flag as a way to retrieve decode...
authorAnoop Saldanha <poonaatsoc@gmail.com>
Sat, 16 Jun 2012 05:17:30 +0000 (10:47 +0530)
committerVictor Julien <victor@inliniac.net>
Wed, 20 Jun 2012 14:39:42 +0000 (16:39 +0200)
src/flow-timeout.c
src/source-af-packet.c
src/source-erf-dag.c
src/source-erf-file.c
src/source-ipfw.c
src/source-napatech.c
src/source-nfq.c
src/source-pcap-file.c
src/source-pcap.c
src/source-pfring.c
src/tm-modules.h

index 170eebb50bf89e01faa7baaf866ba0bd5fb429a4..e38eae4eb02df65f895e203f2bb5d423c5e9d444 100644 (file)
@@ -685,7 +685,27 @@ void FlowForceReassemblySetup(void)
         stream_pseudo_pkt_detect_TV = NULL;
     }
 
-    stream_pseudo_pkt_decode_tm_slot = TmThreadGetFirstTmSlotForPartialPattern("Decode");
+
+    SCMutexLock(&tv_root_lock);
+    ThreadVars *tv = tv_root[TVT_PPT];
+    int done = 0;
+    while (tv) {
+        TmSlot *slots = tv->tm_slots;
+        while (slots) {
+            TmModule *tm = TmModuleGetById(slots->tm_id);
+            if (tm->flags & TM_FLAG_DECODE_TM) {
+                done = 1;
+                stream_pseudo_pkt_decode_tm_slot = slots;
+                break;
+            }
+            slots = slots->slot_next;
+        }
+        if (done)
+            break;
+        tv = tv->next;
+    }
+    SCMutexUnlock(&tv_root_lock);
+
     if (stream_pseudo_pkt_decode_tm_slot == NULL) {
         /* yes, this is fatal! */
         SCLogError(SC_ERR_TM_MODULES_ERROR, "Looks like we have failed to "
index 9ffec71222bf91aeef2aa35b91d39c6eb2bbf625..1ce85ef93b3e2f256d4017aadf70349934b776fa 100644 (file)
@@ -106,6 +106,7 @@ void TmModuleDecodeAFPRegister (void) {
     tmm_modules[TMM_DECODEAFP].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEAFP].RegisterTests = NULL;
     tmm_modules[TMM_DECODEAFP].cap_flags = 0;
+    tmm_modules[TMM_DECODEAFP].flags = TM_FLAG_DECODE_TM;
 }
 
 /**
@@ -226,6 +227,7 @@ void TmModuleDecodeAFPRegister (void) {
     tmm_modules[TMM_DECODEAFP].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEAFP].RegisterTests = NULL;
     tmm_modules[TMM_DECODEAFP].cap_flags = 0;
+    tmm_modules[TMM_DECODEAFP].flags = TM_FLAG_DECODE_TM;
 }
 
 static int AFPCreateSocket(AFPThreadVars *ptv, char *devname, int verbose);
index e2c66a8575c1e7465bfd26e4f2215824721631a5..164135293e38365aa7f0b8542f4008d950428982 100644 (file)
@@ -56,6 +56,7 @@ void TmModuleDecodeErfDagRegister (void) {
     tmm_modules[TMM_DECODEERFDAG].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEERFDAG].RegisterTests = NULL;
     tmm_modules[TMM_DECODEERFDAG].cap_flags = 0;
+    tmm_modules[TMM_DECODEERFDAG].flags = TM_FLAG_DECODE_TM;
 }
 
 TmEcode NoErfDagSupportExit(ThreadVars *tv, void *initdata, void **data)
@@ -137,6 +138,7 @@ TmModuleDecodeErfDagRegister(void)
     tmm_modules[TMM_DECODEERFDAG].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEERFDAG].RegisterTests = NULL;
     tmm_modules[TMM_DECODEERFDAG].cap_flags = 0;
+    tmm_modules[TMM_DECODEERFDAG].flags = TM_FLAG_DECODE_TM;
 }
 
 /**
index f93afdfde4687a2e3ab9162ee6167e9081edaa11..f25917303a5a0f0031cf2c68f09411c23c48acd4 100644 (file)
@@ -101,6 +101,7 @@ TmModuleDecodeErfFileRegister(void)
     tmm_modules[TMM_DECODEERFFILE].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEERFFILE].RegisterTests = NULL;
     tmm_modules[TMM_DECODEERFFILE].cap_flags = 0;
+    tmm_modules[TMM_DECODEERFFILE].flags = TM_FLAG_DECODE_TM;
 }
 
 /**
index f81c79b1c060e013ea20196a3be02fa6c95feb02..1b94c1ce597815eb869d245962b4e46969d7efc3 100644 (file)
@@ -83,6 +83,7 @@ void TmModuleDecodeIPFWRegister (void) {
     tmm_modules[TMM_DECODEIPFW].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEIPFW].RegisterTests = NULL;
     tmm_modules[TMM_DECODEIPFW].cap_flags = 0;
+    tmm_modules[TMM_DECODEIPFW].flags = TM_FLAG_DECODE_TM;
 }
 
 TmEcode NoIPFWSupportExit(ThreadVars *tv, void *initdata, void **data) {
@@ -185,6 +186,7 @@ void TmModuleDecodeIPFWRegister (void) {
     tmm_modules[TMM_DECODEIPFW].ThreadExitPrintStats = NULL;
     tmm_modules[TMM_DECODEIPFW].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEIPFW].RegisterTests = NULL;
+    tmm_modules[TMM_DECODEIPFW].flags = TM_FLAG_DECODE_TM;
 }
 
 static inline void IPFWMutexInit(IPFWQueueVars *nq)
index 07d4e9ba9b6b711bf3c2a9959c31aa740f7d2f08..04c280fe5aa7f3c40a6d9313703001ed5a91b938 100644 (file)
@@ -60,6 +60,7 @@ void TmModuleNapatechDecodeRegister (void) {
     tmm_modules[TMM_DECODENAPATECH].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODENAPATECH].RegisterTests = NULL;
     tmm_modules[TMM_DECODENAPATECH].cap_flags = 0;
+    tmm_modules[TMM_DECODENAPATECH].flags = TM_FLAG_DECODE_TM;
 }
 
 TmEcode NoNapatechSupportExit(ThreadVars *tv, void *initdata, void **data)
@@ -127,6 +128,7 @@ void TmModuleNapatechDecodeRegister(void)
     tmm_modules[TMM_DECODENAPATECH].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODENAPATECH].RegisterTests = NULL;
     tmm_modules[TMM_DECODENAPATECH].cap_flags = 0;
+    tmm_modules[TMM_DECODENAPATECH].flags = TM_FLAG_DECODE_TM;
 }
 
 /**
index 8df666f588b7cea193d877dd31bbdb875db944b6..a9fd7c1d31cafc5c2e461b8e53c5d3cddf95ff65 100644 (file)
@@ -91,6 +91,7 @@ void TmModuleDecodeNFQRegister (void) {
     tmm_modules[TMM_DECODENFQ].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODENFQ].RegisterTests = NULL;
     tmm_modules[TMM_DECODENFQ].cap_flags = 0;
+    tmm_modules[TMM_DECODENFQ].flags = TM_FLAG_DECODE_TM;
 }
 
 TmEcode NoNFQSupportExit(ThreadVars *tv, void *initdata, void **data)
@@ -195,6 +196,7 @@ void TmModuleDecodeNFQRegister (void) {
     tmm_modules[TMM_DECODENFQ].ThreadExitPrintStats = NULL;
     tmm_modules[TMM_DECODENFQ].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODENFQ].RegisterTests = NULL;
+    tmm_modules[TMM_DECODENFQ].flags = TM_FLAG_DECODE_TM;
 }
 
 /** \brief          To initialize the NFQ global configuration data
index 3919fcdaf36987eb25babc0edbaf28a307fecf8d..aabb87d40a7361422b9317df72974c0b105e865b 100644 (file)
@@ -113,6 +113,7 @@ void TmModuleDecodePcapFileRegister (void) {
     tmm_modules[TMM_DECODEPCAPFILE].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEPCAPFILE].RegisterTests = NULL;
     tmm_modules[TMM_DECODEPCAPFILE].cap_flags = 0;
+    tmm_modules[TMM_DECODEPCAPFILE].flags = TM_FLAG_DECODE_TM;
 }
 
 void PcapFileCallbackLoop(char *user, struct pcap_pkthdr *h, u_char *pkt) {
index 93b31acab3e9410da59e6a8c71a177e630900989..dc47f9421ae363c14f3011379112d14dc7484a45 100644 (file)
@@ -133,6 +133,7 @@ void TmModuleDecodePcapRegister (void) {
     tmm_modules[TMM_DECODEPCAP].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEPCAP].RegisterTests = NULL;
     tmm_modules[TMM_DECODEPCAP].cap_flags = 0;
+    tmm_modules[TMM_DECODEPCAP].flags = TM_FLAG_DECODE_TM;
 }
 
 #if LIBPCAP_VERSION_MAJOR == 1
index 4457892b63195d979e647916f217147fc0bdd0fe..0aa862f3f78d3145d70eb9403e48ec16157939e3 100644 (file)
@@ -83,6 +83,7 @@ void TmModuleDecodePfringRegister (void) {
     tmm_modules[TMM_DECODEPFRING].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEPFRING].RegisterTests = NULL;
     tmm_modules[TMM_DECODEPFRING].cap_flags = 0;
+    tmm_modules[TMM_DECODEPFRING].flags = TM_FLAG_DECODE_TM;
 }
 
 /**
@@ -166,6 +167,7 @@ void TmModuleDecodePfringRegister (void) {
     tmm_modules[TMM_DECODEPFRING].ThreadExitPrintStats = NULL;
     tmm_modules[TMM_DECODEPFRING].ThreadDeinit = NULL;
     tmm_modules[TMM_DECODEPFRING].RegisterTests = NULL;
+    tmm_modules[TMM_DECODEPFRING].flags = TM_FLAG_DECODE_TM;
 }
 
 /**
index a244e26988287ed4ee60aa193a15e723153c4694..b547ab3b57eb01bd1c810e39a65df16dd9d7368d 100644 (file)
@@ -29,6 +29,7 @@
 
 /* thread flags */
 #define TM_FLAG_RECEIVE_TM      0x01
+#define TM_FLAG_DECODE_TM       0x02
 
 typedef struct TmModule_ {
     char *name;