From: Anoop Saldanha Date: Mon, 3 Dec 2012 18:28:53 +0000 (+0530) Subject: cleanup flowtimeout threadvars retrieval + X-Git-Tag: suricata-1.4~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b22a0cffbb50511087098e2a61fe81b770712655;p=thirdparty%2Fsuricata.git cleanup flowtimeout threadvars retrieval + throw back pseudo pkt back to packetpool inside flow timeout. --- diff --git a/src/flow-timeout.c b/src/flow-timeout.c index 710905a750..6ef218e4f5 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -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; } diff --git a/src/flow.c b/src/flow.c index 1806a2077f..11c7bc4370 100644 --- a/src/flow.c +++ b/src/flow.c @@ -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);