]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #296 in SNORT/snort3 from crc/msgs to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 25 Feb 2016 21:06:54 +0000 (16:06 -0500)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Thu, 25 Feb 2016 21:06:54 +0000 (16:06 -0500)
Squashed commit of the following:

commit ce75acdc9e792d5e26eaf3b77eceb29e883c8c53
Author: Russ Combs <rucombs@cisco.com>
Date:   Thu Feb 25 14:01:10 2016 -0500

    fix debug vs debug_msgs

src/helpers/directory.cc
src/ips_options/ips_byte_test.cc
src/network_inspectors/arp_spoof/arp_spoof.cc
src/packet_io/sfdaq.cc
src/service_inspectors/http_inspect/hi_client_norm.cc
src/stream/ip/ip_defrag.cc
src/stream/tcp/tcp_session.cc
src/stream/tcp/tcp_session.h

index f15cb56dac1bbe34a31535d7d9e412c8496cb9b4..17e3e0508acc425d9cb731f3cfe7fc1a1a578f67 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <dirent.h>
 #include <fnmatch.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 33c6e5ce1d47b0254ca8c766faed330d8329389f..db65a7795bfba3be963e116e7952a51e9616135f 100644 (file)
@@ -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
     }
index 8d8cc4fdb7bbdb52e1aa39381946a236767e9c49..2bff89734930b5a75dd3ddeb6d8e6f4426987a18 100644 (file)
@@ -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
 }
 
index d7a49057b998e7dedd9bf2e6d2d75a6e2e841bd0..931582fd0fe23be99643bf061959214b0e06e7eb 100644 (file)
@@ -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));
index fbbf1a2c5c7de40af6635901373d9984bb91256b..65de2b09f0835ff38ca9f615ddd38b7eb4644168 100644 (file)
@@ -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
 
index ba6218e87af7a0ead3a4a96a82325df56bf02a35..04cd5b3352e643015666d16aaf5b4d3eba3b593c 100644 (file)
@@ -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;
         }
index 1471a39454bc2b57261579ed99eaf7027587601e..ce8522c2f2de7fbac92944e8304797bd8b9b175e 100644 (file)
 #include "tcp_reassemblers.h"
 #include "tcp_session.h"
 
-#ifdef DEBUG
+#ifdef DEBUG_MSGS
 const char* const flush_policy_names[] =
 {
     "ignore",
index a44ce7946b301d0e1603e4b742ecc35bb87ddecb..a602d20e9d6189bcfbc4c8a40e2ee6e13499cadd 100644 (file)
@@ -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