From: Russ Combs (rucombs) Date: Thu, 25 Feb 2016 21:06:54 +0000 (-0500) Subject: Merge pull request #296 in SNORT/snort3 from crc/msgs to master X-Git-Tag: 3.0.0-233~579 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33f435bec585335a38aaf469df7f40fc8784da9d;p=thirdparty%2Fsnort3.git Merge pull request #296 in SNORT/snort3 from crc/msgs to master Squashed commit of the following: commit ce75acdc9e792d5e26eaf3b77eceb29e883c8c53 Author: Russ Combs Date: Thu Feb 25 14:01:10 2016 -0500 fix debug vs debug_msgs --- diff --git a/src/helpers/directory.cc b/src/helpers/directory.cc index f15cb56da..17e3e0508 100644 --- a/src/helpers/directory.cc +++ b/src/helpers/directory.cc @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/src/ips_options/ips_byte_test.cc b/src/ips_options/ips_byte_test.cc index 33c6e5ce1..db65a7795 100644 --- a/src/ips_options/ips_byte_test.cc +++ b/src/ips_options/ips_byte_test.cc @@ -336,7 +336,7 @@ int ByteTestOption::eval(Cursor& c, Packet*) btd->endianess, btd->bytes_to_compare, start_ptr, c.buffer(), c.endo(), &value)) return DETECTION_OPTION_NO_MATCH; -#ifdef DEBUG +#ifdef DEBUG_MSGS payload_bytes_grabbed = (int)btd->bytes_to_compare; #endif } diff --git a/src/network_inspectors/arp_spoof/arp_spoof.cc b/src/network_inspectors/arp_spoof/arp_spoof.cc index 8d8cc4fdb..2bff89734 100644 --- a/src/network_inspectors/arp_spoof/arp_spoof.cc +++ b/src/network_inspectors/arp_spoof/arp_spoof.cc @@ -112,7 +112,7 @@ static IPMacEntry* LookupIPMacEntryByIP( return nullptr; } -#ifdef DEBUG +#ifdef DEBUG_MSGS static void PrintIPMacEntryList(IPMacEntryList& ipmel) { if ( !ipmel.size() ) @@ -171,8 +171,9 @@ void ArpSpoof::show(SnortConfig*) { LogMessage("arpspoof configured\n"); -#if defined(DEBUG) - PrintIPMacEntryList(config->ipmel); +#ifdef DEBUG_MSGS + if ( Debug::enabled(DEBUG_INSPECTOR) ) + PrintIPMacEntryList(config->ipmel); #endif } diff --git a/src/packet_io/sfdaq.cc b/src/packet_io/sfdaq.cc index d7a49057b..931582fd0 100644 --- a/src/packet_io/sfdaq.cc +++ b/src/packet_io/sfdaq.cc @@ -524,7 +524,7 @@ int DAQ_Acquire(int max, DAQ_Analysis_Func_t callback, uint8_t* user) int DAQ_Inject(const DAQ_PktHdr_t* h, int rev, const uint8_t* buf, uint32_t len) { int err = daq_inject(daq_mod, daq_hand, (DAQ_PktHdr_t*)h, buf, len, rev); -#ifdef DEBUG +#ifdef DEBUG_MSGS if ( err ) LogMessage("Can't inject (%d) - %s\n", err, daq_get_error(daq_mod, daq_hand)); diff --git a/src/service_inspectors/http_inspect/hi_client_norm.cc b/src/service_inspectors/http_inspect/hi_client_norm.cc index fbbf1a2c5..65de2b09f 100644 --- a/src/service_inspectors/http_inspect/hi_client_norm.cc +++ b/src/service_inspectors/http_inspect/hi_client_norm.cc @@ -146,7 +146,7 @@ int hi_split_header_cookie( { this_header_len = cookie->cookie - this_header_start; } -#ifdef DEBUG +#ifdef DEBUG_MSGS this_header_end = this_header_start + this_header_len; #endif diff --git a/src/stream/ip/ip_defrag.cc b/src/stream/ip/ip_defrag.cc index ba6218e87..04cd5b335 100644 --- a/src/stream/ip/ip_defrag.cc +++ b/src/stream/ip/ip_defrag.cc @@ -896,7 +896,7 @@ static void FragRebuild(FragTracker* ft, Packet* p) ip_stats.reassembles++; ip_stats.reassembled_bytes += dpkt->pkth->caplen; -#if defined(DEBUG_FRAG_EX) && defined(DEBUG) +#if defined(DEBUG_FRAG_EX) && defined(DEBUG_MSGS) /* * Note, that this won't print out the IP Options or any other * data that is established when the packet is decoded. @@ -1148,7 +1148,7 @@ void Defrag::process(Packet* p, FragTracker* ft) */ if (p->ptrs.ip_api.ttl() < fe->min_ttl) { -#ifdef DEBUG +#ifdef DEBUG_MSGS if ( p->is_ip4() ) { DebugFormat(DEBUG_FRAG, @@ -1216,14 +1216,13 @@ void Defrag::process(Packet* p, FragTracker* ft) switch (insert_return) { case FRAG_INSERT_FAILED: -#ifdef DEBUG - LogMessage("WARNING: Insert into Fraglist failed, " + DebugFormat(DEBUG_FRAG, "WARNING: Insert into Fraglist failed, " "(offset: %u).\n", frag_offset); -#endif return; + case FRAG_INSERT_TTL: -#ifdef DEBUG +#ifdef DEBUG_MSGS if ( p->is_ip4() ) { DebugFormat(DEBUG_FRAG, @@ -1238,25 +1237,26 @@ void Defrag::process(Packet* p, FragTracker* ft) #endif ip_stats.discards++; return; + case FRAG_INSERT_ATTACK: case FRAG_INSERT_ANOMALY: ip_stats.discards++; return; + case FRAG_INSERT_TIMEOUT: -#ifdef DEBUG - LogMessage("WARNING: Insert into Fraglist failed due to timeout, " + DebugFormat(DEBUG_FRAG, "WARNING: Insert into Fraglist failed due to timeout, " "(offset: %u).\n", frag_offset); -#endif return; + case FRAG_INSERT_OVERLAP_LIMIT: -#ifdef DEBUG - LogMessage("WARNING: Excessive IP fragment overlap, " + DebugFormat(DEBUG_FRAG, + "WARNING: Excessive IP fragment overlap, " "(More: %u, offset: %u, offsetSize: %u).\n", (p->ptrs.decode_flags & DECODE_MF), (frag_offset << 3), p->dsize); -#endif ip_stats.discards++; return; + default: break; } diff --git a/src/stream/tcp/tcp_session.cc b/src/stream/tcp/tcp_session.cc index 1471a3945..ce8522c2f 100644 --- a/src/stream/tcp/tcp_session.cc +++ b/src/stream/tcp/tcp_session.cc @@ -102,7 +102,7 @@ #include "tcp_reassemblers.h" #include "tcp_session.h" -#ifdef DEBUG +#ifdef DEBUG_MSGS const char* const flush_policy_names[] = { "ignore", diff --git a/src/stream/tcp/tcp_session.h b/src/stream/tcp/tcp_session.h index a44ce7946..a602d20e9 100644 --- a/src/stream/tcp/tcp_session.h +++ b/src/stream/tcp/tcp_session.h @@ -33,7 +33,7 @@ #include "tcp_stream_config.h" #include "tcp_tracker.h" -#ifdef DEBUG +#ifdef DEBUG_MSGS extern const char* const flush_policy_names[]; #endif