]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1217 in SNORT/snort3 from debug_cleanup to master
authorTom Peters (thopeter) <thopeter@cisco.com>
Fri, 4 May 2018 19:30:54 +0000 (15:30 -0400)
committerTom Peters (thopeter) <thopeter@cisco.com>
Fri, 4 May 2018 19:30:54 +0000 (15:30 -0400)
Squashed commit of the following:

commit 04c562979db2c3f3f9ca25ddc649f0ba2a13419f
Author: Nihal Desai <nihdesai@cisco.com>
Date:   Mon Apr 30 11:10:43 2018 -0400

    Debug: Final debug messages cleanup, removal of macros from snort_debug

57 files changed:
extra/src/loggers/alert_unixsock/alert_unixsock.cc
src/codecs/ip/cd_ipv4.cc
src/codecs/link/cd_ppp_encap.cc
src/codecs/link/cd_pppoe.cc
src/codecs/misc/cd_gtp.cc
src/connectors/file_connector/file_connector.cc
src/connectors/file_connector/file_connector.h
src/connectors/file_connector/file_connector_module.cc
src/connectors/file_connector/test/file_connector_module_test.cc
src/connectors/file_connector/test/file_connector_test.cc
src/connectors/tcp_connector/tcp_connector.cc
src/connectors/tcp_connector/tcp_connector_module.cc
src/connectors/tcp_connector/test/tcp_connector_module_test.cc
src/connectors/tcp_connector/test/tcp_connector_test.cc
src/file_api/file_cache.cc
src/file_api/file_capture.cc
src/file_api/file_mempool.cc
src/file_api/file_stats.h
src/flow/flow_cache.cc
src/flow/ha.cc
src/flow/ha_module.cc
src/flow/test/ha_module_test.cc
src/flow/test/ha_test.cc
src/log/log.cc
src/loggers/alert_full.cc
src/loggers/unified2.cc
src/main.cc
src/main/analyzer.cc
src/main/snort_config.cc
src/main/snort_debug.cc
src/main/snort_debug.h
src/managers/connector_manager.cc
src/memory/memory_cap.cc
src/mime/file_mime_paf.cc
src/mime/file_mime_process.cc
src/network_inspectors/appid/detector_plugins/test/detector_smtp_test.cc
src/network_inspectors/appid/test/log_message_mock.h
src/network_inspectors/appid/test/tp_lib_handler_test.cc
src/parser/parse_ip.cc
src/parser/parse_ports.cc
src/parser/parse_rule.cc
src/parser/vars.cc
src/ports/port_object.cc
src/ports/port_object2.cc
src/ports/port_table.cc
src/protocols/packet_manager.cc
src/side_channel/side_channel.cc
src/side_channel/side_channel.h
src/side_channel/side_channel_module.cc
src/side_channel/side_channel_module.h
src/side_channel/test/side_channel_module_test.cc
src/side_channel/test/side_channel_test.cc
src/target_based/sftarget_reader.cc
src/target_based/snort_protocols.cc
src/target_based/test/proto_ref_test.cc
src/utils/boyer_moore.cc
src/utils/util.cc

index fd93325aedf75de5de808718b6f64c8849b16d13..092c161484d77e3ee73eef24740af25d8afc0e7f 100644 (file)
@@ -114,8 +114,6 @@ public:
 static void get_alert_pkt(
     Packet* p, const char* msg, const Event& event)
 {
-    DebugMessage(DEBUG_LOG, "Logging Alert data!\n");
-
     // FIXIT-L minimize or eliminate memset
     memset((char*)&us.alert,0,sizeof(us.alert));
 
index 4754f5ce7768a487dadb1996f8ea6a15c2fb1f51..b650ed3d9dda64cf35903ba5249cc8dae40ceca9 100644 (file)
@@ -165,20 +165,12 @@ bool Ipv4Codec::decode(const RawData& raw, CodecData& codec, DecodeData& snort)
 
     if (hlen < ip::IP4_HEADER_LEN)
     {
-        DebugFormat(DEBUG_DECODE,
-            "Bogus IP header length of %i bytes\n", hlen);
-
         codec_event(codec, DECODE_IPV4_INVALID_HEADER_LEN);
         return false;
     }
 
     if (ip_len > raw.len)
     {
-        DebugFormat(DEBUG_DECODE,
-            "IP Len field is %u bytes bigger than captured length.\n"
-            "    (ip.len: %u, cap.len: %u)\n",
-            ip_len - raw.len, ip_len, raw.len);
-
         codec_event(codec, DECODE_IPV4_DGRAM_GT_CAPLEN);
         // FIXIT-L we should decode this layer if possible instead of stopping now
         // ip6 etc may have similar issues
@@ -195,10 +187,6 @@ bool Ipv4Codec::decode(const RawData& raw, CodecData& codec, DecodeData& snort)
 
     if (ip_len < hlen)
     {
-        DebugFormat(DEBUG_DECODE,
-            "IP dgm len (%u bytes) < IP hdr "
-            "len (%hu bytes), packet discarded\n", ip_len, hlen);
-
         codec_event(codec, DECODE_IPV4_DGRAM_LT_IPHDR);
         return false;
     }
index 5bd04ce5d21708502a3b84a4fbc2fb96dd16234d..85f24256efdb129d91e1a1d40dfc1e9ba6637a55 100644 (file)
@@ -23,7 +23,6 @@
 #endif
 
 #include "framework/codec.h"
-#include "main/snort_debug.h"
 
 using namespace snort;
 
@@ -55,8 +54,6 @@ bool PppEncap::decode(const RawData& raw, CodecData& codec, DecodeData&)
 {
     uint16_t protocol;
 
-    DebugMessage(DEBUG_DECODE, "PPP Packet!\n");
-
     if (raw.len < 2)
         return false;
 
index d1adf4d10981dbeb3542b0667174b07bcfd444d1..e43e2119a015e172f4e43b2dabb53e01197ee4d7 100644 (file)
@@ -92,28 +92,6 @@ private:
 
 constexpr uint16_t PPPOE_HEADER_LEN = 6;
 
-/* PPPoE types */
-constexpr uint16_t PPPoE_CODE_SESS = 0x00; /* PPPoE session */
-constexpr uint16_t PPPoE_CODE_PADI = 0x09; /* PPPoE Active Discovery Initiation */
-constexpr uint16_t PPPoE_CODE_PADO = 0x07; /* PPPoE Active Discovery Offer */
-constexpr uint16_t PPPoE_CODE_PADR = 0x19; /* PPPoE Active Discovery Request */
-constexpr uint16_t PPPoE_CODE_PADS = 0x65; /* PPPoE Active Discovery Session-confirmation */
-constexpr uint16_t PPPoE_CODE_PADT = 0xa7; /* PPPoE Active Discovery Terminate */
-
-#if 0
-/* PPPoE tag types  -  currently not used*/
-constexpr uint16_t PPPoE_TAG_END_OF_LIST = 0x0000;
-constexpr uint16_t PPPoE_TAG_SERVICE_NAME = 0x0101;
-constexpr uint16_t PPPoE_TAG_AC_NAME = 0x0102;
-constexpr uint16_t PPPoE_TAG_HOST_UNIQ = 0x0103;
-constexpr uint16_t PPPoE_TAG_AC_COOKIE = 0x0104;
-constexpr uint16_t PPPoE_TAG_VENDOR_SPECIFIC = 0x0105;
-constexpr uint16_t PPPoE_TAG_RELAY_SESSION_ID = 0x0110;
-constexpr uint16_t PPPoE_TAG_SERVICE_NAME_ERROR = 0x0201;
-const uint16_t PPPoE_TAG_AC_SYSTEM_ERROR = 0x0202;
-constexpr uint16_t PPPoE_TAG_GENERIC_ERROR = 0x0203;
-#endif
-
 bool PPPoECodec::decode(const RawData& raw,
     CodecData& codec,
     DecodeData&)
@@ -124,136 +102,8 @@ bool PPPoECodec::decode(const RawData& raw,
         return false;
     }
 
-    /* lay the PPP over ethernet structure over the packet data */
-    const PPPoEHdr* const pppoeh = reinterpret_cast<const PPPoEHdr*>(raw.data);
-
-    /* grab out the network type */
-    switch (ppp_type)
-    {
-    case PppoepktType::DISCOVERY:
-        DebugMessage(DEBUG_DECODE, "(PPPOE Discovery) ");
-        break;
-
-    case PppoepktType::SESSION:
-        DebugMessage(DEBUG_DECODE, "(PPPOE Session) ");
-        break;
-    }
-
-#ifdef DEBUG_MSGS
-    switch (pppoeh->code)
-    {
-    case PPPoE_CODE_PADI:
-        /* The Host sends the PADI packet with the DESTINATION_ADDR set
-         * to the broadcast address.  The CODE field is set to 0x09 and
-         * the SESSION_ID MUST be set to 0x0000.
-         *
-         * The PADI packet MUST contain exactly one TAG of TAG_TYPE
-         * Service-Name, indicating the service the Host is requesting,
-         * and any number of other TAG types.  An entire PADI packet
-         * (including the PPPoE header) MUST NOT exceed 1484 octets so
-         * as to leave sufficient room for a relay agent to add a
-         * Relay-Session-Id TAG.
-         */
-        DebugMessage(DEBUG_DECODE, "Active Discovery Initiation (PADI)\n");
-        break;
-
-    case PPPoE_CODE_PADO:
-        /* When the Access Concentrator receives a PADI that it can
-         * serve, it replies by sending a PADO packet.  The
-         * DESTINATION_ADDR is the unicast address of the Host that
-         * sent the PADI.  The CODE field is set to 0x07 and the
-         * SESSION_ID MUST be set to 0x0000.
-         *
-         * The PADO packet MUST contain one AC-Name TAG containing the
-         * Access Concentrator's name, a Service-Name TAG identical to
-         * the one in the PADI, and any number of other Service-Name
-         * TAGs indicating other services that the Access Concentrator
-         * offers.  If the Access Concentrator can not serve the PADI
-         * it MUST NOT respond with a PADO.
-         */
-        DebugMessage(DEBUG_DECODE, "Active Discovery Offer (PADO)\n");
-        break;
-
-    case PPPoE_CODE_PADR:
-        /* Since the PADI was broadcast, the Host may receive more than
-         * one PADO.  The Host looks through the PADO packets it receives
-         * and chooses one.  The choice can be based on the AC-Name or
-         * the Services offered.  The Host then sends one PADR packet
-         * to the Access Concentrator that it has chosen.  The
-         * DESTINATION_ADDR field is set to the unicast Ethernet address
-         * of the Access Concentrator that sent the PADO.  The CODE
-         * field is set to 0x19 and the SESSION_ID MUST be set to 0x0000.
-         *
-         * The PADR packet MUST contain exactly one TAG of TAG_TYPE
-         * Service-Name, indicating the service the Host is requesting,
-         * and any number of other TAG types.
-         */
-        DebugMessage(DEBUG_DECODE, "Active Discovery Request (PADR)\n");
-        break;
-
-    case PPPoE_CODE_PADS:
-        /* When the Access Concentrator receives a PADR packet, it
-         * prepares to begin a PPP session.  It generates a unique
-         * SESSION_ID for the PPPoE session and replies to the Host with
-         * a PADS packet.  The DESTINATION_ADDR field is the unicast
-         * Ethernet address of the Host that sent the PADR.  The CODE
-         * field is set to 0x65 and the SESSION_ID MUST be set to the
-         * unique value generated for this PPPoE session.
-         *
-         * The PADS packet contains exactly one TAG of TAG_TYPE
-         * Service-Name, indicating the service under which Access
-         * Concentrator has accepted the PPPoE session, and any number
-         * of other TAG types.
-         *
-         * If the Access Concentrator does not like the Service-Name in
-         * the PADR, then it MUST reply with a PADS containing a TAG of
-         * TAG_TYPE Service-Name-Error (and any number of other TAG
-         * types).  In this case the SESSION_ID MUST be set to 0x0000.
-         */
-        DebugMessage(DEBUG_DECODE, "Active Discovery "
-            "Session-confirmation (PADS)\n");
-        break;
-
-    case PPPoE_CODE_PADT:
-        /* This packet may be sent anytime after a session is established
-         * to indicate that a PPPoE session has been terminated.  It may
-         * be sent by either the Host or the Access Concentrator.  The
-         * DESTINATION_ADDR field is a unicast Ethernet address, the
-         * CODE field is set to 0xa7 and the SESSION_ID MUST be set to
-         * indicate which session is to be terminated.  No TAGs are
-         * required.
-         *
-         * When a PADT is received, no further PPP traffic is allowed to
-         * be sent using that session.  Even normal PPP termination
-         * packets MUST NOT be sent after sending or receiving a PADT.
-         * A PPP peer SHOULD use the PPP protocol itself to bring down a
-         * PPPoE session, but the PADT MAY be used when PPP can not be
-         * used.
-         */
-        DebugMessage(DEBUG_DECODE, "Active Discovery Terminate (PADT)\n");
-        break;
-
-    case PPPoE_CODE_SESS:
-        DebugMessage(DEBUG_DECODE, "Session Packet (SESS)\n");
-        break;
-
-    default:
-        DebugMessage(DEBUG_DECODE, "(Unknown)\n");
-        break;
-    }
-#else
-    UNUSED(pppoeh);
-    UNUSED(PPPoE_CODE_SESS);
-    UNUSED(PPPoE_CODE_PADI);
-    UNUSED(PPPoE_CODE_PADO);
-    UNUSED(PPPoE_CODE_PADR);
-    UNUSED(PPPoE_CODE_PADS);
-    UNUSED(PPPoE_CODE_PADT);
-#endif
-
     if (ppp_type == PppoepktType::DISCOVERY)
     {
-        DebugMessage(DEBUG_DECODE, "Returning early on PPPOE discovery packet\n");
         return true;
     }
 
index 752750e5169857a6c5d16b8ccba737ed9b162c7a..a5434dc7bd671457e9230567006889eb507269d3 100644 (file)
@@ -105,8 +105,6 @@ bool GtpCodec::decode(const RawData& raw, CodecData& codec, DecodeData& dd)
     switch (version)
     {
     case 0: /*GTP v0*/
-        DebugMessage(DEBUG_DECODE, "GTP v0 packets.\n");
-
         len = GTP_V0_HEADER_LEN;
         if (raw.len < len)
         {
@@ -116,16 +114,12 @@ bool GtpCodec::decode(const RawData& raw, CodecData& codec, DecodeData& dd)
 
         if (raw.len != ((unsigned int)ntohs(hdr->length) + len))
         {
-            DebugFormat(DEBUG_DECODE, "Calculated length %u != %hu in header.\n",
-                raw.len - len, ntohs(hdr->length));
             codec_event(codec, DECODE_GTP_BAD_LEN);
             return false;
         }
 
         break;
     case 1: /*GTP v1*/
-        DebugMessage(DEBUG_DECODE, "GTP v1 packets.\n");
-
         /*Check the length based on optional fields and extension header*/
         if (hdr->flag & 0x07)
         {
@@ -172,15 +166,12 @@ bool GtpCodec::decode(const RawData& raw, CodecData& codec, DecodeData& dd)
 
         if (raw.len != ((unsigned int)ntohs(hdr->length) + GTP_MIN_LEN))
         {
-            DebugFormat(DEBUG_DECODE, "Calculated length %u != %hu in header.\n",
-                raw.len - GTP_MIN_LEN, ntohs(hdr->length));
             codec_event(codec, DECODE_GTP_BAD_LEN);
             return false;
         }
         break;
 
     default:
-        DebugMessage(DEBUG_DECODE, "Unknown protocol version.\n");
         return false;
     }
 
index 49617d35d178d831351de1d6436376104fa1434c..39a46fc1214b9577488dcfbe5f7244afaa2fa37f 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "file_connector.h"
 
-#include "main/snort_debug.h"
 #include "profiler/profiler_defs.h"
 #include "side_channel/side_channel.h"
 
@@ -39,8 +38,6 @@ THREAD_LOCAL ProfileStats file_connector_perfstats;
 
 FileConnectorMsgHandle::FileConnectorMsgHandle(const uint32_t length)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnectorMsgHandle::FileConnectorMsgHandle()\n");
-
     connector_msg.length = length;
     connector_msg.data = new uint8_t[length];
 }
@@ -69,18 +66,11 @@ FileConnectorCommon::~FileConnectorCommon()
 
 FileConnector::FileConnector(FileConnectorConfig* file_connector_config)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnector::FileConnector()\n");
     config = file_connector_config;
 }
 
-FileConnector::~FileConnector()
-{
-    DebugMessage(DEBUG_CONNECTORS,"FileConnector::~FileConnector()\n");
-}
-
 ConnectorMsgHandle* FileConnector::alloc_message(const uint32_t length, const uint8_t** data)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnector::alloc_message()\n");
     FileConnectorMsgHandle* msg = new FileConnectorMsgHandle(length);
 
     *data = (uint8_t*)msg->connector_msg.data;
@@ -90,14 +80,12 @@ ConnectorMsgHandle* FileConnector::alloc_message(const uint32_t length, const ui
 
 void FileConnector::discard_message(ConnectorMsgHandle* msg)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnector::discard_message()\n");
     FileConnectorMsgHandle* fmsg = (FileConnectorMsgHandle*)msg;
     delete fmsg;
 }
 
 bool FileConnector::transmit_message(ConnectorMsgHandle* msg)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnector::transmit_message()\n");
     FileConnectorMsgHandle* fmsg = (FileConnectorMsgHandle*)msg;
     const FileConnectorConfig* cfg = (const FileConnectorConfig*)config;
 
@@ -217,8 +205,6 @@ ConnectorMsgHandle* FileConnector::receive_message_text()
 //  or it does not.
 ConnectorMsgHandle* FileConnector::receive_message(bool)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnector::receive_message()\n");
-
     if ( !file.is_open() )
         return nullptr;
     else
@@ -241,14 +227,12 @@ ConnectorMsgHandle* FileConnector::receive_message(bool)
 
 static Module* mod_ctor()
 {
-    DebugMessage(DEBUG_CONNECTORS,"file_connector:mod_ctor()\n");
     return new FileConnectorModule;
 }
 
 static void mod_dtor(Module* m)
 {
     delete m;
-    DebugMessage(DEBUG_CONNECTORS,"file_connector:mod_dtor(Module*)\n");
 }
 
 static Connector* file_connector_tinit_transmit(std::string filename,
@@ -262,9 +246,6 @@ static Connector* file_connector_tinit_transmit(std::string filename,
     file_connector->file.open(pathname,
         (std::ios::out | (cfg->text_format ? (std::ios::openmode)0 : std::ios::binary)) );
 
-    DebugFormat(DEBUG_CONNECTORS,"file_connector:file_connector_tinit_transmit(): pathname: %s\n",
-        pathname.c_str());
-
     return file_connector;
 }
 
@@ -278,16 +259,12 @@ static Connector* file_connector_tinit_receive(std::string filename,
     (void)get_instance_file(pathname, filename.c_str());
     file_connector->file.open(pathname, (std::ios::in | std::ios::binary) );
 
-    DebugFormat(DEBUG_CONNECTORS,"file_connector:file_connector_tinit_receive(): pathname: %s\n",
-        pathname.c_str());
-
     return file_connector;
 }
 
 // Create a per-thread object
 static Connector* file_connector_tinit(ConnectorConfig* config)
 {
-    DebugMessage(DEBUG_CONNECTORS,"file_connector:file_connector_tinit()\n");
     FileConnectorConfig* cfg = (FileConnectorConfig*)config;
 
     std::string filename = FILE_CONNECTOR_NAME;
@@ -305,7 +282,6 @@ static Connector* file_connector_tinit(ConnectorConfig* config)
 
 static void file_connector_tterm(Connector* connector)
 {
-    DebugMessage(DEBUG_CONNECTORS,"file_connector:file_connector_tterm()\n");
     FileConnector* file_connector = (FileConnector*)connector;
 
     file_connector->file.close();
@@ -314,7 +290,6 @@ static void file_connector_tterm(Connector* connector)
 
 static ConnectorCommon* file_connector_ctor(Module* m)
 {
-    DebugMessage(DEBUG_CONNECTORS,"file_connector:file_connector_ctor(Module*)\n");
     FileConnectorModule* mod = (FileConnectorModule*)m;
     FileConnectorCommon* file_connector_common = new FileConnectorCommon(
         mod->get_and_clear_config());
@@ -324,7 +299,6 @@ static ConnectorCommon* file_connector_ctor(Module* m)
 
 static void file_connector_dtor(ConnectorCommon* c)
 {
-    DebugMessage(DEBUG_CONNECTORS,"file_connector:file_connector_dtor(ConnectorCommon*)\n");
     FileConnectorCommon* fc = (FileConnectorCommon*)c;
     delete fc;
 }
index 6a3ff1202d3cefa6ae8153042bd232b77bf55bce..449d4bc1b3d083debc4f3aa440cc6c00a5fc1657 100644 (file)
@@ -62,7 +62,6 @@ class FileConnector : public snort::Connector
 {
 public:
     FileConnector(FileConnectorConfig*);
-    ~FileConnector() override;
     snort::ConnectorMsgHandle* alloc_message(const uint32_t, const uint8_t**) override;
     void discard_message(snort::ConnectorMsgHandle*) override;
     bool transmit_message(snort::ConnectorMsgHandle*) override;
index 4184b07ed7fc658d3cde701b8f20b6cf7b1c1254..0ed1d09d651a57249ac54eee8d7930886b27e7c1 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "file_connector_module.h"
 
-#include "main/snort_debug.h"
-
 using namespace snort;
 
 static const Parameter file_connector_params[] =
@@ -61,14 +59,12 @@ extern THREAD_LOCAL ProfileStats file_connector_perfstats;
 FileConnectorModule::FileConnectorModule() :
     Module(FILE_CONNECTOR_NAME, FILE_CONNECTOR_HELP, file_connector_params)
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnectorModule::FileConnectorModule()\n");
     config = nullptr;
     config_set = new FileConnectorConfig::FileConnectorConfigSet;
 }
 
 FileConnectorModule::~FileConnectorModule()
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnectorModule::~FileConnectorModule()\n");
     if ( config )
         delete config;
     if ( config_set )
@@ -78,14 +74,8 @@ FileConnectorModule::~FileConnectorModule()
 ProfileStats* FileConnectorModule::get_profile() const
 { return &file_connector_perfstats; }
 
-bool FileConnectorModule::set(const char* fqn, Value& v, SnortConfig*)
+bool FileConnectorModule::set(const char*, Value& v, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_CONNECTORS,"FileConnectorModule::set(): %s, %s\n", fqn, v.get_name());
-#else
-    UNUSED(fqn);
-#endif
-
     if ( v.is("connector") )
         config->connector_name = v.get_string();
 
@@ -126,21 +116,14 @@ bool FileConnectorModule::set(const char* fqn, Value& v, SnortConfig*)
 // clear my working config and hand-over the compiled list to the caller
 FileConnectorConfig::FileConnectorConfigSet* FileConnectorModule::get_and_clear_config()
 {
-    DebugMessage(DEBUG_CONNECTORS,"FileConnectorModule::get_and_clear_config()\n");
     FileConnectorConfig::FileConnectorConfigSet* temp_config = config_set;
     config = nullptr;
     config_set = nullptr;
     return temp_config;
 }
 
-bool FileConnectorModule::begin(const char* fqn, int idx, SnortConfig*)
+bool FileConnectorModule::begin(const char*, int, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_CONNECTORS,"FileConnectorModule::begin(): %s, %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-    UNUSED(idx);
-#endif
     if ( !config )
     {
         config = new FileConnectorConfig;
@@ -148,14 +131,8 @@ bool FileConnectorModule::begin(const char* fqn, int idx, SnortConfig*)
     return true;
 }
 
-bool FileConnectorModule::end(const char* fqn, int idx, SnortConfig*)
+bool FileConnectorModule::end(const char*, int idx, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_CONNECTORS,"FileConnectorModule::end(): %s, %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-#endif
-
     if (idx != 0)
     {
         config_set->push_back(config);
index 54ac2f74016ea986cda0037f9912a312bea2649c..08301667a5108afb9c5610f0fe3af4af057f21bc 100644 (file)
@@ -40,10 +40,6 @@ void show_stats(PegCount*, const PegInfo*, unsigned, const char*) { }
 void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*) { }
 void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*, FILE*) { }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 char* snort_strdup(const char* s)
 { return strdup(s); }
 
index 41cefaa614faaf1742e687010eb2e0677cb680ff..0fd7170e7caa7f12990a05837e5bf1ac085f8541 100644 (file)
@@ -57,10 +57,6 @@ void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*, FILE*) { }
 const char* get_instance_file(std::string& file, const char* name)
 { file += name; return nullptr; }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 FileConnectorModule::FileConnectorModule() :
     Module("FC", "FC Help", nullptr)
 { }
index 93d5580172b9397cf2a20ab4665f31d62f15c5f5..a20c0fd0232ffaf8df78bd8637713422fbacd932 100644 (file)
@@ -30,7 +30,6 @@
 #include <unistd.h>
 
 #include "log/messages.h"
-#include "main/snort_debug.h"
 #include "main/thread.h"
 #include "profiler/profiler_defs.h"
 
@@ -45,8 +44,6 @@ THREAD_LOCAL ProfileStats tcp_connector_perfstats;
 
 TcpConnectorMsgHandle::TcpConnectorMsgHandle(const uint32_t length)
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnectorMsgHandle::TcpConnectorMsgHandle()\n");
-
     connector_msg.length = length;
     connector_msg.data = new uint8_t[length];
 }
@@ -213,7 +210,6 @@ void TcpConnector::stop_receive_thread()
 
 TcpConnector::TcpConnector(TcpConnectorConfig* tcp_connector_config, int sfd)
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnector::TcpConnector()\n");
     receive_thread = nullptr;
     config = tcp_connector_config;
     receive_ring = new ReceiveRing(50);
@@ -224,7 +220,6 @@ TcpConnector::TcpConnector(TcpConnectorConfig* tcp_connector_config, int sfd)
 
 TcpConnector::~TcpConnector()
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnector::~TcpConnector()\n");
     stop_receive_thread();
     delete receive_ring;
     close(sock_fd);
@@ -232,7 +227,6 @@ TcpConnector::~TcpConnector()
 
 ConnectorMsgHandle* TcpConnector::alloc_message(const uint32_t length, const uint8_t** data)
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnector::alloc_message()\n");
     TcpConnectorMsgHandle* msg = new TcpConnectorMsgHandle(length);
 
     *data = (uint8_t*)msg->connector_msg.data;
@@ -242,14 +236,12 @@ ConnectorMsgHandle* TcpConnector::alloc_message(const uint32_t length, const uin
 
 void TcpConnector::discard_message(ConnectorMsgHandle* msg)
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnector::discard_message()\n");
     TcpConnectorMsgHandle* tmsg = (TcpConnectorMsgHandle*)msg;
     delete tmsg;
 }
 
 bool TcpConnector::transmit_message(ConnectorMsgHandle* msg)
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnector::transmit_message()\n");
     TcpConnectorMsgHandle* tmsg = (TcpConnectorMsgHandle*)msg;
 
     if ( sock_fd < 0 )
@@ -295,14 +287,12 @@ ConnectorMsgHandle* TcpConnector::receive_message(bool)
 
 static Module* mod_ctor()
 {
-    DebugMessage(DEBUG_CONNECTORS,"tcp_connector:mod_ctor()\n");
     return new TcpConnectorModule;
 }
 
 static void mod_dtor(Module* m)
 {
     delete m;
-    DebugMessage(DEBUG_CONNECTORS,"tcp_connector:mod_dtor(Module*)\n");
 }
 
 static TcpConnector* tcp_connector_tinit_call(TcpConnectorConfig* cfg, const char* port)
@@ -417,7 +407,6 @@ static TcpConnector* tcp_connector_tinit_answer(TcpConnectorConfig* cfg, const c
 // Create a per-thread object
 static Connector* tcp_connector_tinit(ConnectorConfig* config)
 {
-    DebugMessage(DEBUG_CONNECTORS,"tcp_connector:tcp_connector_tinit()\n");
     TcpConnectorConfig* cfg = (TcpConnectorConfig*)config;
 
     uint16_t instance = (uint16_t)get_instance_id();
@@ -445,7 +434,6 @@ static Connector* tcp_connector_tinit(ConnectorConfig* config)
 
 static void tcp_connector_tterm(Connector* connector)
 {
-    DebugMessage(DEBUG_CONNECTORS,"tcp_connector:tcp_connector_tterm()\n");
     TcpConnector* tcp_connector = (TcpConnector*)connector;
 
     delete tcp_connector;
@@ -453,7 +441,6 @@ static void tcp_connector_tterm(Connector* connector)
 
 static ConnectorCommon* tcp_connector_ctor(Module* m)
 {
-    DebugMessage(DEBUG_CONNECTORS,"tcp_connector:tcp_connector_ctor(Module*)\n");
     TcpConnectorModule* mod = (TcpConnectorModule*)m;
     TcpConnectorCommon* tcp_connector_common = new TcpConnectorCommon(
         mod->get_and_clear_config());
@@ -463,7 +450,6 @@ static ConnectorCommon* tcp_connector_ctor(Module* m)
 
 static void tcp_connector_dtor(ConnectorCommon* c)
 {
-    DebugMessage(DEBUG_CONNECTORS,"tcp_connector:tcp_connector_dtor(ConnectorCommon*)\n");
     TcpConnectorCommon* fc = (TcpConnectorCommon*)c;
     delete fc;
 }
index 7bc9a3581a18b0d8138eff925df456a087822a42..2f68b375b55daa26434949f60b02d05c93ce0fcc 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "tcp_connector_module.h"
 
-#include "main/snort_debug.h"
-
 using namespace snort;
 
 static const Parameter tcp_connector_params[] =
@@ -61,14 +59,12 @@ extern THREAD_LOCAL ProfileStats tcp_connector_perfstats;
 TcpConnectorModule::TcpConnectorModule() :
     Module(TCP_CONNECTOR_NAME, TCP_CONNECTOR_HELP, tcp_connector_params)
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnectorModule::TcpConnectorModule()\n");
     config = nullptr;
     config_set = new TcpConnectorConfig::TcpConnectorConfigSet;
 }
 
 TcpConnectorModule::~TcpConnectorModule()
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnectorModule::~TcpConnectorModule()\n");
     if ( config )
         delete config;
     if ( config_set )
@@ -78,14 +74,8 @@ TcpConnectorModule::~TcpConnectorModule()
 ProfileStats* TcpConnectorModule::get_profile() const
 { return &tcp_connector_perfstats; }
 
-bool TcpConnectorModule::set(const char* fqn, Value& v, SnortConfig*)
+bool TcpConnectorModule::set(const char*, Value& v, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_CONNECTORS,"TcpConnectorModule::set(): %s, %s\n", fqn, v.get_name());
-#else
-    UNUSED(fqn);
-#endif
-
     if ( v.is("connector") )
         config->connector_name = v.get_string();
 
@@ -121,21 +111,14 @@ bool TcpConnectorModule::set(const char* fqn, Value& v, SnortConfig*)
 // clear my working config and hand-over the compiled list to the caller
 TcpConnectorConfig::TcpConnectorConfigSet* TcpConnectorModule::get_and_clear_config()
 {
-    DebugMessage(DEBUG_CONNECTORS,"TcpConnectorModule::get_and_clear_config()\n");
     TcpConnectorConfig::TcpConnectorConfigSet* temp_config = config_set;
     config = nullptr;
     config_set = nullptr;
     return temp_config;
 }
 
-bool TcpConnectorModule::begin(const char* fqn, int idx, SnortConfig*)
+bool TcpConnectorModule::begin(const char*, int, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_CONNECTORS,"TcpConnectorModule::begin(): %s, %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-    UNUSED(idx);
-#endif
     if ( !config )
     {
         config = new TcpConnectorConfig;
@@ -143,14 +126,8 @@ bool TcpConnectorModule::begin(const char* fqn, int idx, SnortConfig*)
     return true;
 }
 
-bool TcpConnectorModule::end(const char* fqn, int idx, SnortConfig*)
+bool TcpConnectorModule::end(const char*, int idx, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_CONNECTORS,"TcpConnectorModule::end(): %s, %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-#endif
-
     if (idx != 0)
     {
         config_set->push_back(config);
index 818aa1efba0f1a0b2f2a4786b21f40ea16cbd420..4d356e80077e66b3c381174728ca5d7fb86bc4c2 100644 (file)
@@ -40,10 +40,6 @@ void show_stats(PegCount*, const PegInfo*, unsigned, const char*) { }
 void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*) { }
 void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*, FILE*) { }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 char* snort_strdup(const char* s)
 { return strdup(s); }
 
index b6f950031301146985e0f42e09e7ea4dda28856b..faebd00af66f96b5b22e7d945701f10358c008e7 100644 (file)
@@ -74,9 +74,6 @@ void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*, FILE*) { }
 unsigned get_instance_id()
 { return s_instance; }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
 void ErrorMessage(const char*, ...) { }
 void LogMessage(const char*, ...) { }
 
index 86b061f9bb7407eecaf743e43cf5e33979eab4c1..6b9aabd0df73d0ee6bcacc840f722971e8280a2f 100644 (file)
@@ -26,7 +26,6 @@
 #include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "main/thread_config.h"
 #include "packet_io/active.h"
 #include "time/packet_time.h"
@@ -147,7 +146,6 @@ FileContext* FileCache::find(const FileHashKey& hashKey, int64_t timeout)
 
     if (!xhash_count(fileHash))
     {
-        DebugMessage(DEBUG_FILE, "No expected sessions\n");
         return nullptr;
     }
 
@@ -163,11 +161,9 @@ FileContext* FileCache::find(const FileHashKey& hashKey, int64_t timeout)
         return nullptr;
     }
 
-    DebugMessage(DEBUG_FILE, "Found resumed file\n");
     time_t now = packet_time();
     if (node->expires && now > node->expires)
     {
-        DebugMessage(DEBUG_FILE, "File expired\n");
         xhash_free_node(fileHash, hash_node);
         return nullptr;
     }
@@ -297,7 +293,6 @@ FileVerdict FileCache::cached_verdict_lookup(Flow* flow, FileInfo* file,
 
     if (file_found)
     {
-        DebugMessage(DEBUG_FILE, "Found resumed file\n");
         /*Query the file policy in case verdict has been changed*/
         verdict = check_verdict(flow, file_found, policy);
         apply_verdict(flow, file_found, verdict, true, policy);
index ed42f0a8da7651a76b08dff9b2bf64122c5adaac..867547e5bad3e6bace715fd0e748b69c4fae62fb 100644 (file)
@@ -194,7 +194,6 @@ inline FileCaptureBlock* FileCapture::create_file_buffer()
 
     if (fileBlock == nullptr)
     {
-        FILE_DEBUG_MSGS("Failed to get file capture memory!\n");
         file_counts.file_memcap_failures_total++;
         return nullptr;
     }
@@ -224,7 +223,6 @@ inline FileCaptureState FileCapture::save_to_file_buffer(const uint8_t* file_dat
 
     if ( data_size + (int64_t)capture_size > max_size)
     {
-        FILE_DEBUG_MSGS("Exceeding max file capture size!\n");
         file_counts.file_size_max++;
         capture_state = FILE_CAPTURE_MAX;
         return FILE_CAPTURE_MAX;
index 4707c1ecd004b14a4c58d248ce39add336316221..ec8867c96fe51007387417a05e10e97bd245332e 100644 (file)
 #define FREE_MAGIC    0x2525252525252525
 typedef uint64_t MagicType;
 
-#ifdef DEBUG_MSGS
-void FileMemPool::verify()
-{
-    uint64_t free_size;
-    uint64_t release_size;
-
-    free_size = cbuffer_used(free_list);
-    release_size = cbuffer_used(released_list);
-
-    if (free_size > cbuffer_size(free_list))
-    {
-        DebugMessage(DEBUG_FILE, "file_mempool: failed to verify free list!\n");
-    }
-
-    if (release_size > cbuffer_size(released_list))
-    {
-        DebugMessage(DEBUG_FILE, "file_mempool: failed to verify release list!\n");
-    }
-
-    /* The free mempool and size of release mempool should be smaller than
-     * or equal to the size of mempool
-     */
-    if (free_size + release_size > total)
-    {
-        DebugMessage(DEBUG_FILE, "file_mempool: failed to verify mempool size!\n");
-    }
-}
-
-#endif
 
 void FileMemPool::free_pools()
 {
@@ -104,7 +75,6 @@ FileMemPool::FileMemPool(uint64_t num_objects, size_t o_size)
     free_list = cbuffer_init(num_objects);
     if (!free_list)
     {
-        DebugMessage(DEBUG_FILE, "file_mempool: Failed to init free list\n");
         free_pools();
         return;
     }
@@ -112,7 +82,6 @@ FileMemPool::FileMemPool(uint64_t num_objects, size_t o_size)
     released_list = cbuffer_init(num_objects);
     if (!released_list)
     {
-        DebugMessage(DEBUG_FILE, "file_mempool: Failed to init release list\n");
         free_pools();
         return;
     }
@@ -124,7 +93,6 @@ FileMemPool::FileMemPool(uint64_t num_objects, size_t o_size)
 
         if (cbuffer_write(free_list,  data))
         {
-            DebugMessage(DEBUG_FILE, "file_mempool: Failed to add to free list\n");
             free_pools();
             return;
         }
@@ -165,13 +133,6 @@ void* FileMemPool::m_alloc()
         }
     }
 
-    if (*(MagicType*)b != FREE_MAGIC)
-    {
-        DebugMessage(DEBUG_FILE, "file_mempool_alloc(): Allocation errors!\n");
-    }
-
-    DEBUG_WRAP(verify(); );
-
     return b;
 }
 
@@ -191,7 +152,6 @@ int FileMemPool::remove(CircularBuffer* cb, void* obj)
 
     if (*(MagicType*)obj == FREE_MAGIC)
     {
-        DebugMessage(DEBUG_FILE, "file_mempool_remove(): Double free!\n");
         return FILE_MEM_FAIL;
     }
 
@@ -206,7 +166,6 @@ int FileMemPool::m_free(void* obj)
 
     int ret = remove(free_list, obj);
 
-    DEBUG_WRAP(verify(); );
 
     return ret;
 }
@@ -225,7 +184,6 @@ int FileMemPool::m_release(void* obj)
     /*A writer that might from different thread*/
     int ret = remove(released_list, obj);
 
-    DEBUG_WRAP(verify(); );
 
     return ret;
 }
index 4981cd6a7ea0a5caf9b06003a7b4febbc581ecee..993b916e305beb06ffdd1860eb8dafe1d395d8cc 100644 (file)
@@ -69,8 +69,6 @@ struct FileStats
 extern THREAD_LOCAL FileCounts file_counts;
 extern THREAD_LOCAL FileStats* file_stats;
 
-#define FILE_DEBUG_MSGS(msg) DebugMessage(DEBUG_FILE, msg)
-
 void file_stats_init();
 void file_stats_term();
 
index cf5ef9e34d3fbfc1e1a70eafe9a9ccb1533d6575..cf10c71dff4194b8170f08a8295f94cfe458f23f 100644 (file)
@@ -28,7 +28,6 @@
 #include "hash/zhash.h"
 #include "helpers/flag_context.h"
 #include "ips_options/ips_flowbits.h"
-#include "main/snort_debug.h"
 #include "packet_io/active.h"
 #include "time/packet_time.h"
 #include "utils/stats.h"
@@ -197,7 +196,6 @@ unsigned FlowCache::prune_stale(uint32_t thetime, const Flow* save_me)
         if ( flow->last_data_seen + config.pruning_timeout >= thetime )
             break;
 
-        DebugMessage(DEBUG_STREAM, "pruning stale flow\n");
         flow->ssn_state.session_flags |= SSNFLAG_TIMEDOUT;
         release(flow, PruneReason::IDLE);
         ++pruned;
@@ -287,15 +285,6 @@ bool FlowCache::prune_one(PruneReason reason, bool do_cleanup)
     flow->ssn_state.session_flags |= SSNFLAG_PRUNED;
     release(flow, reason, do_cleanup);
 
-#ifdef DEBUG_MSGS
-    const char* s =
-        (reason == PruneReason::MEMCAP) ? "memcap" :
-        (reason == PruneReason::PREEMPTIVE) ? "preemptive" :
-        "other";
-
-    DebugFormat(DEBUG_MEMORY, "prune one for reason %s\n", s);
-#endif
-
     return true;
 }
 
@@ -321,7 +310,6 @@ unsigned FlowCache::timeout(unsigned num_flows, time_t thetime)
             continue;
         }
 
-        DebugMessage(DEBUG_STREAM, "retiring stale flow\n");
         flow->ssn_state.session_flags |= SSNFLAG_TIMEDOUT;
         release(flow, PruneReason::IDLE);
 
index e21b507c6d40ecd141db66bde967c3d80fe5b672..4856873b91b071117bb6eed6ac409d02b90a3862 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "framework/counts.h"
 #include "log/messages.h"
-#include "main/snort_debug.h"
 #include "profiler/profiler_defs.h"
 #include "stream/stream.h"
 #include "time/packet_time.h"
@@ -163,7 +162,6 @@ void FlowHAState::reset()
 
 FlowHAClient::FlowHAClient(uint8_t length, bool session_client)
 {
-    DebugMessage(DEBUG_HA,"FlowHAClient::FlowHAClient()\n");
     if ( !s_client_map )
         return;
 
@@ -302,8 +300,6 @@ static uint16_t calculate_update_msg_content_length(Flow* flow)
         {
             assert((*s_client_map)[i]);
             length += ((*s_client_map)[i]->get_message_size() + sizeof(HAClientHeader));
-            DebugFormat(DEBUG_HA,
-                "HighAvailability::calculate_update_msg_content_length(): length: %d\n", length);
         }
     }
 
@@ -426,7 +422,6 @@ static void consume_receive_message(HAMessage* msg)
 HighAvailability::HighAvailability(PortBitSet* ports, bool)
 {
     using namespace std::placeholders;
-    DebugMessage(DEBUG_HA,"HighAvailability::HighAvailability()\n");
 
     // If we have ports, configure the side channel
     if ( ports != nullptr )
@@ -460,8 +455,6 @@ HighAvailability::HighAvailability(PortBitSet* ports, bool)
 
 HighAvailability::~HighAvailability()
 {
-    DebugMessage(DEBUG_HA,"HighAvailability::~HighAvailability()\n");
-
     if ( sc )
     {
         sc->unregister_receive_handler();
@@ -474,9 +467,6 @@ void HighAvailability::receive_handler(SCMessage* sc_msg)
 {
     assert(sc_msg);
 
-    DebugFormat(DEBUG_HA,"HighAvailability::receive_handler: port: %hu, length: %u\n",
-        sc_msg->hdr->port, sc_msg->content_length);
-
     // SC received messages must have reference back to SideChannel object
     assert(sc_msg->sc);
 
@@ -488,8 +478,6 @@ void HighAvailability::receive_handler(SCMessage* sc_msg)
 
 void HighAvailability::process_update(Flow* flow, const DAQ_PktHdr_t* pkthdr)
 {
-    DebugMessage(DEBUG_HA,"HighAvailability::process_update()\n");
-
     // Only looking for side channel processing - FIXIT-H
     UNUSED(pkthdr); // until we add DAQ communications channel
     if ( !sc || !flow )
@@ -523,8 +511,6 @@ void HighAvailability::process_update(Flow* flow, const DAQ_PktHdr_t* pkthdr)
 
 void HighAvailability::process_deletion(Flow* flow)
 {
-    DebugMessage(DEBUG_HA,"HighAvailability::process_deletion()\n");
-
     // No need to send message if we already have, we are in standby, or
     // we have just been created and haven't yet sent an update
     if ( flow->ha_state->check_any(FlowHAState::NEW |
@@ -558,7 +544,6 @@ void HighAvailability::process_receive()
 bool HighAvailabilityManager::instantiate(PortBitSet* mod_ports, bool mod_use_daq_channel,
         struct timeval* min_session_lifetime, struct timeval* min_sync_interval)
 {
-    DebugMessage(DEBUG_HA,"HighAvailabilityManager::instantiate()\n");
     ports = mod_ports;
     FlowHAState::config_timers(*min_session_lifetime, *min_sync_interval);
     use_daq_channel = mod_use_daq_channel;
@@ -569,15 +554,12 @@ bool HighAvailabilityManager::instantiate(PortBitSet* mod_ports, bool mod_use_da
 // Called prior to the starts of configuration in the main thread.
 void HighAvailabilityManager::pre_config_init()
 {
-    DebugFormat(DEBUG_HA,"HighAvailabilityManager::pre_config_init(): key size: %zu\n",
-        sizeof(FlowKey));
     ports = nullptr;
 }
 
 // Called within the packet thread prior to packet processing
 void HighAvailabilityManager::thread_init()
 {
-    DebugMessage(DEBUG_HA,"HighAvailabilityManager::thread_init()\n");
     // create a a thread local instance iff we are configured to operate.
     if ( (ports != nullptr) || use_daq_channel )
         ha = new HighAvailability(ports,use_daq_channel);
@@ -593,7 +575,6 @@ void HighAvailabilityManager::thread_term_beginning()
 // Called in the packet thread at run-down
 void HighAvailabilityManager::thread_term()
 {
-    DebugMessage(DEBUG_HA,"HighAvailabilityManager::thread_term()\n");
     if ( ha != nullptr )
     {
         delete ha;
index f65c5e4e7786c8ab32b39f121187f9ab51dd237a..1f272f365dd55a9e8475ccb0a21cc2bf2c41afec 100644 (file)
@@ -67,7 +67,6 @@ static void convert_real_seconds_to_timeval(double seconds, struct timeval* tv)
 HighAvailabilityModule::HighAvailabilityModule() :
     Module(HA_NAME, HA_HELP, ha_params)
 {
-    DebugMessage(DEBUG_HA,"HighAvailabilityModule::HighAvailabilityModule()\n");
     config.enabled = false;
     config.daq_channel = false;
     config.ports = nullptr;
@@ -77,21 +76,14 @@ HighAvailabilityModule::HighAvailabilityModule() :
 
 HighAvailabilityModule::~HighAvailabilityModule()
 {
-    DebugMessage(DEBUG_HA,"HighAvailabilityModule::~HighAvailabilityModule()\n");
     delete config.ports;
 }
 
 ProfileStats* HighAvailabilityModule::get_profile() const
 { return &ha_perf_stats; }
 
-bool HighAvailabilityModule::set(const char* fqn, Value& v, SnortConfig*)
+bool HighAvailabilityModule::set(const char*, Value& v, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_HA,"HighAvailabilityModule::set(): %s %s\n", fqn, v.get_name());
-#else
-    UNUSED(fqn);
-#endif
-
     if ( v.is("enable") )
         config.enabled = v.get_bool();
 
@@ -118,27 +110,13 @@ bool HighAvailabilityModule::set(const char* fqn, Value& v, SnortConfig*)
     return true;
 }
 
-bool HighAvailabilityModule::begin(const char* fqn, int idx, SnortConfig*)
+bool HighAvailabilityModule::begin(const char*, int, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_HA,"HighAvailabilityModule::begin(): %s %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-    UNUSED(idx);
-#endif
-
     return true;
 }
 
-bool HighAvailabilityModule::end(const char* fqn, int idx, SnortConfig*)
+bool HighAvailabilityModule::end(const char*, int, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_HA,"HighAvailabilityModule::end(): %s %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-    UNUSED(idx);
-#endif
-
     if ( config.enabled &&
         !HighAvailabilityManager::instantiate(config.ports, config.daq_channel,
                         &config.min_session_lifetime, &config.min_sync_interval) )
index 7f9f7c217b36c698629a680bb642dbd07c83a25c..68cf340df1b785a50b8123509d1167fa44ddebbe 100644 (file)
@@ -48,10 +48,6 @@ void ParseWarning(WarningGroup, const char*, ...) { }
 
 char* snort_strdup(const char* str) { return strdup(str); }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 static bool s_port_1_set = false;
 static bool s_use_daq = false;
 static bool s_instantiate_called = false;
index 94706d1fdba4ed4b5bc65e41acf3e78388eee2c6..5fd264458506d80d4008b3a3178a5f1d8c7ec8c5 100644 (file)
@@ -155,10 +155,6 @@ void Stream::delete_flow(const FlowKey* flowkey)
 void ErrorMessage(const char*,...) { }
 void LogMessage(const char*,...) { }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 void packet_gettimeofday(struct timeval* tv)
 { *tv = s_packet_time; }
 
@@ -167,8 +163,6 @@ Flow::Flow() { ha_state = new FlowHAState; key = new FlowKey; }
 SideChannel* SideChannelManager::get_side_channel(SCPort)
 { return &s_side_channel; }
 
-SideChannel::~SideChannel() = default;
-
 SideChannel::SideChannel() = default;
 
 Connector::Direction SideChannel::get_direction()
index e672f38cdbb67cd2c6d73088a316112548336c62..0595a3936ebf27944211b24e1a13b8614b987db9 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <mutex>
 
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 #include "protocols/tcp.h"
 #include "utils/util.h"
@@ -79,8 +78,6 @@ FILE* OpenAlertFile(const char* filearg)
     std::string name;
     const char* filename = get_instance_file(name, filearg);
 
-    DebugFormat(DEBUG_INIT,"Opening alert file: %s\n", filename);
-
     if ((file = fopen(filename, "a")) == nullptr)
     {
         FatalError("OpenAlertFile() => fopen() alert file %s: %s\n",
@@ -116,7 +113,6 @@ int RollAlertFile(const char* filearg)
 
     SnortSnprintf(newname, sizeof(newname)-1, "%s.%lu", oldname, (unsigned long)now);
 
-    DebugFormat(DEBUG_INIT,"Rolling alert file: %s\n", newname);
 
     if ( rename(oldname, newname) )
     {
index 12a79704df33819a6320604928efa4b7f33914e5..928c82d6adc03e41e89559f603f34e0fc470921d 100644 (file)
@@ -180,8 +180,6 @@ void FullLogger::alert(Packet* p, const char* msg, const Event& event)
             TextLog_NewLine(full_log);
     }
 
-    DebugMessage(DEBUG_LOG, "Logging Alert data!\n");
-
     LogTimeStamp(full_log, p);
     TextLog_Putc(full_log, ' ');
 
index 9e11dd15c667da1373a5556c77675763497590b4..1242b250f2c0cd7ba96e08e26f41f47b1d4e3aa8 100644 (file)
@@ -347,8 +347,6 @@ static void _Unified2LogPacketAlert(
     {
         logheader.event_id = htonl(event->event_reference);
         logheader.event_second = htonl(event->ref_time.tv_sec);
-
-        DebugMessage(DEBUG_LOG, "------------\n");
     }
     else
     {
index cccf1423253ef9f4936582e581d4a753ab88ba97..266d89513c24fb03d4cbd1911b59b93c76e21f00 100644 (file)
@@ -37,7 +37,6 @@
 #include "main/shell.h"
 #include "main/snort.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "main/snort_module.h"
 #include "main/swapper.h"
 #include "main/thread_config.h"
@@ -190,14 +189,7 @@ bool Pig::queue_command(AnalyzerCommand* ac, bool orphan)
             orphan_commands.push(ac);
         return false;
     }
-
-#ifdef DEBUG_MSGS
-    unsigned ac_ref_count = ac->get();
-    DebugFormat(DEBUG_ANALYZER, "[%u] Queuing command %s for execution (refcount %u)\n",
-            idx, ac->stringify(), ac_ref_count);
-#else
     ac->get();
-#endif
     analyzer->execute(ac);
     return true;
 }
@@ -207,15 +199,8 @@ void Pig::reap_command(AnalyzerCommand* ac)
     unsigned ac_ref_count = ac->put();
     if (ac_ref_count == 0)
     {
-        DebugFormat(DEBUG_ANALYZER, "[%u] Destroying completed command %s\n",
-                idx, ac->stringify());
         delete ac;
     }
-#ifdef DEBUG_MSGS
-    else
-        DebugFormat(DEBUG_ANALYZER, "[%u] Reaped ongoing command %s (refcount %u)\n",
-                idx, ac->stringify(), ac_ref_count);
-#endif
 }
 
 void Pig::reap_commands()
@@ -260,8 +245,6 @@ void snort::main_broadcast_command(AnalyzerCommand* ac)
 {
     unsigned dispatched = 0;
 
-    DebugFormat(DEBUG_ANALYZER, "Broadcasting %s command\n", ac->stringify());
-
     for (unsigned idx = 0; idx < max_pigs; ++idx)
     {
         if (pigs[idx].queue_command(ac))
@@ -602,7 +585,6 @@ static void reap_commands()
     {
         AnalyzerCommand* ac = orphan_commands.front();
         orphan_commands.pop();
-        DebugFormat(DEBUG_ANALYZER, "Destroying orphan command %s\n", ac->stringify());
         delete ac;
     }
 }
index 3e8bab9b030036c12b05ffdd6f1fabe0b2ebf3cb..bb764dfd023151d9726f8097ac78b96d4ecbce0f 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "analyzer_command.h"
 #include "snort.h"
-#include "snort_debug.h"
 #include "thread.h"
 
 using namespace snort;
@@ -180,7 +179,6 @@ void Analyzer::start()
         exit_requested = true;
     }
     set_state(State::STARTED);
-    DebugMessage(DEBUG_ANALYZER, "Handled START command\n");
 }
 
 void Analyzer::run(bool paused)
@@ -191,13 +189,11 @@ void Analyzer::run(bool paused)
         set_state(State::PAUSED);
     else
         set_state(State::RUNNING);
-    DebugMessage(DEBUG_ANALYZER, "Handled RUN command\n");
 }
 
 void Analyzer::stop()
 {
     exit_requested = true;
-    DebugMessage(DEBUG_ANALYZER, "Handled STOP command\n");
 }
 
 void Analyzer::pause()
@@ -222,6 +218,5 @@ void Analyzer::reload_daq()
 {
     if (daq_instance)
         daq_instance->reload();
-    DebugMessage(DEBUG_ANALYZER, "Handled RELOAD command\n");
 }
 
index 2ea5c27008dab444271ecd8936d8fb9a7a5bad36..732b6ab95a6a46bb21b2f1f9e9ce283d72fed37a 100644 (file)
@@ -627,7 +627,6 @@ void SnortConfig::set_daemon(bool enabled)
 {
     if (enabled)
     {
-        DebugMessage(DEBUG_INIT, "Daemon mode flag set\n");
         run_flags |= RUN_FLAG__DAEMON;
     }
     else
@@ -638,7 +637,6 @@ void SnortConfig::set_decode_data_link(bool enabled)
 {
     if (enabled)
     {
-        DebugMessage(DEBUG_INIT, "Decode DLL set\n");
         output_flags |= OUTPUT_FLAG__SHOW_DATA_LINK;
     }
     else
@@ -650,7 +648,6 @@ void SnortConfig::set_dump_chars_only(bool enabled)
     if (enabled)
     {
         /* dump the application layer as text only */
-        DebugMessage(DEBUG_INIT, "Character payload dump set\n");
         output_flags |= OUTPUT_FLAG__CHAR_DATA;
     }
     else
@@ -662,7 +659,6 @@ void SnortConfig::set_dump_payload(bool enabled)
     if (enabled)
     {
         /* dump the application layer */
-        DebugMessage(DEBUG_INIT, "Payload dump set\n");
         output_flags |= OUTPUT_FLAG__APP_DATA;
     }
     else
@@ -673,7 +669,6 @@ void SnortConfig::set_dump_payload_verbose(bool enabled)
 {
     if (enabled)
     {
-        DebugMessage(DEBUG_INIT, "Verbose packet bytecode dumps enabled\n");
         output_flags |= OUTPUT_FLAG__VERBOSE_DUMP;
     }
     else
@@ -736,8 +731,6 @@ void SnortConfig::set_obfuscation_mask(const char* mask)
    if (!mask)
         return;
 
-    DebugFormat(DEBUG_INIT, "Got obfus data: %s\n", mask);
-
     output_flags |= OUTPUT_FLAG__OBFUSCATE;
 
     obfuscation_net.set(mask);
@@ -817,7 +810,6 @@ void SnortConfig::set_uid(const char* args)
     if (group_id == -1 && pw->pw_gid != getgid())
         group_id = (int) pw->pw_gid;
 
-    DebugFormat(DEBUG_INIT, "UserID: %d GroupID: %d.\n", user_id, group_id);
 }
 
 void SnortConfig::set_show_year(bool enabled)
@@ -825,7 +817,6 @@ void SnortConfig::set_show_year(bool enabled)
     if (enabled)
     {
         output_flags |= OUTPUT_FLAG__INCLUDE_YEAR;
-        DebugMessage(DEBUG_INIT, "Enabled year in timestamp\n");
     }
     else
         output_flags &= ~OUTPUT_FLAG__INCLUDE_YEAR;
@@ -891,7 +882,6 @@ void SnortConfig::set_verbose(bool enabled)
     if (enabled)
     {
         logging_flags |= LOGGING_FLAG__VERBOSE;
-        DebugMessage(DEBUG_INIT, "Verbose Flag active\n");
     }
     else
         logging_flags &= ~LOGGING_FLAG__VERBOSE;
index 9e0a0c25ac34b056ebdb2fda22aa491df9d1e2df..41274c7d601b8e339c85ee958f2d1d8c1ba6494b 100644 (file)
 
 #include "snort_config.h"
 
-bool Debug::init = false;
-uint64_t Debug::mask = 0;
-
-bool Debug::enabled(uint64_t flag)
-{
-    if ( !init )
-    {
-        const char* b = getenv(DEBUG_BUILTIN);
-        const char* p = getenv(DEBUG_PLUGIN);
-
-        mask = (p ? strtoul(p, nullptr, 0) : 0);
-        mask <<= 32;
-        mask |= (b ? strtoul(b, nullptr, 0) : 0);
-
-        init = true;
-    }
-
-    return (mask & flag) != 0;
-}
-
-void Debug::print(
-    const char* file, int line, uint64_t dbg, const char* fmt, ...)
-{
-    if ( !enabled(dbg) )
-        return;
-
-    va_list ap;
-    va_start(ap, fmt);
-
-    if ( snort::SnortConfig::get_conf() and snort::SnortConfig::log_syslog() )
-    {
-        char buf[STD_BUF];
-        int buf_len = sizeof(buf);
-        char* buf_ptr = buf;
-
-        buf[buf_len - 1] = '\0';
-
-        /* filename and line number information */
-        if ( file )
-        {
-            snprintf(buf, buf_len - 1, "%s:%d: ", file, line);
-            buf_ptr += strlen(buf);
-            buf_len -= strlen(buf);
-        }
-
-        vsnprintf(buf_ptr, buf_len - 1, fmt, ap);
-        syslog(LOG_DAEMON | LOG_DEBUG, "%s", buf);
-    }
-    else
-    {
-        if ( file )
-            printf("%s:%d: ", file, line);
-        vprintf(fmt, ap);
-    }
-
-    va_end(ap);
-}
-
 bool trace_enabled(Trace mask, Trace flags)
 { return mask & flags; }
 
index a25c16425e3e1e1e50c1360ca5b8496f1d9e5aef..2c67171d8d8c63194c77604cae5ed7b2e01215d1 100644 (file)
 #ifndef SNORT_DEBUG_H
 #define SNORT_DEBUG_H
 
-// this provides a set of flags that can be set by environment variable to
+// this provides a module trace capabilty that can be set by config to
 // turn on the output of specific debug messages.
 //
-// FIXIT-M debug flags needs to be replaced with a module facility.
 
 #include <cstdarg>
 
 #include "main/snort_types.h"
 
-// this env var uses the lower 32 bits of the flags:
-#define DEBUG_BUILTIN "SNORT_DEBUG"
-
-#define DEBUG_INIT            0x0000000000000001LL
-#define DEBUG_PORTLISTS       0x0000000000000004LL
-#define DEBUG_ATTRIBUTE       0x0000000000000008LL
-#define DEBUG_DECODE          0x0000000000000010LL
-#define DEBUG_CONFIGRULES     0x0000000000000020LL
-#define DEBUG_PATTERN_MATCH   0x0000000000000080LL
-#define DEBUG_LOG             0x0000000000000200LL
-#define DEBUG_FILE            0x0000000000000800LL
-#define DEBUG_MEMORY          0x0000000000001000LL
-// FIXIT-L latency doesn't use any debug messages
-#define DEBUG_LATENCY         0x0000000000002000LL
-#define DEBUG_SIDE_CHANNEL    0x0000000000004000LL
-#define DEBUG_CONNECTORS      0x0000000000008000LL
-#define DEBUG_HA              0x0000000000010000LL
-#define DEBUG_ANALYZER        0x0000000000020000LL
-
-// this env var uses the upper 32 bits of the flags:
-#define DEBUG_PLUGIN "SNORT_PP_DEBUG"
-
-#define DEBUG_STREAM          0x0000000200000000LL
-
-#define DEBUG_CODEC           0x0001000000000000LL
-#define DEBUG_IPS_ACTION      0x0004000000000000LL
-#define DEBUG_MPSE            0x0010000000000000LL
-#define DEBUG_SO_RULE         0x0020000000000000LL
-#define DEBUG_LOGGER          0x0040000000000000LL
-
-#ifdef PIGLET
-#define DEBUG_PIGLET          0x0800000000000000LL
-#endif
-
 typedef uint64_t Trace;
 
 bool trace_enabled(Trace mask);
@@ -143,29 +108,6 @@ static inline void trace_print(const char* name, Trace mask, const char* file,
 #define trace_debugf(tracer, ...) \
     trace_printf(#tracer, tracer##_trace, __FILE__, __LINE__, __VA_ARGS__)
 
-class SO_PUBLIC Debug
-{
-public:
-    static bool enabled(uint64_t flag);
-
-    static void print(const char* file, int line, uint64_t dbg, const char* fmt,
-        ...) __attribute__((format (printf, 4, 5)));
-
-private:
-    static bool init;
-    static uint64_t mask;
-};
-
-#define DebugFormat(dbg, fmt, ...) \
-    Debug::print(__FILE__, __LINE__, dbg, fmt, __VA_ARGS__)
-
-#define DebugFormatNoFileLine(dbg, fmt, ...) \
-    Debug::print(nullptr, 0, dbg, fmt, __VA_ARGS__)
-
-#define DebugMessage(dbg, msg) DebugFormat(dbg, "%s", msg)
-
-#define DEBUG_WRAP(code) code
-
 #else
 #define trace_log(tracer, ...)
 #define trace_log_wo_name(tracer, ...)
@@ -174,10 +116,6 @@ private:
 #define trace_debug(tracer, ...)
 #define trace_debugf(tracer, ...)
 
-#define DebugFormat(dbg, fmt, ...)
-#define DebugFormatNoFileLine(dbg, fmt, ...)
-#define DebugMessage(dbg, msg)
-#define DEBUG_WRAP(code)
 #endif
 
 #endif
index fcf81fd324c977a432232feae5498558c00e9227..1525e0e3c72e04345cfef292d4de73f1dd2ee619 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "framework/connector.h"
 #include "log/messages.h"
-#include "main/snort_debug.h"
 #include "utils/util.h"
 
 using namespace snort;
@@ -65,15 +64,12 @@ static CList s_connector_commons;
 
 void ConnectorManager::add_plugin(const ConnectorApi* api)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL, "ConnectorManager::add_plugin()\n");
-
     if ( api->pinit )
         api->pinit();
 }
 
 void ConnectorManager::dump_plugins()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL, "ConnectorManager::dump_plugins()\n");
     Dumper d("Connectors");
 
     for ( auto& sc : s_connector_commons )
@@ -82,7 +78,6 @@ void ConnectorManager::dump_plugins()
 
 void ConnectorManager::release_plugins()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL, "ConnectorManager::release_plugins()\n");
     for ( auto& sc : s_connector_commons )
     {
         if ( sc.api->dtor )
@@ -102,8 +97,6 @@ void ConnectorManager::release_plugins()
 
 Connector* ConnectorManager::get_connector(const std::string& connector_name)
 {
-    DebugFormat(DEBUG_SIDE_CHANNEL, "ConnectorManager::get_connector(): name: %s\n",
-        connector_name.c_str());
     for ( auto& sc : s_connector_commons )
     {
         pid_t tid = gettid();
@@ -119,7 +112,6 @@ Connector* ConnectorManager::get_connector(const std::string& connector_name)
 
 void ConnectorManager::thread_init()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"ConnectorManager::thread_init()\n");
     pid_t tid = gettid();
 
     for ( auto& sc : s_connector_commons )
@@ -128,9 +120,6 @@ void ConnectorManager::thread_init()
         {
             for ( auto& conn : sc.connectors )
             {
-                DebugFormat(DEBUG_SIDE_CHANNEL,"ConnectorManager::thread_init(): tinit: %s\n",
-                    conn.first.c_str());
-
                 /* There must NOT be a connector for this thread present. */
                 assert(conn.second->thread_connectors.count(tid) == 0);
 
@@ -144,7 +133,6 @@ void ConnectorManager::thread_init()
 
 void ConnectorManager::thread_term()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"ConnectorManager::thread_term()\n");
     pid_t tid = gettid();
 
     for ( auto& sc : s_connector_commons )
@@ -153,9 +141,6 @@ void ConnectorManager::thread_term()
         {
             for ( auto& conn : sc.connectors )
             {
-                DebugFormat(DEBUG_SIDE_CHANNEL,"ConnectorManager::thread_term(): term: %s\n",
-                    conn.first.c_str());
-
                 /* There must be a connector for this thread present. */
                 assert(conn.second->thread_connectors.count(tid) != 0);
 
@@ -169,7 +154,6 @@ void ConnectorManager::thread_term()
 
 void ConnectorManager::instantiate(const ConnectorApi* api, Module* mod, SnortConfig*)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"ConnectorManager::instantiate()\n");
     assert(mod);
     ConnectorCommonElem c(api);
 
@@ -182,9 +166,6 @@ void ConnectorManager::instantiate(const ConnectorApi* api, Module* mod, SnortCo
     // iterate through the config_set and create the connector entries
     for ( auto cfg : *config_set )
     {
-        DebugFormat(DEBUG_SIDE_CHANNEL,"ConnectorManager::instantiate(): %s\n",
-            cfg->connector_name.c_str());
-
         ConnectorElem* connector_elem = new ConnectorElem;
         connector_elem->config = &*cfg;
         std::pair<std::string, ConnectorElem*> element (cfg->connector_name, std::move(connector_elem));
index 03c1ca7ffb23824e541b2eccc3b5e657a2ac7c82..8021051423709330bb11107bffd58365345353f1 100644 (file)
@@ -86,11 +86,6 @@ inline bool free_space(size_t requested, size_t cap, Tracker& trk, Handler& hand
 {
     if ( requested > cap )
     {
-        DebugFormat(
-            DEBUG_MEMORY,
-            "Requested memory (%zu bytes) > cap (%zu bytes)\n",
-            requested, cap);
-
         return false;
     }
 
index df96391191f9ffde76e0b19e0bc8b228bbec0824..69416d79a87a01cf4e0aaa0cca7fbf61cee63011 100644 (file)
@@ -157,7 +157,6 @@ bool process_mime_paf_data(MimeDataPafInfo* data_info,  uint8_t data)
         if (store_boundary(data_info, data))
         {
             /* End of boundary, move to MIME_PAF_FOUND_BOUNDARY_STATE*/
-            DebugFormat(DEBUG_FILE, "Create boundary string: %s\n", data_info->boundary);
             data_info->data_state = MIME_PAF_FOUND_BOUNDARY_STATE;
         }
         break;
@@ -166,7 +165,6 @@ bool process_mime_paf_data(MimeDataPafInfo* data_info,  uint8_t data)
         if (check_boundary(data_info,  data))
         {
             /* End of boundary, move to MIME_PAF_FOUND_BOUNDARY_STATE*/
-            DebugFormat(DEBUG_FILE, "Found boundary string: %s\n", data_info->boundary);
             return true;
         }
         break;
index 88aac2d1ffc4a17faef30868f65382cca7945e10..633e9f58e57e552223727b7812383f9dce80117f 100644 (file)
@@ -533,17 +533,6 @@ const uint8_t* MimeSession::process_mime_data_paf(
 
     if (data_state == STATE_DATA_HEADER)
     {
-#ifdef DEBUG_MSGS
-        if (data_state == STATE_DATA_HEADER)
-        {
-            DEBUG_WRAP(DebugMessage(DEBUG_FILE, "DATA HEADER STATE ~~~~~~~~~~~~~~~~~~~~~~\n"); );
-        }
-        else
-        {
-            DEBUG_WRAP(DebugMessage(DEBUG_FILE, "DATA UNKNOWN STATE ~~~~~~~~~~~~~~~~~~~~~\n"); );
-        }
-#endif
-
         start = process_mime_header(start, end);
         if (start == nullptr)
             return nullptr;
@@ -559,11 +548,9 @@ const uint8_t* MimeSession::process_mime_data_paf(
         switch (data_state)
         {
         case STATE_MIME_HEADER:
-            DEBUG_WRAP(DebugMessage(DEBUG_FILE, "MIME HEADER STATE ~~~~~~~~~~~~~~~~~~~~~~\n"); );
             start = process_mime_header(start, end);
             break;
         case STATE_DATA_BODY:
-            DEBUG_WRAP(DebugMessage(DEBUG_FILE, "DATA BODY STATE ~~~~~~~~~~~~~~~~~~~~~~~~\n"); );
             start = process_mime_body(start, end, isFileEnd(position) );
             break;
         }
index 40c78aa696a1827d4a61e1f873a615ea4fd8b989..2936587d66075bb6888ef30da119010d796b891a 100644 (file)
 
 #include <string>
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 struct AddAppData
 {
     AppId client_id = 0;
index 54fce50681dfb0e4a50a89fe98fa16b264f95a24..57c114b5bb57b0d746dfc89f22564343ca447fa8 100644 (file)
@@ -42,7 +42,5 @@ SO_PUBLIC void LogMessage(const char* format,...)
     va_end(ap);
 }
 
-// void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-
 #endif
 
index 857ccf9562abf0b2c34b722824b00072abbbf8a8..4fdfe3141f630b7d818e219afb391117948f274d 100644 (file)
@@ -42,10 +42,6 @@ AppIdModuleConfig config;
 
 AppIdModuleConfig::~AppIdModuleConfig() { }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 TEST_GROUP(tp_lib_handler)
 {
 };
index a75dd6716e63bad7c51cc64d160317a1e1246299..d0cc3db2629e0aadbb6fc513d25698b4de24496c 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "log/messages.h"
 #include "main/policy.h"
-#include "main/snort_debug.h"
 #include "sfip/sf_ipvar.h"
 #include "sfip/sf_vartable.h"
 #include "utils/util.h"
@@ -37,8 +36,6 @@ sfip_var_t* sfip_var_from_string(const char* addr)
 
     ip_vartable = snort::get_ips_policy()->ip_vartable;
 
-    DebugFormat(DEBUG_CONFIGRULES,"Got address string: %s\n", addr);
-
     ret = (sfip_var_t*)snort_calloc(sizeof(sfip_var_t));
 
     if ((ret_code = sfvt_add_to_var(ip_vartable, ret, addr)) != SFIP_SUCCESS)
index 954b8b43c902df10c3d2cc40512b9c87d23bc37b..3242143e33a8bd50659039feb677dd8f53e9fbbf 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "parse_ports.h"
 
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 #include "utils/util.h"
 
@@ -50,7 +49,6 @@ static int POPGetChar(POParser* pop)
         pop->slen--;
         pop->s++;
         pop->pos++;
-        DebugFormat(DEBUG_PORTLISTS,"GetChar: %c, %d bytes left\n",c, pop->slen);
         return c;
     }
     return 0;
@@ -170,8 +168,6 @@ static char* POParserName(POParser* pop)
         }
     }
 
-    DebugFormat(DEBUG_PORTLISTS,">>> POParserName : %s\n",pop->token);
-
     return snort_strdup(pop->token);
 }
 
@@ -218,8 +214,6 @@ static uint16_t POParserGetShort(POParser* pop)
         return 0;
     }
 
-    DebugFormat(DEBUG_PORTLISTS,"GetUNumber: %d\n",c);
-
     return c;
 }
 
@@ -481,8 +475,6 @@ PortObject* PortObjectParseString(PortVarTable* pvTable, POParser* pop,
 {
     PortObject* po, * potmp;
 
-    DebugFormat(DEBUG_PORTLISTS,"PortObjectParseString: %s\n",s);
-
     POParserInit(pop, s, pvTable);
 
     po = PortObjectNew();
index 54a6b8cbec63acaf5203cbb289a9248135014339..b2b8d08f9e1583bc0ae9c3838c8ba156c6ea4849 100644 (file)
@@ -32,7 +32,6 @@
 #include "hash/xhash.h"
 #include "log/messages.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "main/thread_config.h"
 #include "managers/ips_manager.h"
 #include "managers/module_manager.h"
@@ -152,11 +151,6 @@ static int FinishPortListRule(
     /* Count rules with both src and dst specific ports */
     if (!(rtn->flags & ANY_DST_PORT) && !(rtn->flags & ANY_SRC_PORT))
     {
-        DebugFormat(DEBUG_PORTLISTS,
-            "***\n***Info:  src & dst ports are both specific"
-            " >> gid=%u sid=%u\n***\n",
-            otn->sigInfo.gid, otn->sigInfo.sid);
-
         prc->both++;
     }
 
@@ -213,10 +207,6 @@ static int FinishPortListRule(
              * to those protocols.  All IP rules should have any-any port descriptors
              * and fall into this test.  IP rules that are not tcp/udp/icmp go only into the
              * IP table */
-            DebugFormat(DEBUG_PORTLISTS,
-                "Finishing IP any-any rule %u:%u\n",
-                otn->sigInfo.gid, otn->sigInfo.sid);
-
             switch ( otn->snort_protocol_id )
             {
             case SNORT_PROTO_IP:    /* Add to all ip proto any port tables */
@@ -260,7 +250,6 @@ static int FinishPortListRule(
     if (!(rtn->flags & ANY_DST_PORT))
     {
         prc->dst++;
-        DebugMessage(DEBUG_PORTLISTS, "Finishing rule: dst port rule\n");
 
         /* find the proper port object */
         PortObject* pox = PortTableFindInputPortObjectPorts(dstTable, rtn->dst_portobject);
@@ -512,14 +501,11 @@ static PortObject* ParsePortListTcpUdpPort(
         /*||isalpha(port_str[0])*/ /*TODO: interferes with protocol names for ports*/
         const char* name = port_str + 1;
 
-        DebugFormat(DEBUG_PORTLISTS,"PortVarTableFind: finding '%s'\n", port_str);
-
         /* look it up  in the port var table */
         portobject = PortVarTableFind(pvt, name);
         if ( !portobject )
             ParseAbort("***PortVar Lookup failed on '%s'.", port_str);
 
-        DebugFormat(DEBUG_PORTLISTS,"PortVarTableFind: '%s' found!\n", port_str);
     }
     /* 3rd -  and finally process a raw port list */
     else
@@ -527,14 +513,8 @@ static PortObject* ParsePortListTcpUdpPort(
         /* port list = [p,p,p:p,p,...] or p or p:p , no embedded spaces due to tokenizer */
         PortObject* pox;
 
-        DebugFormat(DEBUG_PORTLISTS,
-            "parser.c->PortObjectParseString: parsing '%s'\n",port_str);
-
         portobject = PortObjectParseString(pvt, &poparser, nullptr, port_str, 0);
 
-        DebugFormat(DEBUG_PORTLISTS,
-            "parser.c->PortObjectParseString: '%s' done.\n",port_str);
-
         if ( !portobject )
         {
             const char* errstr = PortObjectParseError(&poparser);
@@ -546,16 +526,11 @@ static PortObject* ParsePortListTcpUdpPort(
         pox = PortTableFindInputPortObjectPorts(noname, portobject);
         if ( pox )
         {
-            DebugFormat(DEBUG_PORTLISTS,
-                "parser.c: already have '%s' as a PortObject - "
-                "calling PortObjectFree(portobject)\n", port_str);
             PortObjectFree(portobject);
             portobject = pox;
         }
         else
         {
-            DebugFormat(DEBUG_PORTLISTS,
-                "parser.c: adding '%s' as a PortObject\n",port_str);
             /* Add to the un-named port var table */
             if (PortTableAddObject(noname, portobject))
             {
@@ -606,8 +581,6 @@ static int ParsePortList(
         }
     }
 
-    DebugFormat(DEBUG_PORTLISTS,"Rule-PortVar Parsed: %s \n",port_str);
-
     /* !ports - port lists can be mixed 80:90,!82,
     * so the old NOT flag is deprecated for port lists
     */
@@ -720,7 +693,6 @@ static void AddRuleFuncToList(
     int (* rfunc)(Packet*, RuleTreeNode*, struct RuleFpList*, int),
     RuleTreeNode* rtn)
 {
-    DebugMessage(DEBUG_CONFIGRULES,"Adding new rule to list\n");
     RuleFpList* idx = rtn->rule_func;
 
     if ( !idx )
@@ -758,7 +730,6 @@ static void AddrToFunc(RuleTreeNode* rtn, int mode)
     case SRC:
         if ((rtn->flags & ANY_SRC_IP) == 0)
         {
-            DebugMessage(DEBUG_CONFIGRULES,"CheckSrcIP -> ");
             AddRuleFuncToList(CheckSrcIP, rtn);
         }
         break;
@@ -766,7 +737,6 @@ static void AddrToFunc(RuleTreeNode* rtn, int mode)
     case DST:
         if ((rtn->flags & ANY_DST_IP) == 0)
         {
-            DebugMessage(DEBUG_CONFIGRULES,"CheckDstIP -> ");
             AddRuleFuncToList(CheckDstIP, rtn);
         }
         break;
@@ -797,12 +767,10 @@ static void PortToFunc(RuleTreeNode* rtn, int any_flag, int except_flag, int mod
         switch (mode)
         {
         case SRC:
-            DebugMessage(DEBUG_CONFIGRULES,"CheckSrcPortNotEq -> ");
             AddRuleFuncToList(CheckSrcPortNotEq, rtn);
             break;
 
         case DST:
-            DebugMessage(DEBUG_CONFIGRULES,"CheckDstPortNotEq -> ");
             AddRuleFuncToList(CheckDstPortNotEq, rtn);
             break;
         }
@@ -813,12 +781,10 @@ static void PortToFunc(RuleTreeNode* rtn, int any_flag, int except_flag, int mod
     switch (mode)
     {
     case SRC:
-        DebugMessage(DEBUG_CONFIGRULES,"CheckSrcPortEqual -> ");
         AddRuleFuncToList(CheckSrcPortEqual, rtn);
         break;
 
     case DST:
-        DebugMessage(DEBUG_CONFIGRULES,"CheckDstPortEqual -> ");
         AddRuleFuncToList(CheckDstPortEqual, rtn);
         break;
     }
@@ -828,12 +794,8 @@ static void PortToFunc(RuleTreeNode* rtn, int any_flag, int except_flag, int mod
 // functions (addrs and ports)
 static void SetupRTNFuncList(RuleTreeNode* rtn)
 {
-    DebugMessage(DEBUG_CONFIGRULES,"Initializing RTN function list!\n");
-    DebugMessage(DEBUG_CONFIGRULES,"Functions: ");
-
     if (rtn->flags & BIDIRECTIONAL)
     {
-        DebugMessage(DEBUG_CONFIGRULES,"CheckBidirectional->\n");
         AddRuleFuncToList(CheckBidirectional, rtn);
     }
     else
@@ -858,8 +820,6 @@ static void SetupRTNFuncList(RuleTreeNode* rtn)
         AddrToFunc(rtn, DST);
     }
 
-    DebugMessage(DEBUG_CONFIGRULES,"RuleListEnd\n");
-
     /* tack the end (success) function to the list */
     AddRuleFuncToList(RuleListEnd, rtn);
 }
@@ -875,7 +835,6 @@ static RuleTreeNode* ProcessHeadNode(
      * stick it at the end of the list */
     if ( !rtn )
     {
-        DebugMessage(DEBUG_CONFIGRULES,"Building New Chain head node\n");
         head_count++;
 
         rtn = (RuleTreeNode*)snort_calloc(sizeof(RuleTreeNode));
@@ -890,8 +849,6 @@ static RuleTreeNode* ProcessHeadNode(
         /* add link to parent listhead */
         rtn->listhead = list;
 
-        DebugFormat(DEBUG_CONFIGRULES,
-            "New Chain head flags = 0x%X\n", rtn->flags);
     }
     else
     {
index 16eaea1d77674a15b1a2fb585b6e039916c2b8fb..8f8481b9c02ce6f40730a41ebb8e06eb75b03e9f 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "log/messages.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "sfip/sf_ipvar.h"
 #include "utils/util.h"
 #include "utils/util_cstring.h"
@@ -520,9 +519,6 @@ VarEntry* VarDefine(
         }
     }
 
-    DebugFormat(DEBUG_PORTLISTS,
-        "VarDefine: name=%s value=%s\n",name,value);
-
     /* Check to see if this variable is just being aliased */
     if (var_table != nullptr)
     {
@@ -548,9 +544,6 @@ VarEntry* VarDefine(
         ParseAbort("could not expand var('%s').", name);
     }
 
-    DebugFormat(DEBUG_PORTLISTS,
-        "VarDefine: name=%s value=%s (expanded)\n",name,value);
-
     DisallowCrossTableDuplicateVars(sc, name, VAR_TYPE__DEFAULT);
 
     if (var_table == nullptr)
@@ -712,7 +705,6 @@ const char* ExpandVars(SnortConfig* sc, const char* string)
 
     int i = 0, j = 0;
     int l_string = strlen(string);
-    DebugFormat(DEBUG_CONFIGRULES, "ExpandVars, Before: %s\n", string);
 
     while (i < l_string && j < (int)sizeof(estring) - 1)
     {
@@ -827,7 +819,6 @@ const char* ExpandVars(SnortConfig* sc, const char* string)
         }
     }
 
-    DebugFormat(DEBUG_CONFIGRULES, "ExpandVars, After: %s\n", estring);
 
     return estring;
 }
@@ -837,7 +828,6 @@ void AddVarToTable(SnortConfig* sc, const char* name, const char* value)
     //TODO: snort.cfg and rules should use PortVar instead ...this allows compatibility for now.
     if (strstr(name, "_PORT") || strstr(name, "PORT_"))
     {
-        DebugMessage(DEBUG_CONFIGRULES,"PortVar\n");
         PortVarDefine(sc, name, value);
     }
     else
index 777ff66194df41b486ed66b5087343d66b5141bc..ea59de9e4e3b630d37b51abc26f9bdcabd2d7382 100644 (file)
@@ -26,7 +26,6 @@
 #include "port_object.h"
 
 #include "log/messages.h"
-#include "main/snort_debug.h"
 #include "parser/parser.h"
 #include "utils/util.h"
 #include "utils/util_cstring.h"
@@ -52,9 +51,6 @@ void PortObjectFree(void* pv)
     assert(pv);
     PortObject* po = (PortObject*)pv;
 
-    DEBUG_WRAP(static int pof_cnt = 0; pof_cnt++; );
-    DebugFormat(DEBUG_PORTLISTS, "PortObjectFree-Cnt: %d ptr=%p\n", pof_cnt, (void*)po);
-
     if ( po->name )
         snort_free(po->name);
 
index cb4200b7be7f80526f09fb1b4e8cff6c6faea179..d83b3795bcac56300b28acde9805f202001d1937 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "hash/hashfcn.h"
 #include "log/messages.h"
-#include "main/snort_debug.h"
 #include "parser/parser.h"
 #include "utils/util.h"
 #include "utils/util_cstring.h"
@@ -123,9 +122,6 @@ PortObject2* PortObject2New(int nrules)
 
 void PortObject2Free(PortObject2* po)
 {
-    DEBUG_WRAP(static int pof2_cnt = 0; pof2_cnt++; );
-    DebugFormat(DEBUG_PORTLISTS, "PortObjectFree2-Cnt: %d ptr=%p\n", pof2_cnt, (void*)po);
-
     if ( !po )
         return;
 
index 616c928b7c643584a8f803e1feeaf36ba7d8c69b..39a919de65ac5c33fd4e61bd2edce267605fef06 100644 (file)
@@ -76,18 +76,6 @@ static void plx_free(void* p)
     snort_free(p);
 }
 
-#ifdef DEBUG_MSGS
-static void plx_print(plx_t* p)
-{
-    DEBUG_WRAP
-    (
-        DebugFormat(DEBUG_PORTLISTS, "plx-n=%d\n", p->n);
-        for ( int i = 0; i < p->n; i++ )
-            DebugFormat(DEBUG_PORTLISTS, "plx[%d]=%p\n", i, p->p[i]);
-    );
-}
-#endif
-
 static unsigned plx_hash(HashFnc* p, const unsigned char* d, int)
 {
     unsigned hash = p->seed;
@@ -247,15 +235,12 @@ static PortObject2* _merge_N_pol(
     /*
     * Check for the merged port object in the plx table
     */
-    DebugFormat(DEBUG_PORTLISTS, "++++n=%d ghash_find-mhashx\n", pol_cnt);
     ponew = (PortObject2*)ghash_find(mhashx, &plx);
 
     if ( ponew )
     {
-        DebugFormat(DEBUG_PORTLISTS, "n=%d ponew found in mhashx\n", pol_cnt);
         return ponew;
     }
-    DebugFormat(DEBUG_PORTLISTS, "n=%d posnew not found in mhashx\n", pol_cnt);
 
     /*
     *  Merge the port objects together - ports and rules
@@ -273,42 +258,29 @@ static PortObject2* _merge_N_pol(
     {
         for ( int i = 1; i < pol_cnt; i++ )
         {
-            DebugFormat(DEBUG_PORTLISTS, "*** %u rules in object %d\n",
-                ((PortObject*)pol[i])->rule_list->count, i);
             PortObjectAppendEx2(ponew, (PortObject*)pol[i]);
-            DebugFormat(DEBUG_PORTLISTS, "*** merged port-object[%d], %u rules\n",
-                i, ponew->rule_hash->count);
         }
         PortObjectNormalize( (PortObject*)ponew);
     }
 
-    DebugFormat(DEBUG_PORTLISTS, "*** merged %d port objects, %u rules\n",
-        pol_cnt, ponew->rule_hash->count);
-    DebugMessage(DEBUG_PORTLISTS, "*** merged ponew - follows: \n");
     // PortObjectPrint2(ponew);
 
     /*
     * Add the Merged PortObject2 to the PortObject2 hash table
     * keyed by ports.
     */
-    DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_add-mhash\n", pol_cnt);
     stat =ghash_add(mhash, &ponew, ponew);
     if ( stat != GHASH_OK )
     {
         /* This is possible since PLX hash on a different key */
         if ( stat == GHASH_INTABLE )
         {
-            DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_add-mhash ponew in table\n", pol_cnt);
-            DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_find-mhash ponew\n", pol_cnt);
             pox = (PortObject2*)ghash_find(mhash, &ponew);
             if ( pox )
             {
                 PortObject2AppendPortObject2(pox, ponew);
-                DebugMessage(DEBUG_PORTLISTS, "sfportobject.c: merge_N_pol() GHASH_INTABLE\n");
                 PortObject2Free(ponew);
                 ponew = pox;
-                DebugFormat(DEBUG_PORTLISTS,
-                    "n=%d ghash_find-mhash ponew found, new rules merged\n", pol_cnt);
             }
             else
             {
@@ -321,7 +293,6 @@ static PortObject2* _merge_N_pol(
         }
     }
 
-    DebugFormat(DEBUG_PORTLISTS, "***%d ports merged object added to mhash  table\n", pol_cnt);
 
     /*
     * Create a plx node and add it to plx table
@@ -337,7 +308,6 @@ static PortObject2* _merge_N_pol(
     /*
      * Add the plx node to the PLX hash table
      */
-    DebugFormat(DEBUG_PORTLISTS, "n=%d ghash_add-mhashx\n", pol_cnt);
     stat = ghash_add(mhashx, &plx_tmp, ponew);
     if ( stat != GHASH_OK )
     {
@@ -351,7 +321,6 @@ static PortObject2* _merge_N_pol(
         }
     }
 
-    DebugFormat(DEBUG_PORTLISTS, "Added-%d Merged Rule Groups to PLX HASH\n", pol_cnt);
 
     /*
     *  Validate hash table entry
@@ -410,9 +379,6 @@ static PortObject2* PortTableCompileMergePortObjectList2(
         }
     }
 
-    DebugFormat(DEBUG_PORTLISTS,
-        "*** %d small rule groups, %d large rule groups\n", nsmall, nlarge);
-
     /*
     * Sort the pointers to the input port objects so
     * we always get them in the same order for key comparisons
@@ -423,15 +389,6 @@ static PortObject2* PortTableCompileMergePortObjectList2(
     if ( nsmall > 1 )
         qsort(posmall, nsmall, sizeof(void*), p_keycmp);
 
-    DEBUG_WRAP
-    (
-        for ( int i = 0; i < nsmall; i++ )
-            DebugFormat(DEBUG_PORTLISTS, "posmall[%d]=%p\n", i, posmall[i]);
-
-        for ( int i = 0; i < nlarge; i++)
-            DebugFormat(DEBUG_PORTLISTS, "polarge[%d]=%p\n", i, polarge[i]);
-    );
-
     /*
     * Setup plx_t representation of port list pointers
     */
@@ -444,19 +401,6 @@ static PortObject2* PortTableCompileMergePortObjectList2(
     plx_large.n = nlarge;
     plx_large.p = (void**)&polarge[0];
 
-#ifdef DEBUG_MSGS
-    if ( nlarge )
-    {
-        DebugMessage(DEBUG_PORTLISTS, "large ");
-        plx_print(&plx_large);
-    }
-    if ( nsmall )
-    {
-        DebugMessage(DEBUG_PORTLISTS, "small ");
-        plx_print(&plx_small);
-    }
-#endif
-
     PortObject2* ponew = nullptr;
     PortObject2* posnew = nullptr;
 
@@ -465,7 +409,6 @@ static PortObject2* PortTableCompileMergePortObjectList2(
     */
     if ( nlarge )
     {
-        DebugFormat(DEBUG_PORTLISTS, "***nlarge=%d \n", nlarge);
         ponew =  _merge_N_pol(mhash, mhashx, plx_list, polarge, nlarge, &plx_large);
     }
 
@@ -474,7 +417,6 @@ static PortObject2* PortTableCompileMergePortObjectList2(
     */
     if ( nsmall )
     {
-        DebugFormat(DEBUG_PORTLISTS, "***nsmall=%d \n", nsmall);
         posnew =  _merge_N_pol(mhash, mhashx, plx_list, posmall, nsmall, &plx_small);
     }
     /*
@@ -484,7 +426,6 @@ static PortObject2* PortTableCompileMergePortObjectList2(
     */
     if ( nlarge && nsmall )
     {
-        DebugMessage(DEBUG_PORTLISTS, "*** appending small rules to larger rule group\n");
         if (ponew != posnew)
         {
             /* Append small port object, just the rules */
@@ -494,14 +435,12 @@ static PortObject2* PortTableCompileMergePortObjectList2(
             PortObjectRemovePorts( (PortObject*)posnew, (PortObject*)ponew);
         }
 
-        DebugMessage(DEBUG_PORTLISTS, "*** final - using small+large rule group \n");
     }
     else if ( nsmall )
     {
         /* Only a small port object */
         ponew = posnew;
 
-        DebugMessage(DEBUG_PORTLISTS, "*** final - using small rule group only \n");
     }
     else if ( nlarge )
     {
@@ -583,8 +522,6 @@ static inline void delete_port_lists(SF_LIST** parray)
 
 static int PortTableCompileMergePortObjects(PortTable* p)
 {
-    DebugMessage(DEBUG_PORTLISTS, "***\n***Merging PortObjects->PortObjects2\n***\n");
-
     std::unique_ptr<PortObject*[]> upA(new PortObject*[SFPO_MAX_LPORTS]);
     PortObject** pol = upA.get();
 
@@ -604,9 +541,6 @@ static int PortTableCompileMergePortObjects(PortTable* p)
 
     p->pt_mpxo_hash = mhashx;
 
-    DebugFormat(DEBUG_PORTLISTS,
-        "***\n*** PortList-Merging, Large Rule groups must have %d rules\n", p->pt_lrc);
-
     SF_LIST* plx_list = sflist_new();
 
     SF_LIST** optimized_pl = create_port_lists(p);
@@ -641,9 +575,6 @@ static int PortTableCompileMergePortObjects(PortTable* p)
             continue;
         }
 
-        DEBUG_WRAP(DebugFormat(DEBUG_PORTLISTS,
-            "*** merging list for port[%d] \n", i); fflush(stdout); );
-
         /* merge the rules into an optimal port object */
         p->pt_port_object[i] =
             PortTableCompileMergePortObjectList2(
@@ -657,7 +588,6 @@ static int PortTableCompileMergePortObjects(PortTable* p)
         /* give the new compiled port object an id of its own */
         p->pt_port_object[i]->id = id++;
 
-        DEBUG_WRAP(DebugMessage(DEBUG_PORTLISTS, "\n"); fflush(stdout); );
     }
 
     delete_port_lists(optimized_pl);
@@ -750,8 +680,6 @@ static int PortTableCompileMergePortObjects(PortTable* p)
         /* set the new list - this is a list of port items for this port object */
         po->item_list = plist;
 
-        DebugFormat(DEBUG_PORTLISTS, "port-object id = %d, port cnt = %d\n", po->id,
-            po->port_cnt);
     }
 
     sflist_free_all(plx_list, plx_free);
@@ -800,7 +728,6 @@ static bool PortTableConsistencyCheck(PortTable* p)
 
         if ( !po )
         {
-            DebugMessage(DEBUG_PORTLISTS, "PortObject consistency Check failed, hash table problem\n");
             return false;
         }
 
@@ -813,8 +740,6 @@ static bool PortTableConsistencyCheck(PortTable* p)
             {
                 if ( parray[i] )
                 {
-                    DebugFormat(DEBUG_PORTLISTS, "PortTableCompile: failed consistency check, "
-                            "multiple objects reference port %d\n", i);
                     return false;
                 }
                 parray[i] = 1;
@@ -865,8 +790,6 @@ static bool PortTableConsistencyCheck2(PortTable* p)
                 {
                     if ( _po2_include_po_rules(p->pt_port_object[i], ipo) )
                     {
-                        DebugMessage(DEBUG_PORTLISTS,
-                            "InputPortObject<->CompositePortObject consistency Check II failed\n");
                         return false;
                     }
                     lastpo = p->pt_port_object[i];
@@ -993,25 +916,17 @@ int PortTableCompile(PortTable* p)
     if ( !p->pt_optimize )
         return 0;
 
-    DebugMessage(DEBUG_PORTLISTS, "#PortTableCompile: Compiling Port Array Lists\n");
-
     if ( PortTableCompileMergePortObjects(p) )
     {
         FatalError("Could not create PortArryayLists\n");
     }
 
-    DEBUG_WRAP(DebugMessage(DEBUG_PORTLISTS, "Done\n"); fflush(stdout); );
 
 #ifdef DEBUG
     assert(PortTableConsistencyCheck(p));
     assert(PortTableConsistencyCheck2(p));
 #endif
 
-#ifdef DEBUG_MSGS
-    if ( Debug::enabled(DEBUG_PORTLISTS) )
-        PortTablePrintPortGroups(p);
-#endif
-
     return 0;
 }
 
index 18e5859caf21eed972352d0702eab8e0b2c9594f..eac2cc1ed6d79273f63a4eb9cf76fc2799e37592 100644 (file)
@@ -30,7 +30,6 @@
 #include "detection/detection_engine.h"
 #include "log/text_log.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "packet_io/active.h"
 #include "packet_io/sfdaq.h"
 #include "profiler/profiler_defs.h"
@@ -161,11 +160,6 @@ void PacketManager::decode(
     // loop until the protocol id is no longer valid
     while (CodecManager::s_protocols[mapped_prot]->decode(raw, codec_data, p->ptrs))
     {
-        DebugFormat(DEBUG_DECODE, "Codec %s (protocol_id: %hu:"
-            "ip header starts at: %p, length is %d\n",
-            CodecManager::s_protocols[mapped_prot]->get_name(),
-            static_cast<uint16_t>(codec_data.next_prot_id), pkt, codec_data.lyr_len);
-
         if ( codec_data.codec_flags & CODEC_ETHER_NEXT )
         {
             if ( codec_data.next_prot_id < ProtocolId::ETHERTYPE_MINIMUM )
@@ -239,11 +233,6 @@ void PacketManager::decode(
         codec_data.proto_bits = 0;
     }
 
-    DebugFormat(DEBUG_DECODE, "Codec %s (protocol_id: %hu: ip header"
-        " starts at: %p, length is %lu\n",
-        CodecManager::s_protocols[mapped_prot]->get_name(),
-        static_cast<uint16_t>(prev_prot_id), pkt, (unsigned long)codec_data.lyr_len);
-
     if ( p->num_layers > 0 )
         s_stats[mapped_prot + stat_offset]++;
 
index 3ef496124661b40871df9ae258261b631121b00d..d03d39962f9c16792cc27c5e3a757e289191cce5 100644 (file)
@@ -29,7 +29,6 @@
 #include <cassert>
 
 #include "framework/counts.h"
-#include "main/snort_debug.h"
 #include "managers/connector_manager.h"
 #include "profiler/profiler_defs.h"
 
@@ -62,8 +61,6 @@ SideChannel* SideChannelManager::get_side_channel(SCPort port)
         {
             if ( ( port <= scm->ports.size() ) && ( scm->ports.test(port) ) )
             {
-                DebugFormat(DEBUG_SIDE_CHANNEL,"SideChannelManager::get_side_channel: port: %u\n",
-                    (uint32_t)port);
                 return scm->sc;
             }
         }
@@ -73,7 +70,6 @@ SideChannel* SideChannelManager::get_side_channel(SCPort port)
 
 SideChannel::SideChannel()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannel::SideChannel()\n");
     sequence = 0;
     default_port = 0;
     connector_receive = nullptr;
@@ -81,11 +77,6 @@ SideChannel::SideChannel()
     receive_handler = nullptr;
 }
 
-SideChannel::~SideChannel()
-{
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannel::~SideChannel()\n");
-}
-
 void SideChannel::set_message_port(SCMessage* msg, SCPort port)
 {
     assert ( msg );
@@ -100,8 +91,6 @@ void SideChannel::set_default_port(SCPort port)
 
 void SideChannelManager::instantiate(const SCConnectors* connectors, const PortBitSet* ports)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL, "SideChannelManager::instantiate()\n");
-
     SideChannelMapping* scm = new SideChannelMapping;
 
     scm->sc = nullptr;
@@ -114,14 +103,12 @@ void SideChannelManager::instantiate(const SCConnectors* connectors, const PortB
 // Initialize state to be ready to accept configuration
 void SideChannelManager::pre_config_init()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::pre_config_init()\n");
     s_maps.clear();
 }
 
 // Within each thread, instantiate the connectors, etc.
 void SideChannelManager::thread_init()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::thread_init()\n");
 
     // First startup the connectors
     ConnectorManager::thread_init();
@@ -146,23 +133,17 @@ void SideChannelManager::thread_init()
 
             if ( connector->get_connector_direction() == Connector::CONN_DUPLEX )
             {
-                DebugFormat(DEBUG_SIDE_CHANNEL,
-                    "SideChannelManager::thread_init(): DUPLEX: %s\n", conn_name.c_str());
                 sc->connector_receive = connector;
                 sc->connector_transmit = connector;
             }
 
             if ( connector->get_connector_direction() == Connector::CONN_RECEIVE )
             {
-                DebugFormat(DEBUG_SIDE_CHANNEL,
-                    "SideChannelManager::thread_init(): RECEIVE: %s\n", conn_name.c_str());
                 sc->connector_receive = connector;
             }
 
             if ( connector->get_connector_direction() == Connector::CONN_TRANSMIT )
             {
-                DebugFormat(DEBUG_SIDE_CHANNEL,
-                    "SideChannelManager::thread_init(): TRANSMIT: %s\n", conn_name.c_str());
                 sc->connector_transmit = connector;
             }
         }
@@ -178,7 +159,6 @@ void SideChannelManager::thread_init()
 // Within each thread, shutdown the sidechannel
 void SideChannelManager::thread_term()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::thread_term()\n");
 
     // First shutdown the connectors
     ConnectorManager::thread_term();
@@ -207,7 +187,6 @@ void SideChannelManager::term()
 // return true iff we received any messages.
 bool SideChannel::process(int max_messages)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::process()\n");
     bool received_message = false;
 
     while (true)
@@ -253,19 +232,16 @@ bool SideChannel::process(int max_messages)
 
 void SideChannel::register_receive_handler(const SCProcessMsgFunc& handler)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::register_receive_handler()\n");
     receive_handler = handler;
 }
 
 void SideChannel::unregister_receive_handler()
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::unregister_receive_handler()\n");
     receive_handler = nullptr;
 }
 
 SCMessage* SideChannel::alloc_transmit_message(uint32_t content_length)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::alloc_transmit_message()\n");
     SCMessage* msg = new SCMessage;
     msg->handle = connector_transmit->alloc_message((content_length + sizeof(SCMsgHdr)),
         (const uint8_t**)&(msg->hdr));
@@ -292,7 +268,6 @@ bool SideChannel::discard_message(SCMessage* msg)
 
 bool SideChannel::transmit_message(SCMessage* msg)
 {
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelManager::transmit_message()\n");
     bool return_value = false;
 
     if ( connector_transmit && msg->handle )
@@ -307,8 +282,6 @@ bool SideChannel::transmit_message(SCMessage* msg)
         delete msg;
     }
 
-    DebugFormat(DEBUG_SIDE_CHANNEL,"SideChannelManager::transmit_message(): return: %d\n",
-        (int)return_value);
     return return_value;
 }
 
index d9a915ad46ea0dc45882fa8c8a11cf7ce3fe4f3d..8a1b5c1bb6b26325373408caf1f7b55ebb64e97b 100644 (file)
@@ -59,7 +59,6 @@ class SideChannel
 {
 public:
     SideChannel();
-    ~SideChannel();
 
     void register_receive_handler(const SCProcessMsgFunc& handler);
     void unregister_receive_handler();
index de5687582ae161b98bb9d6793c3af65883c2e17b..04e98366e40c067be429ac02c41adf23124ddce3 100644 (file)
@@ -88,27 +88,13 @@ static bool validate_config(SideChannelConfig* config)
 }
 
 SideChannelModule::SideChannelModule() :
-    Module(SIDECHANNEL_NAME, SIDECHANNEL_HELP, sc_params)
-{
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelModule::SideChannelModule()\n");
-}
-
-SideChannelModule::~SideChannelModule()
-{
-    DebugMessage(DEBUG_SIDE_CHANNEL,"SideChannelModule::~SideChannelModule()\n");
-}
+    Module(SIDECHANNEL_NAME, SIDECHANNEL_HELP, sc_params){}
 
 ProfileStats* SideChannelModule::get_profile() const
 { return &sc_perf_stats; }
 
-bool SideChannelModule::set(const char* fqn, Value& v, SnortConfig*)
+bool SideChannelModule::set(const char*, Value& v, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_SIDE_CHANNEL,"SideChannelModule::set(): %s %s\n", fqn, v.get_name());
-#else
-    UNUSED(fqn);
-#endif
-
     assert(config);
 
     if ( v.is("connector") )
@@ -126,14 +112,8 @@ bool SideChannelModule::set(const char* fqn, Value& v, SnortConfig*)
     return true;
 }
 
-bool SideChannelModule::begin(const char* fqn, int idx, SnortConfig*)
+bool SideChannelModule::begin(const char*, int, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_SIDE_CHANNEL,"SideChannelModule::begin(): %s %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-    UNUSED(idx);
-#endif
     if ( !config )
     {
         config = new SideChannelConfig;
@@ -144,12 +124,6 @@ bool SideChannelModule::begin(const char* fqn, int idx, SnortConfig*)
 
 bool SideChannelModule::end(const char* fqn, int idx, SnortConfig*)
 {
-#ifdef DEBUG_MSGS
-    DebugFormat(DEBUG_SIDE_CHANNEL,"SideChannelModule::end(): %s %d\n", fqn, idx);
-#else
-    UNUSED(fqn);
-#endif
-
     if ( (idx == 0) || (strcmp(fqn, "side_channel.connectors") == 0 ) )
         return true;
 
index f10b76957a7d6e63655b889cfd7bc2c43071ba81..a57927286ab60cfc419e9dfbdb51e0ef45b56612 100644 (file)
@@ -40,7 +40,6 @@ class SideChannelModule : public snort::Module
 {
 public:
     SideChannelModule();
-    ~SideChannelModule() override;
 
     bool set(const char*, snort::Value&, snort::SnortConfig*) override;
     bool begin(const char*, int, snort::SnortConfig*) override;
index 32cc0dbeda362338d7b434faceda904252f7eeec..3984cf9e429661a23cb967e4c2ff861dc00d1e7f 100644 (file)
@@ -62,10 +62,6 @@ void show_stats(PegCount*, const PegInfo*, IndexVec&, const char*, FILE*) { }
 
 void ParseWarning(WarningGroup, const char*, ...) { }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 char* snort_strdup(const char* s)
 { return strdup(s); }
 
index a42915d974161f72db042f412b9492655fdbfe6b..f9bc1cda3b4179a48df7098408261455c426481c 100644 (file)
@@ -143,10 +143,6 @@ Connector* ConnectorManager::get_connector(const std::string& connector_name)
 
 void ParseWarning(WarningGroup, const char*, ...) { }
 
-#ifdef DEBUG_MSGS
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-#endif
-
 TEST_GROUP(side_channel)
 {
     void setup() override
index 4418a4df602a0ee941cbf07b3a3c7ae060b3c71b..b651ec95bb8caf8dbea763b0aa98d2713487e690 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "log/messages.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 #include "sfrt/sfrt.h"
 #include "utils/stats.h"
@@ -91,7 +90,6 @@ uint32_t SFAT_NumberOfHosts()
 
 static void FreeApplicationEntry(ApplicationEntry* app)
 {
-    DebugFormat(DEBUG_ATTRIBUTE, "Freeing ApplicationEntry: 0x%p\n", (void*) app);
     snort_free(app);
 }
 
@@ -112,7 +110,6 @@ void FreeHostEntry(HostAttributeEntry* host)
     if (!host)
         return;
 
-    DebugFormat(DEBUG_ATTRIBUTE, "Freeing HostEntry: 0x%p\n", (void*) host);
 
     /* Free the service list */
     if (host->services)
@@ -181,55 +178,6 @@ int SFAT_AddApplicationData(HostAttributeEntry* host, ApplicationEntry* app)
 
 #endif
 
-#ifdef DEBUG_MSGS
-static void PrintHostAttributeEntry(HostAttributeEntry* host)
-{
-    ApplicationEntry* app;
-    int i = 0;
-
-    if (!host)
-        return;
-
-    SfIpString ip_str;
-    DebugFormat(DEBUG_ATTRIBUTE, "Host IP: %s/%d\n",
-        host->ipAddr.ntop(ip_str),
-        host->ipAddr.get_bits());
-
-    DebugFormat(DEBUG_ATTRIBUTE,
-        "\tPolicy Information: frag:%s (%hhu) stream: %s (%hhu)\n",
-        "look-me-up", host->hostInfo.fragPolicy,
-        "look-me-up", host->hostInfo.streamPolicy);
-
-    DebugMessage(DEBUG_ATTRIBUTE, "\tServices:\n");
-
-    for (i=0, app = host->services; app; app = app->next,i++)
-    {
-        DebugFormat(DEBUG_ATTRIBUTE, "\tService #%d:\n", i);
-        DebugFormat(DEBUG_ATTRIBUTE, "\t\tIPProtocol: %d\tPort: %d\tSnortProtocolId %hu\n",
-            app->ipproto, app->port, app->snort_protocol_id);
-    }
-    if (i==0)
-        DebugMessage(DEBUG_ATTRIBUTE, "\t\tNone\n");
-
-    DebugMessage(DEBUG_ATTRIBUTE, "\tClients:\n");
-    for (i=0, app = host->clients; app; app = app->next,i++)
-    {
-        DebugFormat(DEBUG_ATTRIBUTE, "\tClient #%d:\n", i);
-        DebugFormat(DEBUG_ATTRIBUTE, "\t\tIPProtocol: %d\tSnortProtocolId %hu\n",
-            app->ipproto, app->snort_protocol_id);
-
-        if (app->fields & APPLICATION_ENTRY_PORT)
-        {
-            DebugFormat(DEBUG_ATTRIBUTE, "\t\tPort: %d\n", app->port);
-        }
-    }
-    if (i==0)
-    {
-        DebugMessage(DEBUG_ATTRIBUTE, "\t\tNone\n");
-    }
-}
-
-#endif
 
 int SFAT_AddHost(HostAttributeEntry* host)
 {
@@ -241,8 +189,6 @@ int SFAT_AddHostEntryToMap(HostAttributeEntry* host)
     int ret;
     SfCidr* ipAddr;
 
-    DEBUG_WRAP(PrintHostAttributeEntry(host); );
-
     ipAddr = &host->ipAddr;
     assert(ipAddr);
 
index 4b15cdd419a6fe8597c760bb9fecad9c44b3a8fc..162599ffa41ada13a185e83caa4e8b32a78dadf9 100644 (file)
@@ -28,7 +28,6 @@
 #include <algorithm>
 
 #include "log/messages.h"
-#include "main/snort_debug.h"
 #include "protocols/packet.h"
 #include "utils/util.h"
 #include "utils/util_cstring.h"
@@ -83,9 +82,6 @@ SnortProtocolId ProtocolReference::add(const char* protocol)
     auto protocol_ref = ref_table.find(protocol);
     if ( protocol_ref != ref_table.end() )
     {
-        DebugFormat(DEBUG_ATTRIBUTE, "Protocol Reference for %s exists as %d\n",
-            protocol, protocol_ref->second);
-
         return protocol_ref->second;
     }
 
@@ -101,9 +97,6 @@ SnortProtocolId ProtocolReference::find(const char* protocol)
     auto protocol_ref = ref_table.find(protocol);
     if ( protocol_ref != ref_table.end() )
     {
-        DebugFormat(DEBUG_ATTRIBUTE, "Protocol Reference for %s exists as %d\n",
-            protocol, protocol_ref->second);
-
         return protocol_ref->second;
     }
 
index 977c32568a8d71733a83fabe26b2ae36a63122d1..671a481be350af6e36f53fd8e0a1b51a0c0f769e 100644 (file)
@@ -33,8 +33,6 @@
 
 using namespace snort;
 
-void Debug::print(const char*, int, uint64_t, const char*, ...) { }
-
 TEST_GROUP(protocol_reference)
 {};
 
index e10124495430e2ab6602ec917a926384f3b5dfec..c676e1aff3c1891642f381f74c3c4229b2376f72 100644 (file)
@@ -47,8 +47,6 @@
 
 #include "boyer_moore.h"
 
-#include "main/snort_debug.h"
-
 #include "util.h"
 
 /****************************************************************
@@ -151,9 +149,6 @@ int* make_shift(const char* ptrn, int plen)
 int mSearch(
     const char* buf, int blen, const char* ptrn, int plen, const int* skip, const int* shift)
 {
-    DebugFormat(DEBUG_PATTERN_MATCH,"buf: %p  blen: %d  ptrn: %p  "
-        "plen: %d\n", buf, blen, ptrn, plen);
-
     if (plen == 0)
         return -1;
 
index 76362cdb66db2804e5f7c2145f697b7a1ad0d0b2..e47af72e82cdc13d3c556df49cccfbf4034f9883 100644 (file)
@@ -58,7 +58,6 @@ extern "C" {
 #include "log/messages.h"
 #include "main/build.h"
 #include "main/snort_config.h"
-#include "main/snort_debug.h"
 #include "packet_io/sfdaq.h"
 #include "protocols/packet.h"   // For NUM_IP_PROTOS
 
@@ -555,7 +554,6 @@ bool EnterChroot(std::string& root_dir, std::string& log_dir)
         return false;
     }
     PathBuf pwd;
-    DebugFormat(DEBUG_INIT, "EnterChroot: %s\n", CurrentWorkingDir(pwd));
     PathBuf abs_log_dir;
 
     if ( !GetAbsolutePath(log_dir.c_str(), abs_log_dir) )
@@ -577,7 +575,6 @@ bool EnterChroot(std::string& root_dir, std::string& log_dir)
         return false;
     }
     size_t abs_root_dir_len = strlen(abs_root_dir);
-    DebugFormat(DEBUG_INIT, "ABS: %s %zu\n", abs_root_dir, abs_root_dir_len);
 
     if (strncmp(abs_root_dir, abs_log_dir, abs_root_dir_len))
     {
@@ -592,8 +589,6 @@ bool EnterChroot(std::string& root_dir, std::string& log_dir)
         return false;
     }
 
-    DebugFormat(DEBUG_INIT,"chroot success (%s ->", abs_root_dir);
-    DebugFormat(DEBUG_INIT,"%s)\n ", CurrentWorkingDir(pwd));
 
     /* Immediately change to the root directory of the jail. */
     if (chdir("/") < 0)
@@ -603,14 +598,12 @@ bool EnterChroot(std::string& root_dir, std::string& log_dir)
         return false;
     }
 
-    DebugFormat(DEBUG_INIT,"chdir success (%s)\n", CurrentWorkingDir(pwd));
 
     if (abs_root_dir_len >= strlen(abs_log_dir))
         log_dir = "/";
     else
         log_dir = abs_log_dir + abs_root_dir_len;
 
-    DebugFormat(DEBUG_INIT,"new logdir from %s to %s\n", abs_log_dir, log_dir.c_str());
 
     LogMessage("Chroot directory = %s\n", root_dir.c_str());