]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4088: Build
authorRon Dempster (rdempste) <rdempste@cisco.com>
Mon, 6 Nov 2023 19:30:25 +0000 (19:30 +0000)
committerRon Dempster (rdempste) <rdempste@cisco.com>
Mon, 6 Nov 2023 19:30:25 +0000 (19:30 +0000)
Merge in SNORT/snort3 from ~RDEMPSTE/snort3:build to master

Squashed commit of the following:

commit 081a9a49a764b4e93b16047fa66592d3725dcb64
Author: Ron Dempster (rdempste) <rdempste@cisco.com>
Date:   Fri Nov 3 13:16:32 2023 -0400

    build: fix up 32-bit compilation

commit c34089572ac99037baa69003971fe9b8cfea5c2d
Author: Ron Dempster (rdempste) <rdempste@cisco.com>
Date:   Fri Nov 3 12:52:55 2023 -0400

    appid: clean up main thread appid debug and make appid on, off, on work

src/flow/test/flow_cache_test.cc
src/memory/test/memory_cap_test.cc
src/network_inspectors/appid/appid_config.cc
src/network_inspectors/appid/appid_inspector.cc

index 164bfb4c9f183b104ecd626802ddd7c3b55d0c7a..358b01e646f12f464025ea4ea2e6146608d73286 100644 (file)
@@ -54,23 +54,18 @@ THREAD_LOCAL Active::ActiveSuspendReason Active::s_suspend_reason = Active::ASP_
 THREAD_LOCAL const Trace* stream_trace = nullptr;
 
 void Active::drop_packet(snort::Packet const*, bool) { }
-Analyzer* Analyzer::get_local_analyzer() { return nullptr; }
-void Analyzer::resume(unsigned long) { }
 void Active::set_drop_reason(char const*) { }
-DetectionEngine::DetectionEngine() { context = nullptr; }
-ExpectCache::~ExpectCache() = default;
-DetectionEngine::~DetectionEngine() = default;
-const SnortConfig* SnortConfig::get_conf() { return nullptr; }
-void DetectionEngine::disable_all(Packet*) { }
 ExpectCache::ExpectCache(uint32_t) { }
+ExpectCache::~ExpectCache() = default;
 bool ExpectCache::check(Packet*, Flow*) { return true; }
 bool ExpectCache::is_expected(Packet*) { return true; }
+void DetectionEngine::disable_all(Packet*) { }
 Flow* HighAvailabilityManager::import(Packet&, FlowKey&) { return nullptr; }
 bool HighAvailabilityManager::in_standby(Flow*) { return false; }
 SfIpRet SfIp::set(void const*, int) { return SFIP_SUCCESS; }
-void snort::trace_vprintf(const char*, TraceLevel, const char*, const Packet*, const char*, va_list) {}
-uint8_t snort::TraceApi::get_constraints_generation() { return 0; }
-void snort::TraceApi::filter(const Packet&) {}
+const SnortConfig* SnortConfig::get_conf() { return nullptr; }
+uint8_t TraceApi::get_constraints_generation() { return 0; }
+void TraceApi::filter(const Packet&) {}
 void ThreadConfig::preemptive_kick() {}
 
 namespace snort
@@ -85,7 +80,8 @@ void Flow::set_direction(Packet*) { }
 void Flow::set_mpls_layer_per_dir(Packet*) { }
 
 time_t packet_time() { return 0; }
-void packet_gettimeofday(struct timeval* tv) { *tv = {}; }
+
+void trace_vprintf(const char*, TraceLevel, const char*, const Packet*, const char*, va_list) {}
 
 namespace ip
 {
@@ -239,10 +235,10 @@ TEST(flow_prune, prune_proto)
     FlowCacheConfig fcg;
     fcg.max_flows = 5;
     fcg.prune_flows = 3;
-    
+
     for(uint8_t i = to_utype(PktType::NONE); i <= to_utype(PktType::MAX); i++)
         fcg.proto[i].nominal_timeout = 5;
-    
+
     FlowCache *cache = new FlowCache(fcg);
     int port = 1;
 
@@ -263,7 +259,7 @@ TEST(flow_prune, prune_proto)
             continue;
         CHECK(cache->prune_one(PruneReason::NONE, true, i) == false);
     }
-    
+
     //pruning should happen for UDP
     CHECK(cache->prune_one(PruneReason::NONE, true, to_utype(PktType::UDP)) == true);
 
index 83972678145bfb98652d5bf2dbfcd27aae2bdb3a..d8927468974d30c23a7c7b9c363781a314ff6ba2 100644 (file)
@@ -235,7 +235,7 @@ TEST(memory, prune1)
     const uint64_t start = 50;
     heap->total = start;
 
-    MemoryConfig config { cap, 100, 0, 2, true };
+    MemoryConfig config { (size_t)cap, 100, 0, 2, true };
     MemoryCap::start(config, pruner);
     MemoryCap::thread_init();
 
@@ -336,7 +336,7 @@ TEST(memory, prune1)
 TEST(memory, prune3)
 {
     uint64_t cap = 100;
-    MemoryConfig config { cap, 100, 0, 1, true };
+    MemoryConfig config { (size_t)cap, 100, 0, 1, true };
     MemoryCap::start(config, pruner);
     MemoryCap::thread_init();
 
@@ -378,7 +378,7 @@ TEST(memory, prune3)
 TEST(memory, two_cycles)
 {
     uint64_t cap = 100;
-    MemoryConfig config { cap, 100, 0, 1, true };
+    MemoryConfig config { (size_t)cap, 100, 0, 1, true };
     MemoryCap::start(config, pruner);
     MemoryCap::thread_init();
 
@@ -423,7 +423,7 @@ TEST(memory, reap_failure)
     const uint64_t start = 50;
     heap->total = start;
 
-    MemoryConfig config { cap, 100, 0, 2, true };
+    MemoryConfig config { (size_t)cap, 100, 0, 2, true };
     MemoryCap::start(config, pruner);
     MemoryCap::thread_init();
 
@@ -481,7 +481,7 @@ TEST(memory, reap_freed_outside_of_pruning)
     const uint64_t start = 50;
     heap->total = start;
 
-    MemoryConfig config { cap, 100, 0, 2, true };
+    MemoryConfig config { (size_t)cap, 100, 0, 2, true };
     MemoryCap::start(config, pruner);
     MemoryCap::thread_init();
 
index 0a0e16a5b47062668b302097c0e395e2e989a96f..a7f5f46d420125b5db6ae00f600cdfb752407656 100644 (file)
@@ -95,6 +95,8 @@ void AppIdConfig::show() const
     ConfigLogger::log_value("memcap", memcap);
 }
 
+static bool once = false;
+
 void AppIdContext::pterm()
 {
     if (odp_thread_local_ctxt)
@@ -107,7 +109,16 @@ void AppIdContext::pterm()
     {
         odp_ctxt->get_app_info_mgr().cleanup_appid_info_table();
         delete odp_ctxt;
+        odp_ctxt = nullptr;
     }
+
+    if (appidDebug)
+    {
+        delete appidDebug;
+        appidDebug = nullptr;
+    }
+
+    once = false;
 }
 
 bool AppIdContext::init_appid(SnortConfig* sc, AppIdInspector& inspector)
@@ -119,7 +130,6 @@ bool AppIdContext::init_appid(SnortConfig* sc, AppIdInspector& inspector)
     if (!odp_thread_local_ctxt)
         odp_thread_local_ctxt = new OdpThreadContext;
 
-    static bool once = false;
     if (!once)
     {
         odp_ctxt->get_client_disco_mgr().initialize(inspector);
index 6a908fe8cec11a94f6f0e36c630bcbad5dcde6ec..626db65fb851189219b5a3033da59efd94b64d03 100644 (file)
@@ -102,8 +102,7 @@ AppIdInspector::AppIdInspector(AppIdModule& mod)
 
 AppIdInspector::~AppIdInspector()
 {
-    if (ctxt)
-        delete ctxt;
+    delete ctxt;
     delete config;
 }