From: Shivani Bhardwaj Date: Fri, 21 Jun 2024 08:12:24 +0000 (+0530) Subject: flow/manager: make fn calls only when necessary X-Git-Tag: suricata-8.0.0-beta1~1117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00a644c5c2d66a7f5000ce62ffdd068b88f5d1a8;p=thirdparty%2Fsuricata.git flow/manager: make fn calls only when necessary --- diff --git a/src/flow-manager.c b/src/flow-manager.c index e085fffa6b..5eeeca15c9 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -196,6 +196,7 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons return true; } +#ifdef CAPTURE_OFFLOAD /** \internal * \brief check timeout of captured bypassed flow by querying capture method * @@ -208,7 +209,6 @@ static bool FlowManagerFlowTimeout(Flow *f, SCTime_t ts, uint32_t *next_ts, cons */ static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters *counters) { -#ifdef CAPTURE_OFFLOAD if (f->flow_state != FLOW_STATE_CAPTURE_BYPASSED) { return true; } @@ -245,9 +245,9 @@ static inline bool FlowBypassedTimeout(Flow *f, SCTime_t ts, FlowTimeoutCounters } counters->bypassed_count++; } -#endif /* CAPTURE_OFFLOAD */ return true; } +#endif /* CAPTURE_OFFLOAD */ typedef struct FlowManagerTimeoutThread { /* used to temporarily store flows that have timed out and are @@ -342,6 +342,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *f, SCT Flow *next_flow = f->next; +#ifdef CAPTURE_OFFLOAD /* never prune a flow that is used by a packet we * are currently processing in one of the threads */ if (!FlowBypassedTimeout(f, ts, counters)) { @@ -350,7 +351,7 @@ static void FlowManagerHashRowTimeout(FlowManagerTimeoutThread *td, Flow *f, SCT f = f->next; continue; } - +#endif f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT; counters->flows_timeout++;