]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2660 in SNORT/snort3 from ~KBHANDAN/snort3:whd to master
authorBhargava Jandhyala (bjandhya) <bjandhya@cisco.com>
Wed, 16 Dec 2020 10:04:04 +0000 (10:04 +0000)
committerBhargava Jandhyala (bjandhya) <bjandhya@cisco.com>
Wed, 16 Dec 2020 10:04:04 +0000 (10:04 +0000)
Squashed commit of the following:

commit 32eb1b6bf8f56b10a1f3de6fc57ac2f4bf96e415
Author: Kaushal Bhandankar <kbhandan@cisco.com>
Date:   Wed Dec 9 12:28:38 2020 -0500

    flow: Pause logging during timeout processing

src/flow/flow_control.cc
src/flow/test/flow_control_test.cc
src/network_inspectors/packet_tracer/packet_tracer.h

index 7bd3545d251e7e673213bd8ad3cd0b95bdd4a07b..53bd553150a6bbad1b22a4432886a462f71da06e 100644 (file)
@@ -120,8 +120,6 @@ bool FlowControl::prune_one(PruneReason reason, bool do_cleanup)
 
 void FlowControl::timeout_flows(time_t cur_time)
 {
-    ActiveSuspendContext act_susp(Active::ASP_TIMEOUT);
-
     cache->timeout(1, cur_time);
 }
 
@@ -139,13 +137,17 @@ Flow* FlowControl::stale_flow_cleanup(FlowCache* cache, Flow* flow, Packet* p)
 {
     if ( p->pkth->flags & DAQ_PKT_FLAG_NEW_FLOW )
     {
-        ActiveSuspendContext act_susp(Active::ASP_TIMEOUT);
-
         if (PacketTracer::is_active())
             PacketTracer::log("Session: deleting snort session, reason: stale and not cleaned \n");
 
-        cache->release(flow, PruneReason::STALE);
-        flow = nullptr;
+        ActiveSuspendContext act_susp(Active::ASP_TIMEOUT);
+
+        {
+            PacketTracerSuspend pt_susp;
+
+            cache->release(flow, PruneReason::STALE);
+            flow = nullptr;
+        }
     }
 
     return flow;
index fec727c0bebe34c78a631d28400ddef918fad34f..5c4ac306f63b1583106f50de252f4d4aa85bb34e 100644 (file)
@@ -60,6 +60,8 @@ void PacketTracer::log(const char*, ...) { }
 void PacketTracer::open_file() { }
 void PacketTracer::dump_to_daq(Packet*) { }
 void PacketTracer::reset() { }
+void PacketTracer::pause() { }
+void PacketTracer::unpause() { }
 void Active::set_drop_reason(char const*) { }
 Packet::Packet(bool) { }
 Packet::~Packet() = default;
index 6aaf92863cc4d88dc22e6025c5ad3beeaa9fcd69..a9013417b1204d7918a4c554ba04b16253d413e5 100644 (file)
@@ -112,7 +112,7 @@ SO_PUBLIC extern THREAD_LOCAL PacketTracer* s_pkt_trace;
 inline bool PacketTracer::is_active()
 { return s_pkt_trace ? s_pkt_trace->active : false; }
 
-struct PacketTracerSuspend
+struct SO_PUBLIC PacketTracerSuspend
 {
     PacketTracerSuspend()
     { PacketTracer::pause(); }