#include "events/event.h"
#include "latency/packet_latency.h"
#include "main/snort_config.h"
-#include "main/snort_debug.h"
#include "managers/event_manager.h"
#include "managers/inspector_manager.h"
#include "packet_io/active.h"
if ( DetectionEngine::get_check_tags() and !(p->packet_flags & PKT_REBUILT_STREAM) )
{
void* listhead = nullptr;
- DebugMessage(DEBUG_FLOW, "calling CheckTagList\n");
if (CheckTagList(p, event, &listhead))
{
- DebugMessage(DEBUG_FLOW, "Matching tag node found, "
- "calling log functions\n");
-
/* if we find a match, we want to send the packet to the
* logging mechanism
*/
TRACE_RULE_VARS = 0x10,
TRACE_FP_SEARCH = 0x20,
TRACE_PKT_DETECTION = 0x40,
+ TRACE_OPTION_TREE = 0x80,
+ TRACE_TAG = 0x100,
};
void clear_trace_cursor_info();
void print_option_tree(detection_option_tree_node_t* node, int level)
{
-#ifdef DEBUG_OPTION_TREE
+#ifdef DEBUG_MSGS
char buf[32];
const char* opt;
opt = buf;
}
- DebugFormatNoFileLine(DEBUG_DETECT, "%3d %3d %p %*s\n",
- level, node->num_children, node->option_data, level + strlen(opt), opt);
+ trace_logf(detection, TRACE_OPTION_TREE, "%3d %3d %p %*s\n",
+ level, node->num_children, node->option_data, (int)(level + strlen(opt)), opt);
for ( int i=0; i<node->num_children; i++ )
print_option_tree(node->children[i], level+1);
if (sig_info.num_services && check_ports)
{
// none of the services match
- DebugFormat(DEBUG_DETECT,
- "[**] SID %u not matched because of service mismatch (%d!=%d [**]\n",
- sig_info.sid, snort_protocol_id, sig_info.services[0].snort_protocol_id);
trace_logf(detection, TRACE_RULE_EVAL,
"SID %u not matched because of service mismatch %d!=%d \n",
sig_info.sid, snort_protocol_id, sig_info.services[0].snort_protocol_id);
#include "detection/rule_option_types.h"
#include "time/clock_defs.h"
+#include "main/snort_debug.h"
+extern Trace TRACE_NAME(detection);
+
namespace snort
{
struct Packet;
// FIXIT-L maybe add a port test here ...
- DebugFormat(DEBUG_DETECT, "[*] Rule Head %p\n", (void*)rtn);
-
if (!rtn->rule_func->RuleHeadFunc(p, rtn, rtn->rule_func, check_ports))
{
- DebugMessage(DEBUG_DETECT,
- " => Header check failed, checking next node\n");
- DebugMessage(DEBUG_DETECT,
- " => returned from next node check\n");
return 0;
}
if ( !prmFindRuleGroupTcp(SnortConfig::get_conf()->prmTcpRTNX, p->ptrs.dp, p->ptrs.sp, &src, &dst, &any) )
return;
- DebugFormat(DEBUG_ATTRIBUTE,
- "fpEvalHeaderTcp: sport=%d, dport=%d, src:%p, dst:%p, any:%p\n",
- p->ptrs.sp,p->ptrs.dp,(void*)src,(void*)dst,(void*)any);
-
if ( dst )
fpEvalHeaderSW(dst, p, 1, 0, 0, omd);
if ( !prmFindRuleGroupUdp(SnortConfig::get_conf()->prmUdpRTNX, p->ptrs.dp, p->ptrs.sp, &src, &dst, &any) )
return;
- DebugFormat(DEBUG_ATTRIBUTE,
- "fpEvalHeaderUdp: sport=%d, dport=%d, src:%p, dst:%p, any:%p\n",
- p->ptrs.sp,p->ptrs.dp,(void*)src,(void*)dst,(void*)any);
-
if ( dst )
fpEvalHeaderSW(dst, p, 1, 0, 0, omd);
SnortProtocolId snort_protocol_id = p->get_snort_protocol_id();
- DebugFormat(DEBUG_ATTRIBUTE, "snort_protocol_id=%hu\n", snort_protocol_id);
-
if (snort_protocol_id != UNKNOWN_PROTOCOL_ID and snort_protocol_id != INVALID_PROTOCOL_ID)
{
if (p->is_from_server()) /* to cli */
{
- DebugMessage(DEBUG_ATTRIBUTE, "pkt_from_server\n");
-
svc = SnortConfig::get_conf()->sopgTable->get_port_group(proto_id, false, snort_protocol_id);
file = SnortConfig::get_conf()->sopgTable->get_port_group(proto_id, false, SNORT_PROTO_FILE);
}
if (p->is_from_client()) /* to srv */
{
- DebugMessage(DEBUG_ATTRIBUTE, "pkt_from_client\n");
-
svc = SnortConfig::get_conf()->sopgTable->get_port_group(proto_id, true, snort_protocol_id);
file = SnortConfig::get_conf()->sopgTable->get_port_group(proto_id, true, SNORT_PROTO_FILE);
}
-
- DebugFormat(DEBUG_ATTRIBUTE,
- "fpEvalHeaderSvc:targetbased-ordinal-lookup: "
- "sport=%d, dport=%d, snort_protocol_id=%hu, proto_id=%d, src:%p, "
- "file:%p\n",p->ptrs.sp,p->ptrs.dp,snort_protocol_id,proto_id,(void*)svc,(void*)file);
}
// FIXIT-P put alert service rules with file data fp in alert file group and
// verify ports and service during rule eval to avoid searching file data 2x.
#include "rtn_checks.h"
#include "framework/ips_option.h"
-#include "main/snort_debug.h"
#include "ports/port_object.h"
#include "protocols/packet.h"
#include "sfip/sf_ip.h"
int except_port_flag = 0; /* port exception flag set */
int ip_match = 0; /* flag to indicate addr match made */
- DebugMessage(DEBUG_DETECT, "CheckAddrPort: ");
/* set up the packet particulars */
if (mode & CHECK_SRC_IP)
{
pkt_addr = p->ptrs.ip_api.get_src();
pkt_port = p->ptrs.sp;
- DebugMessage(DEBUG_DETECT,"SRC ");
-
if (mode & INVERSE)
{
global_except_addr_flag = flags & EXCEPT_DST_IP;
pkt_addr = p->ptrs.ip_api.get_dst();
pkt_port = p->ptrs.dp;
- DebugMessage(DEBUG_DETECT, "DST ");
-
if (mode & INVERSE)
{
global_except_addr_flag = flags & EXCEPT_SRC_IP;
}
}
- DEBUG_WRAP( SfIpString ip_str; )
- DebugFormat(DEBUG_DETECT, "addr %s, port %d ", pkt_addr->ntop(ip_str), pkt_port);
-
if (!rule_addr)
goto bail;
}
else
{
- DebugMessage(DEBUG_DETECT, ", global exception flag set");
/* global exception flag is up, we can't match on *any*
* of the source addresses
*/
bail:
if (!ip_match)
{
- DebugMessage(DEBUG_DETECT, ", no address match, "
- "packet rejected\n");
return 0;
}
- DebugMessage(DEBUG_DETECT, ", addresses accepted");
-
/* if the any port flag is up, we're all done (success) */
if (any_port_flag)
{
- DebugMessage(DEBUG_DETECT, ", any port match, "
- "packet accepted\n");
return 1;
}
/* if the exception flag isn't up, fail */
if (!except_port_flag)
{
- DebugMessage(DEBUG_DETECT, ", port mismatch, "
- "packet rejected\n");
return 0;
}
- DebugMessage(DEBUG_DETECT, ", port mismatch exception");
}
else
{
/* if the exception flag is up, fail */
if (except_port_flag)
{
- DebugMessage(DEBUG_DETECT,
- ", port match exception, packet rejected\n");
return 0;
}
- DebugMessage(DEBUG_DETECT, ", ports match");
}
/* ports and address match */
- DebugMessage(DEBUG_DETECT, ", packet accepted!\n");
return 1;
}
int CheckBidirectional(Packet* p, RuleTreeNode* rtn_idx,
RuleFpList*, int check_ports)
{
- DebugMessage(DEBUG_DETECT, "Checking bidirectional rule...\n");
-
if (CheckAddrPort(rtn_idx->sip, CHECK_ADDR_SRC_ARGS(rtn_idx), p,
rtn_idx->flags, CHECK_SRC_IP | (check_ports ? CHECK_SRC_PORT : 0)))
{
- DebugMessage(DEBUG_DETECT, " Src->Src check passed\n");
if (!CheckAddrPort(rtn_idx->dip, CHECK_ADDR_DST_ARGS(rtn_idx), p,
rtn_idx->flags, CHECK_DST_IP | (check_ports ? CHECK_DST_PORT : 0)))
{
- DebugMessage(DEBUG_DETECT,
- " Dst->Dst check failed, checking inverse combination\n");
if (CheckAddrPort(rtn_idx->dip, CHECK_ADDR_DST_ARGS(rtn_idx), p,
rtn_idx->flags, (CHECK_SRC_IP | INVERSE | (check_ports ? CHECK_SRC_PORT : 0))))
{
- DebugMessage(DEBUG_DETECT,
- " Inverse Dst->Src check passed\n");
if (!CheckAddrPort(rtn_idx->sip, CHECK_ADDR_SRC_ARGS(rtn_idx), p,
rtn_idx->flags, (CHECK_DST_IP | INVERSE | (check_ports ? CHECK_DST_PORT : 0))))
{
- DebugMessage(DEBUG_DETECT,
- " Inverse Src->Dst check failed\n");
return 0;
}
- else
- {
- DebugMessage(DEBUG_DETECT, "Inverse addr/port match\n");
- }
}
else
{
- DebugMessage(DEBUG_DETECT, " Inverse Dst->Src check failed,"
- " trying next rule\n");
return 0;
}
}
- else
- {
- DebugMessage(DEBUG_DETECT, "dest IP/port match\n");
- }
}
else
{
- DebugMessage(DEBUG_DETECT,
- " Src->Src check failed, trying inverse test\n");
if (CheckAddrPort(rtn_idx->dip, CHECK_ADDR_DST_ARGS(rtn_idx), p,
rtn_idx->flags, CHECK_SRC_IP | INVERSE | (check_ports ? CHECK_SRC_PORT : 0)))
{
- DebugMessage(DEBUG_DETECT,
- " Dst->Src check passed\n");
-
if (!CheckAddrPort(rtn_idx->sip, CHECK_ADDR_SRC_ARGS(rtn_idx), p,
rtn_idx->flags, CHECK_DST_IP | INVERSE | (check_ports ? CHECK_DST_PORT : 0)))
{
- DebugMessage(DEBUG_DETECT,
- " Src->Dst check failed\n");
return 0;
}
- else
- {
- DebugMessage(DEBUG_DETECT,
- "Inverse addr/port match\n");
- }
}
else
{
- DebugMessage(DEBUG_DETECT," Inverse test failed, "
- "testing next rule...\n");
return 0;
}
}
- DebugMessage(DEBUG_DETECT," Bidirectional success!\n");
return 1;
}
***************************************************************************/
int CheckSrcIP(Packet* p, RuleTreeNode* rtn_idx, RuleFpList* fp_list, int check_ports)
{
- DebugMessage(DEBUG_DETECT,"CheckSrcIPEqual: ");
-
if (!(rtn_idx->flags & EXCEPT_SRC_IP))
{
if ( sfvar_ip_in(rtn_idx->sip, p->ptrs.ip_api.get_src()) )
/* global exception flag is up, we can't match on *any*
* of the source addresses
*/
- DebugMessage(DEBUG_DETECT," global exception flag, \n");
-
if ( sfvar_ip_in(rtn_idx->sip, p->ptrs.ip_api.get_src()) )
return 0;
return fp_list->next->RuleHeadFunc(p, rtn_idx, fp_list->next, check_ports);
}
- DebugMessage(DEBUG_DETECT," Mismatch on SIP\n");
-
/* return 0 on a failed test */
return 0;
}
***************************************************************************/
int CheckDstIP(Packet* p, RuleTreeNode* rtn_idx, RuleFpList* fp_list, int check_ports)
{
- DebugMessage(DEBUG_DETECT, "CheckDstIPEqual: ");
-
if (!(rtn_idx->flags & EXCEPT_DST_IP))
{
if ( sfvar_ip_in(rtn_idx->dip, p->ptrs.ip_api.get_dst()) )
{
/* global exception flag is up, we can't match on *any*
* of the source addresses */
- DebugMessage(DEBUG_DETECT," global exception flag, \n");
-
if ( sfvar_ip_in(rtn_idx->dip, p->ptrs.ip_api.get_dst()) )
return 0;
int CheckSrcPortEqual(Packet* p, RuleTreeNode* rtn_idx,
RuleFpList* fp_list, int check_ports)
{
- DebugMessage(DEBUG_DETECT,"CheckSrcPortEqual: ");
-
/* Check if attributes provided match earlier */
if (check_ports == 0)
{
}
if ( PortObjectHasPort(rtn_idx->src_portobject,p->ptrs.sp) )
{
- DebugMessage(DEBUG_DETECT, " SP match!\n");
return fp_list->next->RuleHeadFunc(p, rtn_idx, fp_list->next, check_ports);
}
- else
- {
- DebugMessage(DEBUG_DETECT, " SP mismatch!\n");
- }
-
return 0;
}
int CheckSrcPortNotEq(Packet* p, RuleTreeNode* rtn_idx,
RuleFpList* fp_list, int check_ports)
{
- DebugMessage(DEBUG_DETECT,"CheckSrcPortNotEq: ");
-
/* Check if attributes provided match earlier */
if (check_ports == 0)
{
}
if ( !PortObjectHasPort(rtn_idx->src_portobject,p->ptrs.sp) )
{
- DebugMessage(DEBUG_DETECT, " !SP match!\n");
return fp_list->next->RuleHeadFunc(p, rtn_idx, fp_list->next, check_ports);
}
- else
- {
- DebugMessage(DEBUG_DETECT, " !SP mismatch!\n");
- }
return 0;
}
int CheckDstPortEqual(Packet* p, RuleTreeNode* rtn_idx,
RuleFpList* fp_list, int check_ports)
{
- DebugMessage(DEBUG_DETECT,"CheckDstPortEqual: ");
-
/* Check if attributes provided match earlier */
if (check_ports == 0)
{
}
if ( PortObjectHasPort(rtn_idx->dst_portobject,p->ptrs.dp) )
{
- DebugMessage(DEBUG_DETECT, " DP match!\n");
return fp_list->next->RuleHeadFunc(p, rtn_idx, fp_list->next, check_ports);
}
- else
- {
- DebugMessage(DEBUG_DETECT," DP mismatch!\n");
- }
return 0;
}
int CheckDstPortNotEq(Packet* p, RuleTreeNode* rtn_idx,
RuleFpList* fp_list, int check_ports)
{
- DebugMessage(DEBUG_DETECT,"CheckDstPortNotEq: ");
-
/* Check if attributes provided match earlier */
if (check_ports == 0)
{
}
if ( !PortObjectHasPort(rtn_idx->dst_portobject,p->ptrs.dp) )
{
- DebugMessage(DEBUG_DETECT, " !DP match!\n");
return fp_list->next->RuleHeadFunc(p, rtn_idx, fp_list->next, check_ports);
}
- else
- {
- DebugMessage(DEBUG_DETECT," !DP mismatch!\n");
- }
return 0;
}
#include "hash/xhash.h"
#include "log/messages.h"
#include "main/snort_config.h"
-#include "main/snort_debug.h"
#include "parser/parser.h"
#include "protocols/packet.h"
#include "sfip/sf_ip.h"
#include "treenodes.h"
+#include "detect_trace.h"
+
using namespace snort;
/* D E F I N E S **************************************************/
static void TagSession(Packet* p, TagData* tag, uint32_t time, uint16_t event_id, void* log_list)
{
- DebugMessage(DEBUG_FLOW, "TAGGING SESSION\n");
-
AddTagNode(p, tag, TAG_SESSION, time, event_id, log_list);
}
{
int mode;
- DebugMessage(DEBUG_FLOW, "TAGGING HOST\n");
-
switch (tag->tag_direction)
{
case TAG_HOST_DST:
TagNode* returned;
XHash* tag_cache_ptr = nullptr;
- DebugMessage(DEBUG_FLOW, "Adding new Tag Head\n");
+ trace_logf(detection, TRACE_TAG, "Adding new Tag Head\n");
if ( tag->tag_metric & TAG_METRIC_SESSION )
{
}
if (mode == TAG_SESSION)
{
- DebugMessage(DEBUG_FLOW,"Session Tag!\n");
tag_cache_ptr = ssn_tag_cache_ptr;
}
else
{
- DebugMessage(DEBUG_FLOW,"Host Tag!\n");
tag_cache_ptr = host_tag_cache_ptr;
}
idx = TagAlloc(tag_cache_ptr);
if (returned == nullptr)
{
- DebugMessage(DEBUG_FLOW,"Looking the other way!!\n");
SwapTag(idx);
returned = (TagNode*)xhash_find(tag_cache_ptr, idx);
SwapTag(idx);
if (returned == nullptr)
{
- DebugMessage(DEBUG_FLOW,"Inserting a New Tag!\n");
-
/* if we're supposed to be tagging the other side, swap it
around -- Lawrence Reed */
if (mode == TAG_HOST_DST)
if (xhash_add(tag_cache_ptr, idx, idx) != XHASH_OK)
{
- DebugMessage(DEBUG_FLOW,
- "xhash_add failed, that's going to "
- "make life difficult\n");
TagFree(tag_cache_ptr, idx);
return;
}
}
else
{
- DebugMessage(DEBUG_FLOW,"Existing Tag found!\n");
-
if (idx->metric & TAG_METRIC_SECONDS)
returned->seconds = idx->seconds;
else
if(p == nullptr || !p->ptrs.ip_api.is_ip())
{
- DebugMessage(DEBUG_FLOW, "bailing from CheckTagList, p->iph == NULL\n");
return 0;
}
- DebugFormat(DEBUG_FLOW,"Host Tags Active: %u Session Tags Active: %u\n",
- xhash_count(host_tag_cache_ptr), xhash_count(ssn_tag_cache_ptr));
-
- DebugMessage(DEBUG_FLOW, "[*] Checking session tag list (forward)...\n");
-
idx.key.sip.set(*p->ptrs.ip_api.get_src());
idx.key.dip.set(*p->ptrs.ip_api.get_dst());
idx.key.sp = p->ptrs.sp;
idx.key.dp = p->ptrs.sp;
idx.key.sp = p->ptrs.dp;
- DebugMessage(DEBUG_FLOW, " Checking session tag list (reverse)...\n");
returned = (TagNode*)xhash_find(ssn_tag_cache_ptr, &idx);
if (returned == nullptr)
{
- DebugMessage(DEBUG_FLOW, " Checking host tag list "
- "(forward)...\n");
-
returned = (TagNode*)xhash_find(host_tag_cache_ptr, &idx);
if (returned == nullptr)
if (returned != nullptr)
{
- DebugMessage(DEBUG_FLOW," [*!*] Found host node\n");
taglist = host_tag_cache_ptr;
}
}
else
{
- DebugMessage(DEBUG_FLOW," [*!*] Found session node\n");
taglist = ssn_tag_cache_ptr;
}
}
else
{
- DebugMessage(DEBUG_FLOW," [*!*] Found session node\n");
taglist = ssn_tag_cache_ptr;
}
if (returned != nullptr)
{
- DebugMessage(DEBUG_FLOW, " ! Found tag node !\n");
-
returned->last_access = p->pkth->ts.tv_sec;
returned->pkt_count++;
if ( !returned->metric )
{
- DebugMessage(DEBUG_FLOW,
- " Prune condition met for tag, removing from list\n");
-
if (xhash_remove(taglist, returned) != XHASH_OK)
{
LogMessage("WARNING: failed to remove tagNode from hash.\n");
if ( (u_int)(p->pkth->ts.tv_sec) > last_prune_time + TAG_PRUNE_QUANTUM )
{
- DebugMessage(DEBUG_FLOW,
- "Exceeded Prune Quantum, pruning tag trees\n");
PruneTagCache(p->pkth->ts.tv_sec, 0);
last_prune_time = p->pkth->ts.tv_sec;
}
void SetTags(Packet* p, const OptTreeNode* otn, uint16_t event_id)
{
- DebugMessage(DEBUG_FLOW, "Setting tags\n");
-
if (otn != nullptr && otn->tag != nullptr)
{
if (otn->tag->tag_type != 0)
RuleTreeNode* rtn = getRuntimeRtnFromOtn(otn);
void* log_list = rtn ? rtn->listhead : nullptr;
- DEBUG_WRAP( SfIpString ip_str; )
switch (otn->tag->tag_type)
{
case TAG_SESSION:
- DebugMessage(DEBUG_FLOW,"Setting session tag:\n");
- DebugFormat(DEBUG_FLOW,"SIP: %s SP: %d ",
- p->ptrs.ip_api.get_src()->ntop(ip_str), p->ptrs.sp);
- DebugFormat(DEBUG_FLOW,"DIP: %s DP: %d\n",
- p->ptrs.ip_api.get_dst()->ntop(ip_str), p->ptrs.dp);
TagSession(p, otn->tag, p->pkth->ts.tv_sec, event_id, log_list);
break;
case TAG_HOST:
- DebugMessage(DEBUG_FLOW,"Setting host tag:\n");
- DebugFormat(DEBUG_FLOW,"SIP: %s SP: %d ",
- p->ptrs.ip_api.get_src()->ntop(ip_str), p->ptrs.sp);
- DebugFormat(DEBUG_FLOW, "DIP: %s DP: %d\n",
- p->ptrs.ip_api.get_dst()->ntop(ip_str), p->ptrs.dp);
TagHost(p, otn->tag, p->pkth->ts.tv_sec, event_id, log_list);
break;
#include <cstdint>
+#include "main/snort_debug.h"
+extern Trace TRACE_NAME(detection);
+
namespace snort
{
struct Packet;
void FlowControl::preemptive_cleanup()
{
- DebugFormat(DEBUG_FLOW, "doing preemptive cleanup for packet of type %u",
- (unsigned) last_pkt_type);
-
// FIXIT-H is there a possibility of this looping forever?
while ( memory::MemoryCap::over_threshold() )
{
#include "asn1_detect.h"
-#include "main/snort_debug.h"
#include "utils/snort_bounds.h"
#include "asn1_util.h"
case REL_OFFSET:
if (!rel_ptr)
{
- DebugMessage(DEBUG_ASN1, "[*] No rel_ptr for "
- "relative offset, so we are bailing.\n");
return 0;
}
*/
if (!inBounds(start, end + 1, rel_ptr))
{
- DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "
- "check failed for rel_ptr.\n");
return 0;
}
if (!inBounds(start, end, offset))
{
- DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "
- "check failed rel_ptr+offset.\n");
return 0;
}
if (!inBounds(start, end, offset))
{
- DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "
- "check failed.\n");
return 0;
}
iRet = asn1_decode(offset, size, &asn1);
if (iRet && !asn1)
{
- DebugMessage(DEBUG_ASN1, "[*] ASN.1 decode failed "
- "miserably.\n");
return 0;
}
if ( not_flag )
{
- DebugMessage(DEBUG_PATTERN_MATCH,
- "checking for not success...flag\n");
-
success = !success;
}
endian, btd->bytes_to_compare,
start_ptr, c.buffer(), c.endo(), &value))
return NO_MATCH;
-#ifdef DEBUG_MSGS
- payload_bytes_grabbed = (int)btd->bytes_to_compare;
-#endif
}
else
{
if ( payload_bytes_grabbed < 0 )
{
- DebugMessage(DEBUG_PATTERN_MATCH,
- "String Extraction Failed\n");
-
return NO_MATCH;
}
}
}
}
- DebugFormat(DEBUG_PATTERN_MATCH,
- "Grabbed %d bytes at offset %d, value = 0x%08X(%u)\n",
- payload_bytes_grabbed, btd->offset, value, value);
-
if ( byte_test_check(btd->opcode, value, cmp_value, btd->not_flag) )
return MATCH;
{
Profile profile(contentPerfStats);
- DebugMessage(DEBUG_PATTERN_MATCH, "CheckPatternANDMatch: ");
-
int found = uniSearchReal(idx, c);
if ( found == -1 )
if ( found )
{
- DebugMessage(DEBUG_PATTERN_MATCH, "Pattern match found\n");
return IpsOption::MATCH;
}
else
{
- DebugMessage(DEBUG_PATTERN_MATCH, "Pattern match failed\n");
return IpsOption::NO_MATCH;
}
}
}
}
- DebugFormat(DEBUG_PARSER, "Pattern offset = %d\n", cd->pmd.offset);
}
static void parse_depth(ContentData* cd, const char* data)
}
}
- DebugFormat(DEBUG_PATTERN_MATCH, "Pattern depth = %d\n", cd->pmd.depth);
}
static void parse_distance(ContentData* cd, const char* data)
}
}
- DebugFormat(DEBUG_PATTERN_MATCH, "Pattern within = %d\n", cd->pmd.depth);
cd->pmd.set_relative();
}
if (command.cmd_str == nullptr)
return CVS_NO_ALERT;
- DebugFormat(DEBUG_IPS_OPTION, "CVS command\n"
- " command: %.*s\n"
- "argument: %.*s\n",
- command.cmd_str_len, (const char*)command.cmd_str,
- command.cmd_arg == nullptr ? 4 : command.cmd_arg_len,
- command.cmd_arg == nullptr ? "none" : (const char*)command.cmd_arg);
-
switch (cvs_rule_option->type)
{
case CVS_INVALID_ENTRY:
TcpFlagCheckData* flagptr = &config;
u_char tcp_flags = p->ptrs.tcph->th_flags & (0xFF ^ flagptr->tcp_mask);
- DebugMessage(DEBUG_IPS_OPTION, " <!!> CheckTcpFlags: ");
-
switch ((flagptr->mode))
{
case M_NORMAL:
if (flagptr->tcp_flags == tcp_flags) /* only these set */
{
- DebugMessage(DEBUG_IPS_OPTION,"Got TCP [default] flag match!\n");
return MATCH;
}
- else
- {
- DebugMessage(DEBUG_IPS_OPTION,"No match\n");
- }
break;
case M_ALL:
/* all set */
if ((flagptr->tcp_flags & tcp_flags) == flagptr->tcp_flags)
{
- DebugMessage(DEBUG_IPS_OPTION, "Got TCP [ALL] flag match!\n");
return MATCH;
}
- else
- {
- DebugMessage(DEBUG_IPS_OPTION,"No match\n");
- }
break;
case M_NOT:
if ((flagptr->tcp_flags & tcp_flags) == 0) /* none set */
{
- DebugMessage(DEBUG_IPS_OPTION,"Got TCP [NOT] flag match!\n");
return MATCH;
}
- else
- {
- DebugMessage(DEBUG_IPS_OPTION, "No match\n");
- }
break;
case M_ANY:
if ((flagptr->tcp_flags & tcp_flags) != 0) /* something set */
{
- DebugMessage(DEBUG_IPS_OPTION,"Got TCP [ANY] flag match!\n");
return MATCH;
}
- else
- {
- DebugMessage(DEBUG_IPS_OPTION,"No match\n");
- }
break;
default: /* Should never see this */
- DebugMessage(DEBUG_IPS_OPTION, "TCP flag check went to default case"
- " for some silly reason\n");
break;
}
return;
}
- DebugFormat(DEBUG_FLOWBITS, "%s tag id parsing %s\n", s_name, flowbits_names);
-
flowbits_name = snort_strdup(flowbits_names);
if (nullptr != strchr(flowbits_name, '|'))
return flowbits_grp;
}
-#ifdef DEBUG_MSGS
-static void printOutFlowbits(FLOWBITS_OP* flowbits)
-{
- DebugFormat(DEBUG_FLOWBITS, "%s: type = %d\n", s_name, flowbits->type);
- DebugFormat(DEBUG_FLOWBITS, "%s: name = %s\n", s_name, flowbits->name);
- DebugFormat(DEBUG_FLOWBITS, "%s: eval = %d\n", s_name, flowbits->eval);
- DebugFormat(DEBUG_FLOWBITS, "%s: num_ids = %d\n", s_name, flowbits->num_ids);
- DebugFormat(DEBUG_FLOWBITS, "%s: grp_id = %u\n", s_name, flowbits->group_id);
- DebugFormat(DEBUG_FLOWBITS, "%s: group_name = %s\n", s_name, flowbits->group);
-
- for (int i = 0; i < flowbits->num_ids; i++)
- {
- DebugFormat(DEBUG_FLOWBITS, "%s: value = %d\n", s_name, flowbits->ids[i]);
- }
-}
-#endif
-
static void processFlowBitsWithGroup(char* flowbitsName, char* groupName, FLOWBITS_OP* flowbits)
{
FLOWBITS_GRP* flowbits_grp;
flowbits->group_id = flowbits_grp->group_id;
}
validateFlowbitsSyntax(flowbits);
- DEBUG_WRAP(printOutFlowbits(flowbits));
if ( flowbits->group )
op_list.push_front(flowbits);
if (!p->has_ip())
{
- DebugMessage(DEBUG_IPS_OPTION,"Not IP\n");
return NO_MATCH;
}
if ((config.any_flag == 1) && (option_len > 0))
{
- DebugMessage(DEBUG_IPS_OPTION, "Matched any ip options!\n");
return MATCH;
}
for ( const ip::IpOptions& opt : iter)
{
- DebugFormat(DEBUG_IPS_OPTION, "testing pkt(%d):rule(%d)\n",
- static_cast<int>(config.ip_option),
- static_cast<int>(opt.code));
-
if (config.ip_option == opt.code)
return MATCH;
}
/* now compile the re */
- DebugFormat(DEBUG_PATTERN_MATCH, "pcre: compiling %s\n", re);
pcre_data->re = pcre_compile(re, compile_flags, &error, &erroffset, nullptr);
if (pcre_data->re == nullptr)
}
else
{
- DebugFormat(DEBUG_PATTERN_MATCH, "pcre_exec error : %d \n", result);
return false;
}
#define DEBUG_BUILTIN "SNORT_DEBUG"
#define DEBUG_INIT 0x0000000000000001LL
-#define DEBUG_PARSER 0x0000000000000002LL
#define DEBUG_PORTLISTS 0x0000000000000004LL
#define DEBUG_ATTRIBUTE 0x0000000000000008LL
#define DEBUG_DECODE 0x0000000000000010LL
#define DEBUG_CONFIGRULES 0x0000000000000020LL
-#define DEBUG_DETECT 0x0000000000000040LL
#define DEBUG_PATTERN_MATCH 0x0000000000000080LL
-#define DEBUG_FLOW 0x0000000000000100LL
#define DEBUG_LOG 0x0000000000000200LL
-#define DEBUG_FLOWBITS 0x0000000000000400LL
#define DEBUG_FILE 0x0000000000000800LL
#define DEBUG_MEMORY 0x0000000000001000LL
// FIXIT-L latency doesn't use any debug messages
#define DEBUG_STREAM 0x0000000200000000LL
#define DEBUG_STREAM_STATE 0x0000000400000000LL
#define DEBUG_STREAM_PAF 0x0000000800000000LL
-#define DEBUG_ASN1 0x0000002000000000LL
#define DEBUG_CODEC 0x0001000000000000LL
#define DEBUG_IPS_ACTION 0x0004000000000000LL
-#define DEBUG_IPS_OPTION 0x0008000000000000LL
#define DEBUG_MPSE 0x0010000000000000LL
#define DEBUG_SO_RULE 0x0020000000000000LL
#define DEBUG_LOGGER 0x0040000000000000LL