From: Eric Leblond Date: Sat, 14 Aug 2021 21:05:03 +0000 (+0200) Subject: flow: more accurate flow counters X-Git-Tag: suricata-7.0.0-beta1~1482 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a4ef6b8fc290a83ad0d17c036d8a93b5c02689c;p=thirdparty%2Fsuricata.git flow: more accurate flow counters Don't increment the flow timeout counter for flows that are not really timeout (as use_cnt is non zero). And also don't take into account bypassed flows in the counter for flow timeout in use. --- diff --git a/src/flow-manager.c b/src/flow-manager.c index e1d8993556..40654f813e 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -392,20 +392,22 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *next_flow = f->next; - counters->flows_timeout++; - /* never prune a flow that is used by a packet we * are currently processing in one of the threads */ if (f->use_cnt > 0 || !FlowBypassedTimeout(f, ts, counters)) { FLOWLOCK_UNLOCK(f); prev_f = f; - counters->flows_timeout_inuse++; + if (f->use_cnt > 0) { + counters->flows_timeout_inuse++; + } f = f->next; continue; } f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT; + counters->flows_timeout++; + RemoveFromHash(f, prev_f); FlowQueuePrivateAppendFlow(&td->aside_queue, f);