]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1617 in SNORT/snort3 from ~BBANTWAL/snort3:offload_memstats_fix...
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Fri, 31 May 2019 15:20:34 +0000 (11:20 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Fri, 31 May 2019 15:20:34 +0000 (11:20 -0400)
Squashed commit of the following:

commit f10682ce0c9e034bef3d3a42a3e2fcebe0c94691
Author: Bhagya Tholpady <bbantwal@cisco.com>
Date:   Fri May 24 17:06:38 2019 -0400

    flow: check if flow is actually deleted before updating memstats

src/flow/flow_cache.cc

index c3dae9dbc22e3155e31248957639fcac18ee3fb7..0ed2f33b09c9ee1226df6793e8fe743633393fdf 100644 (file)
@@ -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)