]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
cleanup flowtimeout threadvars retrieval +
authorAnoop Saldanha <anoopsaldanha@gmail.com>
Mon, 3 Dec 2012 18:28:53 +0000 (23:58 +0530)
committerVictor Julien <victor@inliniac.net>
Wed, 5 Dec 2012 17:31:31 +0000 (18:31 +0100)
throw back pseudo pkt back to packetpool inside flow timeout.

src/flow-timeout.c
src/flow.c

index 710905a7508b7b9e825221362479a9ddad2cc373..6ef218e4f5fdd42f2e0ae657045a6802b7703ae5 100644 (file)
@@ -537,6 +537,7 @@ static inline void FlowForceReassemblyForHash(void)
                 StreamTcpReassembleHandleSegment(stream_pseudo_pkt_stream_TV,
                         stt->ra_ctx, ssn, &ssn->server,
                         reassemble_p, NULL);
+                FlowDeReference(&reassemble_p->flow);
                 if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
                     SCLogDebug("shutdown flow timeout "
                                "StreamTcpReassembleProcessAppLayer() erroring "
@@ -554,6 +555,7 @@ static inline void FlowForceReassemblyForHash(void)
                 StreamTcpReassembleHandleSegment(stream_pseudo_pkt_stream_TV,
                         stt->ra_ctx, ssn, &ssn->client,
                         reassemble_p, NULL);
+                FlowDeReference(&reassemble_p->flow);
                 if (StreamTcpReassembleProcessAppLayer(stt->ra_ctx) < 0) {
                     SCLogDebug("shutdown flow timeout "
                                "StreamTcpReassembleProcessAppLayer() erroring "
@@ -597,6 +599,8 @@ static inline void FlowForceReassemblyForHash(void)
                     if (stream_pseudo_pkt_detect_TV != NULL) {
                         stream_pseudo_pkt_detect_TV->
                             tmqh_out(stream_pseudo_pkt_detect_TV, p);
+                    } else {
+                        TmqhOutputPacketpool(NULL, p);
                     }
                 }
             } /* if (ssn->client.seg_list != NULL) */
@@ -628,6 +632,8 @@ static inline void FlowForceReassemblyForHash(void)
                     if (stream_pseudo_pkt_detect_TV != NULL) {
                         stream_pseudo_pkt_detect_TV->
                             tmqh_out(stream_pseudo_pkt_detect_TV, p);
+                    } else {
+                        TmqhOutputPacketpool(NULL, p);
                     }
                 }
             } /* if (ssn->server.seg_list != NULL) */
@@ -727,7 +733,7 @@ void FlowForceReassemblySetup(void)
     if (stream_pseudo_pkt_detect_TV->tm_slots == stream_pseudo_pkt_detect_tm_slot) {
         stream_pseudo_pkt_detect_prev_TV = stream_pseudo_pkt_detect_TV->prev;
     }
-    if (stream_pseudo_pkt_detect_TV->next == NULL) {
+    if (strcasecmp(stream_pseudo_pkt_detect_TV->outqh_name, "packetpool") == 0) {
         stream_pseudo_pkt_detect_TV = NULL;
     }
 
index 1806a2077f5660addd5d840ce1aa2488f2b851e4..11c7bc437070419c6578c45e13cd206f7f3f5208 100644 (file)
@@ -474,6 +474,7 @@ void FlowShutdown(void)
         for (u = 0; u < flow_config.hash_size; u++) {
             Flow *f = flow_hash[u].head;
             while (f) {
+                BUG_ON(SC_ATOMIC_GET(f->use_cnt) != 0);
                 Flow *n = f->hnext;
                 uint8_t proto_map = FlowGetProtoMapping(f->proto);
                 FlowClearMemory(f, proto_map);