From: Mike Stepanek (mstepane) Date: Wed, 9 Jun 2021 16:02:56 +0000 (+0000) Subject: Merge pull request #2935 in SNORT/snort3 from ~OSHUMEIK/snort3:revert to master X-Git-Tag: 3.1.6.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8b6b56d48d8e7a800f32f0553aec57d3d04947c;p=thirdparty%2Fsnort3.git Merge pull request #2935 in SNORT/snort3 from ~OSHUMEIK/snort3:revert to master Squashed commit of the following: commit 4114c60f610929b86db30d4e34730f76cb6c4ff2 Author: Oleksii Shumeiko Date: Wed Jun 9 17:42:39 2021 +0300 build: reverting back adb5e30c101fb2b7ea54a5df3d5b6a1cf68a1cb7 --- diff --git a/src/actions/act_react.cc b/src/actions/act_react.cc index 4582062cc..1d042eaf4 100644 --- a/src/actions/act_react.cc +++ b/src/actions/act_react.cc @@ -245,12 +245,8 @@ public: const TraceOption* get_trace_options() const override { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption react_trace_options(nullptr, 0, nullptr); return &react_trace_options; -#endif } std::string get_data(); diff --git a/src/codecs/codec_module.cc b/src/codecs/codec_module.cc index 16c6c6a9a..2953bde08 100644 --- a/src/codecs/codec_module.cc +++ b/src/codecs/codec_module.cc @@ -44,12 +44,8 @@ void CodecModule::set_trace(const Trace* trace) const const TraceOption* CodecModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption codec_trace_options(nullptr, 0, nullptr); return &codec_trace_options; -#endif } static const RuleMap general_decode_rules[] = diff --git a/src/detection/detection_module.cc b/src/detection/detection_module.cc index 169e2012a..a9fe67244 100644 --- a/src/detection/detection_module.cc +++ b/src/detection/detection_module.cc @@ -38,7 +38,6 @@ using namespace snort; THREAD_LOCAL const Trace* detection_trace = nullptr; -#ifdef DEBUG_MSGS static const TraceOption detection_trace_options[] = { { "detect_engine", TRACE_DETECTION_ENGINE, "enable detection engine trace logging" }, @@ -49,9 +48,9 @@ static const TraceOption detection_trace_options[] = { "pkt_detect", TRACE_PKT_DETECTION, "enable packet detection trace logging" }, { "opt_tree", TRACE_OPTION_TREE, "enable tree option trace logging" }, { "tag", TRACE_TAG, "enable tag trace logging" }, + { nullptr, 0, nullptr } }; -#endif static const Parameter detection_params[] = { @@ -111,13 +110,7 @@ void DetectionModule::set_trace(const Trace* trace) const { detection_trace = trace; } const TraceOption* DetectionModule::get_trace_options() const -{ -#ifndef DEBUG_MSGS - return nullptr; -#else - return detection_trace_options; -#endif -} +{ return detection_trace_options; } bool DetectionModule::end(const char*, int, SnortConfig* sc) { diff --git a/src/latency/latency_module.cc b/src/latency/latency_module.cc index f4c61d632..09618468f 100644 --- a/src/latency/latency_module.cc +++ b/src/latency/latency_module.cc @@ -179,12 +179,8 @@ void LatencyModule::set_trace(const Trace* trace) const const TraceOption* LatencyModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption latency_trace_options(nullptr, 0, nullptr); return &latency_trace_options; -#endif } bool LatencyModule::set(const char* fqn, Value& v, SnortConfig* sc) diff --git a/src/main/snort_module.cc b/src/main/snort_module.cc index 8c31550db..a57dbe2cb 100644 --- a/src/main/snort_module.cc +++ b/src/main/snort_module.cc @@ -181,9 +181,7 @@ static const Command snort_cmds[] = static const TraceOption snort_trace_options[] = { -#ifdef DEBUG_MSGS { "main", TRACE_MAIN, "enable main trace logging" }, -#endif { "inspector_manager", TRACE_INSPECTOR_MANAGER, "enable inspector manager trace logging" }, { nullptr, 0, nullptr } diff --git a/src/network_inspectors/appid/appid_module.cc b/src/network_inspectors/appid/appid_module.cc index 08886116a..3198bfbfa 100644 --- a/src/network_inspectors/appid/appid_module.cc +++ b/src/network_inspectors/appid/appid_module.cc @@ -442,12 +442,8 @@ void AppIdModule::set_trace(const Trace* trace) const const TraceOption* AppIdModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption appid_trace_options(nullptr, 0, nullptr); return &appid_trace_options; -#endif } ProfileStats* AppIdModule::get_profile() const diff --git a/src/network_inspectors/rna/rna_module.cc b/src/network_inspectors/rna/rna_module.cc index 4847509f2..af0a77360 100644 --- a/src/network_inspectors/rna/rna_module.cc +++ b/src/network_inspectors/rna/rna_module.cc @@ -592,12 +592,8 @@ void RnaModule::set_trace(const Trace* trace) const const TraceOption* RnaModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption rna_trace_options(nullptr, 0, nullptr); return &rna_trace_options; -#endif } bool RnaModule::log_mac_cache(const char* outfile) diff --git a/src/service_inspectors/dce_rpc/dce_smb_module.cc b/src/service_inspectors/dce_rpc/dce_smb_module.cc index 881050c2b..33cc952ba 100644 --- a/src/service_inspectors/dce_rpc/dce_smb_module.cc +++ b/src/service_inspectors/dce_rpc/dce_smb_module.cc @@ -335,12 +335,8 @@ void Dce2SmbModule::set_trace(const Trace* trace) const const TraceOption* Dce2SmbModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption dce_smb_trace_options(nullptr, 0, nullptr); return &dce_smb_trace_options; -#endif } const RuleMap* Dce2SmbModule::get_rules() const diff --git a/src/service_inspectors/dce_rpc/dce_udp_module.cc b/src/service_inspectors/dce_rpc/dce_udp_module.cc index 2298f39af..757022118 100644 --- a/src/service_inspectors/dce_rpc/dce_udp_module.cc +++ b/src/service_inspectors/dce_rpc/dce_udp_module.cc @@ -93,12 +93,8 @@ void Dce2UdpModule::set_trace(const Trace* trace) const const TraceOption* Dce2UdpModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption dce_udp_trace_options(nullptr, 0, nullptr); return &dce_udp_trace_options; -#endif } const RuleMap* Dce2UdpModule::get_rules() const diff --git a/src/service_inspectors/gtp/gtp_module.cc b/src/service_inspectors/gtp/gtp_module.cc index 076ed396a..32f068206 100644 --- a/src/service_inspectors/gtp/gtp_module.cc +++ b/src/service_inspectors/gtp/gtp_module.cc @@ -133,12 +133,8 @@ void GtpInspectModule::set_trace(const Trace* trace) const const TraceOption* GtpInspectModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption gtp_inspect_trace_options(nullptr, 0, nullptr); return >p_inspect_trace_options; -#endif } bool GtpInspectModule::set(const char*, Value& v, SnortConfig*) diff --git a/src/service_inspectors/iec104/iec104_module.cc b/src/service_inspectors/iec104/iec104_module.cc index df1811a13..e549255f6 100644 --- a/src/service_inspectors/iec104/iec104_module.cc +++ b/src/service_inspectors/iec104/iec104_module.cc @@ -38,27 +38,25 @@ THREAD_LOCAL ProfileStats iec104_prof; THREAD_LOCAL const Trace* iec104_trace = nullptr; -#ifdef DEBUG_MSGS static const TraceOption iec104_trace_options[] = { { "identification", TRACE_IEC104_IDENTIFICATION, "enable IEC104 APDU identification trace logging" }, { nullptr, 0, nullptr } }; -#endif //------------------------------------------------------------------------- // stats //------------------------------------------------------------------------- -const PegInfo peg_names[] = -{ - { CountType::SUM, "sessions", "total sessions processed" }, - { CountType::SUM, "frames", "total IEC104 messages" }, - { CountType::NOW, "concurrent_sessions", "total concurrent IEC104 sessions" }, +const PegInfo peg_names[] = +{ + { CountType::SUM, "sessions", "total sessions processed" }, + { CountType::SUM, "frames", "total IEC104 messages" }, + { CountType::NOW, "concurrent_sessions", "total concurrent IEC104 sessions" }, { CountType::MAX, "max_concurrent_sessions", "maximum concurrent IEC104 sessions" }, - { CountType::END, nullptr, nullptr } + { CountType::END, nullptr, nullptr } }; const PegInfo* Iec104Module::get_pegs() const @@ -75,77 +73,71 @@ PegCount* Iec104Module::get_counts() const // rules //------------------------------------------------------------------------- -static const RuleMap Iec104_rules[] = -{ - { IEC104_BAD_LENGTH, IEC104_BAD_LENGTH_STR }, - { IEC104_BAD_START, IEC104_BAD_START_STR }, - { IEC104_RESERVED_ASDU_TYPE, IEC104_RESERVED_ASDU_TYPE_STR }, - { IEC104_APCIU_RESERVED_FIELD_IN_USE, IEC104_APCIU_RESERVED_FIELD_IN_USE_STR }, - { IEC104_APCIU_INVALID_MESSAGE_TYPE, IEC104_APCIU_INVALID_MESSAGE_TYPE_STR }, - { IEC104_APCIS_RESERVED_FIELD_IN_USE, IEC104_APCIS_RESERVED_FIELD_IN_USE_STR }, - { IEC104_APCII_NUM_ELEMENTS_SET_TO_ZERO, IEC104_APCII_NUM_ELEMENTS_SET_TO_ZERO_STR }, - { IEC104_APCII_INVALID_SQ_VALUE, IEC104_APCII_INVALID_SQ_VALUE_STR }, - { IEC104_APCII_INVALID_NUM_ELEMENTS_VALUE, IEC104_APCII_INVALID_NUM_ELEMENTS_VALUE_STR }, +static const RuleMap Iec104_rules[] = +{ + { IEC104_BAD_LENGTH, IEC104_BAD_LENGTH_STR }, + { IEC104_BAD_START, IEC104_BAD_START_STR }, + { IEC104_RESERVED_ASDU_TYPE, IEC104_RESERVED_ASDU_TYPE_STR }, + { IEC104_APCIU_RESERVED_FIELD_IN_USE, IEC104_APCIU_RESERVED_FIELD_IN_USE_STR }, + { IEC104_APCIU_INVALID_MESSAGE_TYPE, IEC104_APCIU_INVALID_MESSAGE_TYPE_STR }, + { IEC104_APCIS_RESERVED_FIELD_IN_USE, IEC104_APCIS_RESERVED_FIELD_IN_USE_STR }, + { IEC104_APCII_NUM_ELEMENTS_SET_TO_ZERO, IEC104_APCII_NUM_ELEMENTS_SET_TO_ZERO_STR }, + { IEC104_APCII_INVALID_SQ_VALUE, IEC104_APCII_INVALID_SQ_VALUE_STR }, + { IEC104_APCII_INVALID_NUM_ELEMENTS_VALUE, IEC104_APCII_INVALID_NUM_ELEMENTS_VALUE_STR }, { IEC104_RESERVED_COI, IEC104_RESERVED_COI_STR }, { IEC104_RESERVED_QOI, IEC104_RESERVED_QOI_STR }, - { IEC104_RESERVED_QCC, IEC104_RESERVED_QCC_STR }, - { IEC104_RESERVED_QPM_KPA, IEC104_RESERVED_QPM_KPA_STR }, - { IEC104_ABNORMAL_QPM_LPC, IEC104_ABNORMAL_QPM_LPC_STR }, - { IEC104_ABNORMAL_QPM_POP, IEC104_ABNORMAL_QPM_POP_STR }, - { IEC104_RESERVED_QPA, IEC104_RESERVED_QPA_STR }, - { IEC104_RESERVED_QOC, IEC104_RESERVED_QOC_STR }, - { IEC104_RESERVED_QRP, IEC104_RESERVED_QRP_STR }, - { IEC104_RESERVED_FRQ, IEC104_RESERVED_FRQ_STR }, - { IEC104_RESERVED_SRQ, IEC104_RESERVED_SRQ_STR }, - { IEC104_RESERVED_SCQ, IEC104_RESERVED_SCQ_STR }, - { IEC104_RESERVED_LSQ, IEC104_RESERVED_LSQ_STR }, - { IEC104_RESERVED_AFQ, IEC104_RESERVED_AFQ_STR }, - { IEC104_VSQ_ABNORMAL_SQ, IEC104_VSQ_ABNORMAL_SQ_STR }, - { IEC104_RESERVED_CAUSE_TX, IEC104_RESERVED_CAUSE_TX_STR }, - { IEC104_INVALID_CAUSE_TX, IEC104_INVALID_CAUSE_TX_STR }, - { IEC104_INVALID_COMMON_ADDRESS, IEC104_INVALID_COMMON_ADDRESS_STR }, - { IEC104_RESERVED_SIQ, IEC104_RESERVED_SIQ_STR }, - { IEC104_RESERVED_DIQ, IEC104_RESERVED_DIQ_STR }, - { IEC104_RESERVED_QDS, IEC104_RESERVED_QDS_STR }, - { IEC104_RESERVED_QDP, IEC104_RESERVED_QDP_STR }, - { IEC104_RESERVED_IEEE_STD_754_NAN, IEC104_RESERVED_IEEE_STD_754_NAN_STR }, - { IEC104_RESERVED_IEEE_STD_754_INFINITY, IEC104_RESERVED_IEEE_STD_754_INFINITY_STR }, - { IEC104_RESERVED_SEP, IEC104_RESERVED_SEP_STR }, - { IEC104_RESERVED_SPE, IEC104_RESERVED_SPE_STR }, - { IEC104_RESERVED_OCI, IEC104_RESERVED_OCI_STR }, + { IEC104_RESERVED_QCC, IEC104_RESERVED_QCC_STR }, + { IEC104_RESERVED_QPM_KPA, IEC104_RESERVED_QPM_KPA_STR }, + { IEC104_ABNORMAL_QPM_LPC, IEC104_ABNORMAL_QPM_LPC_STR }, + { IEC104_ABNORMAL_QPM_POP, IEC104_ABNORMAL_QPM_POP_STR }, + { IEC104_RESERVED_QPA, IEC104_RESERVED_QPA_STR }, + { IEC104_RESERVED_QOC, IEC104_RESERVED_QOC_STR }, + { IEC104_RESERVED_QRP, IEC104_RESERVED_QRP_STR }, + { IEC104_RESERVED_FRQ, IEC104_RESERVED_FRQ_STR }, + { IEC104_RESERVED_SRQ, IEC104_RESERVED_SRQ_STR }, + { IEC104_RESERVED_SCQ, IEC104_RESERVED_SCQ_STR }, + { IEC104_RESERVED_LSQ, IEC104_RESERVED_LSQ_STR }, + { IEC104_RESERVED_AFQ, IEC104_RESERVED_AFQ_STR }, + { IEC104_VSQ_ABNORMAL_SQ, IEC104_VSQ_ABNORMAL_SQ_STR }, + { IEC104_RESERVED_CAUSE_TX, IEC104_RESERVED_CAUSE_TX_STR }, + { IEC104_INVALID_CAUSE_TX, IEC104_INVALID_CAUSE_TX_STR }, + { IEC104_INVALID_COMMON_ADDRESS, IEC104_INVALID_COMMON_ADDRESS_STR }, + { IEC104_RESERVED_SIQ, IEC104_RESERVED_SIQ_STR }, + { IEC104_RESERVED_DIQ, IEC104_RESERVED_DIQ_STR }, + { IEC104_RESERVED_QDS, IEC104_RESERVED_QDS_STR }, + { IEC104_RESERVED_QDP, IEC104_RESERVED_QDP_STR }, + { IEC104_RESERVED_IEEE_STD_754_NAN, IEC104_RESERVED_IEEE_STD_754_NAN_STR }, + { IEC104_RESERVED_IEEE_STD_754_INFINITY, IEC104_RESERVED_IEEE_STD_754_INFINITY_STR }, + { IEC104_RESERVED_SEP, IEC104_RESERVED_SEP_STR }, + { IEC104_RESERVED_SPE, IEC104_RESERVED_SPE_STR }, + { IEC104_RESERVED_OCI, IEC104_RESERVED_OCI_STR }, { IEC104_INVALID_FBP, IEC104_INVALID_FBP_STR }, { IEC104_RESERVED_SCO, IEC104_RESERVED_SCO_STR }, { IEC104_INVALID_DCO, IEC104_INVALID_DCO_STR }, - { IEC104_RESERVED_RCO, IEC104_RESERVED_RCO_STR }, - { IEC104_INVALID_MS_IN_MINUTE, IEC104_INVALID_MS_IN_MINUTE_STR }, - { IEC104_INVALID_MINS_IN_HOUR, IEC104_INVALID_MINS_IN_HOUR_STR }, - { IEC104_RESERVED_MINS_IN_HOUR, IEC104_RESERVED_MINS_IN_HOUR_STR }, - { IEC104_INVALID_HOURS_IN_DAY, IEC104_INVALID_HOURS_IN_DAY_STR }, - { IEC104_RESERVED_HOURS_IN_DAY, IEC104_RESERVED_HOURS_IN_DAY_STR }, - { IEC104_INVALID_DAY_OF_MONTH, IEC104_INVALID_DAY_OF_MONTH_STR }, - { IEC104_INVALID_MONTH, IEC104_INVALID_MONTH_STR }, - { IEC104_RESERVED_MONTH, IEC104_RESERVED_MONTH_STR }, - { IEC104_INVALID_YEAR, IEC104_INVALID_YEAR_STR }, - { IEC104_NULL_LOS_VALUE, IEC104_NULL_LOS_VALUE_STR }, - { IEC104_INVALID_LOS_VALUE, IEC104_INVALID_LOS_VALUE_STR }, - { IEC104_RESERVED_YEAR, IEC104_RESERVED_YEAR_STR }, - { IEC104_RESERVED_SOF, IEC104_RESERVED_SOF_STR }, + { IEC104_RESERVED_RCO, IEC104_RESERVED_RCO_STR }, + { IEC104_INVALID_MS_IN_MINUTE, IEC104_INVALID_MS_IN_MINUTE_STR }, + { IEC104_INVALID_MINS_IN_HOUR, IEC104_INVALID_MINS_IN_HOUR_STR }, + { IEC104_RESERVED_MINS_IN_HOUR, IEC104_RESERVED_MINS_IN_HOUR_STR }, + { IEC104_INVALID_HOURS_IN_DAY, IEC104_INVALID_HOURS_IN_DAY_STR }, + { IEC104_RESERVED_HOURS_IN_DAY, IEC104_RESERVED_HOURS_IN_DAY_STR }, + { IEC104_INVALID_DAY_OF_MONTH, IEC104_INVALID_DAY_OF_MONTH_STR }, + { IEC104_INVALID_MONTH, IEC104_INVALID_MONTH_STR }, + { IEC104_RESERVED_MONTH, IEC104_RESERVED_MONTH_STR }, + { IEC104_INVALID_YEAR, IEC104_INVALID_YEAR_STR }, + { IEC104_NULL_LOS_VALUE, IEC104_NULL_LOS_VALUE_STR }, + { IEC104_INVALID_LOS_VALUE, IEC104_INVALID_LOS_VALUE_STR }, + { IEC104_RESERVED_YEAR, IEC104_RESERVED_YEAR_STR }, + { IEC104_RESERVED_SOF, IEC104_RESERVED_SOF_STR }, { IEC104_RESERVED_QOS, IEC104_RESERVED_QOS_STR }, - { 0, nullptr } + { 0, nullptr } }; void Iec104Module::set_trace(const Trace* trace) const { iec104_trace = trace; } const TraceOption* Iec104Module::get_trace_options() const -{ -#ifndef DEBUG_MSGS - return nullptr; -#else - return iec104_trace_options; -#endif -} +{ return iec104_trace_options; } const RuleMap* Iec104Module::get_rules() const { @@ -160,3 +152,4 @@ Iec104Module::Iec104Module() : Module(IEC104_NAME, IEC104_HELP) { } + diff --git a/src/stream/base/stream_module.cc b/src/stream/base/stream_module.cc index 7895e8865..fc75c8a75 100644 --- a/src/stream/base/stream_module.cc +++ b/src/stream/base/stream_module.cc @@ -116,12 +116,8 @@ void StreamModule::set_trace(const Trace* trace) const const TraceOption* StreamModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption stream_trace_options(nullptr, 0, nullptr); return &stream_trace_options; -#endif } const PegInfo* StreamModule::get_pegs() const diff --git a/src/stream/ip/ip_module.cc b/src/stream/ip/ip_module.cc index e01c25e08..0549d3928 100644 --- a/src/stream/ip/ip_module.cc +++ b/src/stream/ip/ip_module.cc @@ -140,12 +140,8 @@ void StreamIpModule::set_trace(const Trace* trace) const const TraceOption* StreamIpModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption stream_ip_trace_options(nullptr, 0, nullptr); return &stream_ip_trace_options; -#endif } const RuleMap* StreamIpModule::get_rules() const diff --git a/src/stream/tcp/tcp_module.cc b/src/stream/tcp/tcp_module.cc index 2e2a5c11d..663686efa 100644 --- a/src/stream/tcp/tcp_module.cc +++ b/src/stream/tcp/tcp_module.cc @@ -42,7 +42,6 @@ THREAD_LOCAL ProfileStats s5TcpPerfStats; THREAD_LOCAL const Trace* stream_tcp_trace = nullptr; -#ifdef DEBUG_MSGS static const TraceOption stream_tcp_trace_options[] = { { "segments", TRACE_SEGMENTS, "enable stream TCP segments trace logging" }, @@ -50,7 +49,6 @@ static const TraceOption stream_tcp_trace_options[] = { nullptr, 0, nullptr } }; -#endif const PegInfo tcp_pegs[] = { @@ -260,13 +258,7 @@ void StreamTcpModule::set_trace(const Trace* trace) const { stream_tcp_trace = trace; } const TraceOption* StreamTcpModule::get_trace_options() const -{ -#ifndef DEBUG_MSGS - return nullptr; -#else - return stream_tcp_trace_options; -#endif -} +{ return stream_tcp_trace_options; } const RuleMap* StreamTcpModule::get_rules() const { return stream_tcp_rules; } diff --git a/src/stream/user/user_module.cc b/src/stream/user/user_module.cc index e2b115fbe..a46f56157 100644 --- a/src/stream/user/user_module.cc +++ b/src/stream/user/user_module.cc @@ -66,12 +66,8 @@ void StreamUserModule::set_trace(const Trace* trace) const const TraceOption* StreamUserModule::get_trace_options() const { -#ifndef DEBUG_MSGS - return nullptr; -#else static const TraceOption stream_user_trace_options(nullptr, 0, nullptr); return &stream_user_trace_options; -#endif } bool StreamUserModule::set(const char*, Value& v, SnortConfig*) diff --git a/src/trace/dev_notes.txt b/src/trace/dev_notes.txt index 8b1625f06..9e9b1c91d 100644 --- a/src/trace/dev_notes.txt +++ b/src/trace/dev_notes.txt @@ -67,15 +67,6 @@ This directory contains the trace logger framework. TraceApi placed into "trace_api.h/trace_api.cc" -* TraceOption - - Represents a targeted module's trace option. - The targeted module provides a list of its trace options, which control the - verbosity level of the module's trace messages. - Since the messages (from src/main/snort_debug.h) can be present in - release-build and/or debug-build, one should pay attention which option - should be in the options list. - * Trace This class encapsulates trace verbosity functionality.