From: Ron Dempster (rdempste) Date: Mon, 6 Nov 2023 19:30:25 +0000 (+0000) Subject: Pull request #4088: Build X-Git-Tag: 3.1.74.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23206d51277c6595dd12922c38e3f49e54d1036a;p=thirdparty%2Fsnort3.git Pull request #4088: Build Merge in SNORT/snort3 from ~RDEMPSTE/snort3:build to master Squashed commit of the following: commit 081a9a49a764b4e93b16047fa66592d3725dcb64 Author: Ron Dempster (rdempste) Date: Fri Nov 3 13:16:32 2023 -0400 build: fix up 32-bit compilation commit c34089572ac99037baa69003971fe9b8cfea5c2d Author: Ron Dempster (rdempste) Date: Fri Nov 3 12:52:55 2023 -0400 appid: clean up main thread appid debug and make appid on, off, on work --- diff --git a/src/flow/test/flow_cache_test.cc b/src/flow/test/flow_cache_test.cc index 164bfb4c9..358b01e64 100644 --- a/src/flow/test/flow_cache_test.cc +++ b/src/flow/test/flow_cache_test.cc @@ -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); diff --git a/src/memory/test/memory_cap_test.cc b/src/memory/test/memory_cap_test.cc index 839726781..d89274689 100644 --- a/src/memory/test/memory_cap_test.cc +++ b/src/memory/test/memory_cap_test.cc @@ -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(); diff --git a/src/network_inspectors/appid/appid_config.cc b/src/network_inspectors/appid/appid_config.cc index 0a0e16a5b..a7f5f46d4 100644 --- a/src/network_inspectors/appid/appid_config.cc +++ b/src/network_inspectors/appid/appid_config.cc @@ -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); diff --git a/src/network_inspectors/appid/appid_inspector.cc b/src/network_inspectors/appid/appid_inspector.cc index 6a908fe8c..626db65fb 100644 --- a/src/network_inspectors/appid/appid_inspector.cc +++ b/src/network_inspectors/appid/appid_inspector.cc @@ -102,8 +102,7 @@ AppIdInspector::AppIdInspector(AppIdModule& mod) AppIdInspector::~AppIdInspector() { - if (ctxt) - delete ctxt; + delete ctxt; delete config; }