From: Oleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) Date: Fri, 13 Dec 2024 08:28:52 +0000 (+0000) Subject: Pull request #4542: Enable parse warning for plugin loading X-Git-Tag: 3.6.1.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68b4aed393ff22852b3cb913d5944aeafa0dd824;p=thirdparty%2Fsnort3.git Pull request #4542: Enable parse warning for plugin loading Merge in SNORT/snort3 from ~OSHUMEIK/snort3:fix_static_build to master Squashed commit of the following: commit cc436080f672ff6ed30899493d3fd340d1c1963f Author: Oleksii Shumeiko Date: Tue Dec 10 10:02:05 2024 +0200 log: print all warnings before command line is parsed commit f8d595f5517c2990037a0a59ac47fb16c564cdd2 Author: Yehor Velykozhon Date: Mon Dec 9 17:02:24 2024 +0200 build: include/exclude snort_ml module conditionally --- diff --git a/cmake/FindML.cmake b/cmake/FindML.cmake index a2856331a..0282bcbef 100644 --- a/cmake/FindML.cmake +++ b/cmake/FindML.cmake @@ -9,6 +9,6 @@ find_package_handle_standard_args(ML ML_INCLUDE_DIRS ) -if (ML_FOUND AND NOT ENABLE_KAIZEN_MOCK) +if (ML_FOUND AND NOT USE_LIBML_MOCK) set(HAVE_LIBML TRUE) endif() diff --git a/config.cmake.h.in b/config.cmake.h.in index 1da3047b9..d57ab59dc 100644 --- a/config.cmake.h.in +++ b/config.cmake.h.in @@ -156,6 +156,9 @@ /* libml available */ #cmakedefine HAVE_LIBML 1 +/* don't worry about libml and mock the inspector */ +#cmakedefine USE_LIBML_MOCK 1 + /* Availability of specific library functions */ /* Define to 1 if you have the `malloc_trim' function. */ diff --git a/configure_cmake.sh b/configure_cmake.sh index 8dc7023a6..c2a3e6b0b 100755 --- a/configure_cmake.sh +++ b/configure_cmake.sh @@ -479,7 +479,7 @@ while [ $# -ne 0 ]; do append_cache_entry ML_LIBRARIES_DIR_HINT PATH $optarg ;; --without-libml) - append_cache_entry ENABLE_KAIZEN_MOCK BOOL true + append_cache_entry USE_LIBML_MOCK BOOL true ;; SIGNAL_SNORT_RELOAD=*) append_cache_entry SIGNAL_SNORT_RELOAD STRING $optarg diff --git a/src/log/messages.cc b/src/log/messages.cc index dbe5083b4..dcfcd8e7b 100644 --- a/src/log/messages.cc +++ b/src/log/messages.cc @@ -101,7 +101,7 @@ namespace snort { void ParseWarning(WarningGroup wg, const char* format, ...) { - if ( !(SnortConfig::get_conf()->warning_flags & (1 << wg)) ) + if ( SnortConfig::get_conf() and !(SnortConfig::get_conf()->warning_flags & (1 << wg)) ) return; char buf[STD_BUF+1]; diff --git a/src/network_inspectors/CMakeLists.txt b/src/network_inspectors/CMakeLists.txt index d6df6900f..fd8694b75 100644 --- a/src/network_inspectors/CMakeLists.txt +++ b/src/network_inspectors/CMakeLists.txt @@ -3,7 +3,11 @@ add_subdirectory(appid) add_subdirectory(arp_spoof) add_subdirectory(binder) add_subdirectory(extractor) -add_subdirectory(kaizen) + +if ( HAVE_LIBML OR USE_LIBML_MOCK ) + add_subdirectory(kaizen) +endif() + add_subdirectory(normalize) add_subdirectory(packet_capture) add_subdirectory(perf_monitor) @@ -19,11 +23,17 @@ if(STATIC_INSPECTORS) ) endif() +if ( HAVE_LIBML OR USE_LIBML_MOCK ) + set(KAIZEN_STATIC_OBJ + $ + ) +endif() + set(STATIC_NETWORK_INSPECTOR_PLUGINS $ $ $ - $ + ${KAIZEN_STATIC_OBJ} $ $ $ diff --git a/src/network_inspectors/kaizen/kaizen_engine.cc b/src/network_inspectors/kaizen/kaizen_engine.cc index ca2e5b824..6e60a7762 100644 --- a/src/network_inspectors/kaizen/kaizen_engine.cc +++ b/src/network_inspectors/kaizen/kaizen_engine.cc @@ -198,11 +198,7 @@ static void kaizen_engine_dtor(Inspector* p) static const InspectApi kaizen_engine_api = { { -#if defined(HAVE_LIBML) || defined(REG_TEST) PT_INSPECTOR, -#else - PT_MAX, -#endif sizeof(InspectApi), INSAPI_VERSION, 0, diff --git a/src/network_inspectors/kaizen/kaizen_inspector.cc b/src/network_inspectors/kaizen/kaizen_inspector.cc index a128374b9..863eb59f3 100644 --- a/src/network_inspectors/kaizen/kaizen_inspector.cc +++ b/src/network_inspectors/kaizen/kaizen_inspector.cc @@ -210,11 +210,7 @@ static void kaizen_dtor(Inspector* p) static const InspectApi kaizen_api = { { -#if defined(HAVE_LIBML) || defined(REG_TEST) PT_INSPECTOR, -#else - PT_MAX, -#endif sizeof(InspectApi), INSAPI_VERSION, 0, diff --git a/src/network_inspectors/network_inspectors.cc b/src/network_inspectors/network_inspectors.cc index 4b7cd53e0..7abdadda5 100644 --- a/src/network_inspectors/network_inspectors.cc +++ b/src/network_inspectors/network_inspectors.cc @@ -32,8 +32,12 @@ extern const BaseApi* nin_reputation; extern const BaseApi* nin_appid[]; extern const BaseApi* nin_extractor[]; + +#if defined(HAVE_LIBML) || defined(USE_LIBML_MOCK) extern const BaseApi* nin_kaizen_engine[]; extern const BaseApi* nin_kaizen[]; +#endif + extern const BaseApi* nin_port_scan[]; extern const BaseApi* nin_rna[]; @@ -56,8 +60,12 @@ void load_network_inspectors() PluginManager::load_plugins(network_inspectors); PluginManager::load_plugins(nin_appid); PluginManager::load_plugins(nin_extractor); + +#if defined(HAVE_LIBML) || defined(USE_LIBML_MOCK) PluginManager::load_plugins(nin_kaizen_engine); PluginManager::load_plugins(nin_kaizen); +#endif + PluginManager::load_plugins(nin_port_scan); PluginManager::load_plugins(nin_rna);