From: Michael Altizer (mialtize) Date: Fri, 31 May 2019 15:20:34 +0000 (-0400) Subject: Merge pull request #1617 in SNORT/snort3 from ~BBANTWAL/snort3:offload_memstats_fix... X-Git-Tag: 3.0.0-257~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a063bd7fc4604d0edb07a4f6113287b97bddbe5;p=thirdparty%2Fsnort3.git Merge pull request #1617 in SNORT/snort3 from ~BBANTWAL/snort3:offload_memstats_fix to master Squashed commit of the following: commit f10682ce0c9e034bef3d3a42a3e2fcebe0c94691 Author: Bhagya Tholpady Date: Fri May 24 17:06:38 2019 -0400 flow: check if flow is actually deleted before updating memstats --- diff --git a/src/flow/flow_cache.cc b/src/flow/flow_cache.cc index c3dae9dbc..0ed2f33b0 100644 --- a/src/flow/flow_cache.cc +++ b/src/flow/flow_cache.cc @@ -158,8 +158,15 @@ int FlowCache::remove(Flow* flow) if ( flow->next ) unlink_uni(flow); - memory::MemoryCap::update_deallocations(config.cap_weight); - return hash_table->remove(flow->key); + bool deleted = hash_table->remove(flow->key); + + // FIXIT-M This check is added for offload case where both Flow::reset + // and Flow::retire try remove the flow from hash. Flow::reset should + // just mark the flow as pending instead of trying to remove it. + if ( deleted ) + memory::MemoryCap::update_deallocations(config.cap_weight); + + return deleted; } int FlowCache::retire(Flow* flow)