-- disabled markup sanitizer() for correct asciidoc results
-- tweaked snort.lua and snort_defaults.lua
-- updated usage
+-- removed ! from error messages
122
-- pulled thread pinning from Josh
* Most debug messages should just be deleted.
+* Don't bang your messages (no !). The user feels bad enough about the
+ problem already w/o you shouting at him.
+
+
==== Types
* Use logical types to make the code clearer and to help the compiler catch
case PPP_VJ_COMP:
if (!had_vj)
ErrorMessage("PPP link seems to use VJ compression, "
- "cannot handle compressed packets!\n");
+ "cannot handle compressed packets\n");
had_vj = true;
return false;
case PPP_VJ_UCOMP:
if(raw.len < (uint32_t)(codec.lyr_len + ip::IP4_HEADER_LEN))
{
if (ScLogVerbose())
- ErrorMessage("PPP VJ min packet length > captured len! "
+ ErrorMessage("PPP VJ min packet length > captured len"
"(%d bytes)\n", raw.len);
return false;
}
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < Encap header length! (%d bytes)\n",
+ ErrorMessage("Captured data length < Encap header length (%d bytes)\n",
cap_len);
}
MODULE_PROFILE_END(decodePerfStats);
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < FDDI header length! "
+ ErrorMessage("Captured data length < FDDI header length "
"(%d %d bytes)\n", cap_len, dataoff);
MODULE_PROFILE_END(decodePerfStats);
return;
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < FDDI header length! "
+ ErrorMessage("Captured data length < FDDI header length "
"(%d %d bytes)\n", cap_len, dataoff);
MODULE_PROFILE_END(decodePerfStats);
return;
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < FDDI header length! "
+ ErrorMessage("Captured data length < FDDI header length "
"(%d %d bytes)\n", cap_len, dataoff);
MODULE_PROFILE_END(decodePerfStats);
return;
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < FDDI header length! "
+ ErrorMessage("Captured data length < FDDI header length "
"(%d %d bytes)\n", cap_len, dataoff);
MODULE_PROFILE_END(decodePerfStats);
return;
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < Pflog header length! "
+ ErrorMessage("Captured data length < Pflog header length "
"(%d bytes)\n", cap_len);
}
MODULE_PROFILE_END(decodePerfStats);
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < minimum Pflog length! "
+ ErrorMessage("Captured data length < minimum Pflog length "
"(%d < %lu)\n", cap_len, (unsigned long)PFLOG2_HDRMIN);
}
MODULE_PROFILE_END(decodePerfStats);
default:
if (ScLogVerbose())
{
- ErrorMessage("unrecognized pflog header length! (%d)\n",
+ ErrorMessage("unrecognized pflog header length (%d)\n",
*((uint8_t*)pkt));
}
dc.discards++;
{
if (ScLogVerbose())
{
- ErrorMessage("Captured data length < Pflog header length! "
+ ErrorMessage("Captured data length < Pflog header length "
"(%d < %d)\n", cap_len, hlen);
}
dc.discards++;
{
if (ScLogVerbose())
{
- ErrorMessage("Bad Pflog header length! (%d bytes)\n", pflen);
+ ErrorMessage("Bad Pflog header length (%d bytes)\n", pflen);
}
dc.discards++;
MODULE_PROFILE_END(decodePerfStats);
if (otn->sigInfo.num_services && check_ports) /* none of the services match */
{
- DEBUG_WRAP(DebugMessage(DEBUG_DETECT, "[**] SID %d not matched because of service mismatch (%d!=%d [**]\n",
+ DEBUG_WRAP(DebugMessage(DEBUG_DETECT,
+ "[**] SID %d not matched because of service mismatch (%d!=%d [**]\n",
otn->sigInfo.id,
eval_data->p->application_protocol_ordinal,
otn->sigInfo.services[0].service_ordinal););
/* convert the tcp-any-any to a PortObject2 creature */
po2 = PortObject2Dup(p->tcp_anyany);
if (po2 == NULL)
- FatalError("Could not create a PortObject version 2 for tcp-any-any rules\n!");
+ FatalError("Could not create a PortObject version 2 for tcp-any-any rules\n");
if (!fpDetectSplitAnyAny(fp))
add_any_any = po2;
/* UDP */
po2 = PortObject2Dup(p->udp_anyany);
if (po2 == NULL )
- FatalError("Could not create a PortObject version 2 for udp-any-any rules\n!");
+ FatalError("Could not create a PortObject version 2 for udp-any-any rules\n");
if (!fpDetectSplitAnyAny(fp))
add_any_any = po2;
/* ICMP */
po2 = PortObject2Dup(p->icmp_anyany);
if (po2 == NULL)
- FatalError("Could not create a PortObject version 2 for icmp-any-any rules\n!");
+ FatalError("Could not create a PortObject version 2 for icmp-any-any rules\n");
if (!fpDetectSplitAnyAny(fp))
add_any_any = po2;
/* IP */
po2 = PortObject2Dup(p->ip_anyany);
if (po2 == NULL)
- FatalError("Could not create a PortObject version 2 for ip-any-any rules\n!");
+ FatalError("Could not create a PortObject version 2 for ip-any-any rules\n");
if (!fpDetectSplitAnyAny(fp))
add_any_any = po2;
id = AddProtocolReference(srvc);
if(id <=0 )
- FatalError("Could not AddProtocolReference!\n");
+ FatalError("Could not AddProtocolReference\n");
else if( id >= MAX_PROTOCOL_ORDINAL )
ParseWarning("protocol-ordinal=%d exceeds "
else /* id < 0 */
{
ParseError("adding protocol-ordinal=%d for "
- "service=%s, can't use that !!!\n",id,srvc);
+ "service=%s, can't use that\n",id,srvc);
}
}
else
{
- ParseError("*** failed to create and find a port group for '%s' !!! \n",srvc );
+ ParseError("*** failed to create and find a port group for '%s'\n",srvc );
}
}
}
if (file_config->FileRules[rule->id])
{
- ParseError("file type: duplicated rule id %d defined!", rule->id);
+ ParseError("file type: duplicated rule id %d defined", rule->id);
free(rule);
return;
}
RuleInfo *info;
if (SNORT_FILE_TYPE_UNKNOWN == id)
- return "Unknown file type, done!";
+ return "Unknown file type, done";
else if (SNORT_FILE_TYPE_CONTINUE == id)
return "Undecided file type, continue...";
1); /* Recycle nodes */
if(!t)
{
- printf("Low Memory!\n");
+ printf("Low Memory\n");
exit(0);
}
/* Add Nodes to the Hash Table */
*/
if( sfxhash_remove(t,n->key) )
{
- printf("...ERROR: Could not remove the key node!\n");
+ printf("...ERROR: Could not remove the key node\n");
}
else
{
printf("\n");
//if(BitStringOverflow(asn1_type))
//{
- // printf("!! BITSTRING OVERFLOW\n");
+ // printf("BITSTRING OVERFLOW\n");
//}
printf("\n");
/* check to make sure that this the depth allows this rule to fire */
if (pmd->depth < (int)pmd->pattern_size)
{
- ParseError("the depth (%d) is less than the size of the content(%u)!",
+ ParseError("the depth (%d) is less than the size of the content(%u)",
pmd->depth, pmd->pattern_size);
return;
}
{
TextLog_Print(
log, "Got bogus buffer length (%d) for LogNetData, "
- "defaulting to %d bytes!\n", len, BYTES_PER_FRAME
+ "defaulting to %d bytes\n", len, BYTES_PER_FRAME
);
}
end = data + BYTES_PER_FRAME;
if ( !txt )
{
- FatalError("Unable to allocate a TextLog(%u)!\n", maxBuf);
+ FatalError("Unable to allocate a TextLog(%u)\n", maxBuf);
return nullptr;
}
txt->name = name ? SnortStrdup(name) : NULL;
}
else
{
- syslog(priority, "%s", msg == NULL ? "ALERT!" : msg);
+ syslog(priority, "%s", msg == NULL ? "ALERT" : msg);
}
}
get_instance_file(name, UNSOCK_FILE);
if ( access(name.c_str(), W_OK) )
- ErrorMessage("%s file doesn't exist or isn't writable!\n", name.c_str());
+ ErrorMessage("%s file doesn't exist or isn't writable\n", name.c_str());
memset((char *) &us.addr, 0, sizeof(us.addr));
us.addr.sun_family = AF_UNIX;
if (((fwcount = fwrite(buf, (size_t)buf_len, 1, u2.stream)) == 1) &&
((ffstatus = fflush(u2.stream)) == 0))
{
- ErrorMessage("%s(%d) Write to unified2 file succeeded!\n",
+ ErrorMessage("%s(%d) Write to unified2 file succeeded\n",
__FILE__, __LINE__);
error = 0;
break;
}
else if ((ffstatus = fflush(u2.stream)) == 0)
{
- ErrorMessage("%s(%d) Write to unified2 file succeeded!\n",
+ ErrorMessage("%s(%d) Write to unified2 file succeeded\n",
__FILE__, __LINE__);
error = 0;
break;
if (((fwcount = fwrite(buf, (size_t)buf_len, 1, u2.stream)) == 1) &&
((ffstatus = fflush(u2.stream)) == 0))
{
- ErrorMessage("%s(%d) Write to unified2 file succeeded!\n",
+ ErrorMessage("%s(%d) Write to unified2 file succeeded\n",
__FILE__, __LINE__);
error = 0;
break;
if ( ScTestMode() ||
(!Trough_GetQCount() && !(snort_conf->run_flags & RUN_FLAG__SHELL)) )
{
- LogMessage("\nSnort successfully validated the configuration!\n");
+ LogMessage("\nSnort successfully validated the configuration.\n");
// force test mode to exit w/o stats
snort_conf->run_flags |= RUN_FLAG__TEST;
if (cpu == -1)
{
ParseError("%s - cpu(%d) for thread (%d) and source (%s) "
- "must be an integer in the range "
- "of 0 < cpu < max_cpus", fqn, cpu);
+ "must be an integer in the range of 0 < cpu < max_cpus", fqn, cpu);
return false;
}
else if ((source.empty()) && (thread == -1))
{
- ParseError("%s - must have either a source or a thread!", fqn);
+ ParseError("%s - must have either a source or a thread", fqn);
return false;
}
else if ((!source.empty()) && (thread >= 0))
{
- ParseError("%s - must have either a source or a thread!"
- " Both thread(%d) and source(%s) are set", fqn, thread, source.c_str());
+ ParseError("%s - cannot set both thread(%d) and source(%s)",
+ fqn, thread, source.c_str());
return false;
}
auto search = sa.find(str);
if(search != sa.end())
- ParseError("Multiple CPU's set for interface %s", str.c_str());
+ ParseError("multiple CPUs set for interface %s", str.c_str());
sa[std::string(str)] = cpu;
return false;
cpu = ta[instance_id];
}
+ if ( cpu < 0 )
+ return;
- if (cpu != -1)
+#if LINUX
+ static THREAD_LOCAL cpu_set_t cpu_set;
+
+ if (cpu >= CPU_SETSIZE)
+ FatalError("Maximum CPU value for this Operating System is %d",
+ CPU_SETSIZE);
+
+ CPU_ZERO(&cpu_set);
+
+ if (!sched_getaffinity(0, sizeof(cpu_set), &cpu_set))
+ if (!CPU_ISSET(cpu, &cpu_set))
+ FatalError("CPU %d is not part of source %s's and thread "
+ "%d's CPU set\n", cpu, source, instance_id);
+
+ CPU_ZERO(&cpu_set);
+ CPU_SET(cpu, &cpu_set);
+
+ if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set))
+ FatalError("Unable to pin source %s to CPU %d: %s\n",
+ source, cpu, std::strerror(errno));
+#else
+ static bool warning_printed = false;
+
+ if (!warning_printed)
{
-// PREPROCESSOR MACROS -- these are not actually if statements!
-# if LINUX
- {
- static THREAD_LOCAL cpu_set_t cpu_set;
-
- if (cpu >= CPU_SETSIZE)
- FatalError("Maximum CPU value for this Operating System is %d",
- CPU_SETSIZE);
-
- CPU_ZERO(&cpu_set);
- if (!sched_getaffinity(0, sizeof(cpu_set), &cpu_set))
- if (!CPU_ISSET(cpu, &cpu_set))
- FatalError("CPU %d is not part of source %s's and thread "
- "%d's CPU set!\n", cpu, source, instance_id);
-
- CPU_ZERO(&cpu_set);
- CPU_SET(cpu, &cpu_set);
- if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set))
- FatalError("Unable to pin source %s to CPU %d! %s\n", source, cpu, std::strerror(errno));
-
- }
-# else
- {
- static bool warning_printed = false;
- if (!warning_printed)
- {
- WarningMessage("Thread Pinning / CPU affinity support is currently"
- " unsupported for this Operating System");
- warning_printed = true;
- }
- }
-# endif
+ WarningMessage("Thread Pinning / CPU affinity support is currently"
+ " unsupported for this Operating System");
+ warning_printed = true;
}
+#endif
}
//-------------------------------------------------------------------------
ParseAbort("Attempting to instantiate Codec '%s', "
- "but codec has not been added!!", cd_api->base.name);
+ "but codec has not been added", cd_api->base.name);
}
void CodecManager::add_plugin(const CodecApi* api)
{
if (!api->ctor)
- FatalError("CodecApi ctor() for Codec %s: ctor() must be implemented!!\n",
+ FatalError("CodecApi ctor() for Codec %s: ctor() must be implemented\n",
api->base.name);
if (!api->dtor)
- FatalError("CodecApi ctor() for Codec %s: ctor() must be implemented!!\n",
+ FatalError("CodecApi ctor() for Codec %s: ctor() must be implemented\n",
api->base.name);
CodecApiWrapper wrap;
}
if(!grinder)
- FatalError("PacketManager: Unable to find a Codec with data link type %d!!\n", daq_dlt);
+ FatalError("PacketManager: Unable to find a Codec with data link type %d\n", daq_dlt);
if ( !ScReadMode() || ScPcapShow() )
LogMessage("Decoding with %s\n", s_protocols[grinder]->get_name());
printf("%c", not_flag ? '!' : ' ');
printf("%s/", inet_ntoa(*(struct in_addr *) &host));
printf("%s", inet_ntoa(*(struct in_addr *) &mask));
- printf(" parsed successfully!\n");
+ printf(" parsed successfully\n");
}
/* host byte order stuff */
s_link = eth_open(dev);
if ( !s_link )
- FatalError("%s: can't open %s!\n",
+ FatalError("%s: can't open %s\n",
"Active response", dev);
s_send = Active_SendEth;
}
s_ipnet = ip_open();
if ( !s_ipnet )
- FatalError("%s: can't open ip!\n",
+ FatalError("%s: can't open ip\n",
"Active response");
s_send = Active_SendIp;
}
if ( !strcasecmp(daq_mode_string((DAQ_Mode)i), sc->daq_mode) )
{
if ( ScAdapterInlineMode() && (i != DAQ_MODE_INLINE) )
- FatalError("DAQ '%s' mode incompatible with -Q!\n", sc->daq_mode);
+ FatalError("DAQ '%s' mode incompatible with -Q\n", sc->daq_mode);
return (DAQ_Mode)i;
}
}
- FatalError("Bad DAQ mode '%s'!\n", sc->daq_mode);
+ FatalError("Bad DAQ mode '%s'\n", sc->daq_mode);
}
if ( ScAdapterInlineMode() )
return DAQ_MODE_INLINE;
daq_mod = daq_find_module(type);
if ( !daq_mod )
- FatalError("Can't find %s DAQ!\n", type);
+ FatalError("Can't find %s DAQ\n", type);
snap = ( sc->pkt_snaplen > 0 ) ? sc->pkt_snaplen : PKT_SNAPLEN;
daq_mode = DAQ_GetMode(sc);
bpf_gate.unlock();
if ( err )
- FatalError("Can't set DAQ BPF filter to '%s' (%s)!\n",
+ FatalError("Can't set DAQ BPF filter to '%s' (%s)\n",
bpf, daq_get_error(daq_mod, daq_hand));
return err;
DAQ_Config_t cfg;
if ( !daq_mod )
- FatalError("DAQ_Init not called!\n");
+ FatalError("DAQ_Init not called\n");
if ( intf )
interface_spec = SnortStrdup(intf);
int err = daq_start(daq_mod, daq_hand);
if ( err )
- FatalError("Can't start DAQ (%d) - %s!\n",
+ FatalError("Can't start DAQ (%d) - %s\n",
err, daq_get_error(daq_mod, daq_hand));
else if ( !DAQ_UnprivilegedStart() )
int err = daq_stop(daq_mod, daq_hand);
if ( err )
- LogMessage("Can't stop DAQ (%d) - %s!\n",
+ LogMessage("Can't stop DAQ (%d) - %s\n",
err, daq_get_error(daq_mod, daq_hand));
return err;
#endif
if ( err && err != DAQ_READFILE_EOF )
- LogMessage("Can't acquire (%d) - %s!\n",
+ LogMessage("Can't acquire (%d) - %s\n",
err, daq_get_error(daq_mod, daq_hand));
if ( s_error != DAQ_SUCCESS )
int err = daq_inject(daq_mod, daq_hand, (DAQ_PktHdr_t*)h, buf, len, rev);
#ifdef DEBUG
if ( err )
- LogMessage("Can't inject (%d) - %s!\n",
+ LogMessage("Can't inject (%d) - %s\n",
err, daq_get_error(daq_mod, daq_hand));
#endif
return err;
err = daq_get_stats(daq_mod, daq_hand, &daq_stats);
if ( err )
- LogMessage("Can't get DAQ stats (%d) - %s!\n",
+ LogMessage("Can't get DAQ stats (%d) - %s\n",
err, daq_get_error(daq_mod, daq_hand));
if ( !daq_stats.hw_packets_received )
if(value == NULL)
{
- ParseAbort("bad value in variable definition! Make sure you don't "
+ ParseAbort("bad value in variable definition. Make sure you don't "
"have a '$' in the var name.");
}
break;
case SFIP_NOT_ANY:
- ParseAbort("!any is not allowed in %s.", name);
+ ParseAbort("!any is not allowed in %s", name);
break;
default:
#include "util.h"
#include "main/thread.h"
-#define MEMASSERT(p,s) if(!p){fprintf(stderr,"ACSM-No Memory: %s!\n",s);exit(0);}
+#define MEMASSERT(p,s) if(!p){fprintf(stderr,"ACSM-No Memory: %s\n",s);exit(0);}
#ifdef DEBUG_AC
static int max_memory = 0;
#define printf LogMessage
-#define MEMASSERT(p,s) if(!p){FatalError("ACSM-No Memory: %s!\n",s);}
+#define MEMASSERT(p,s) if(!p){FatalError("ACSM-No Memory: %s\n",s);}
static int acsm2_total_memory = 0;
static int acsm2_pattern_memory = 0;
#include "hi_util_xmalloc.h"
-//#define MEMASSERT(p) if(!p){printf("KMAP-No Memory: File: %s Line:%d!\n",__FILE__,__LINE__);exit(0);}
+//#define MEMASSERT(p) if(!p){printf("KMAP-No Memory: File: %s Line:%d\n",__FILE__,__LINE__);exit(0);}
#define MEMASSERT(p)
#include "hi_util_xmalloc.h"
-//#define MEMASSERT(p) if(!p){printf("KMAP-No Memory: File: %s Line:%d!\n",__FILE__,__LINE__);exit(0);}
+//#define MEMASSERT(p) if(!p){printf("KMAP-No Memory: File: %s Line:%d\n",__FILE__,__LINE__);exit(0);}
#define MEMASSERT(p)
/*
/* enum for policy names */
static const char *frag_policy_names[] =
{
- "no policy!",
+ "no policy",
"FIRST",
"LINUX",
"BSD",
/* enum for policy names */
static const char *reassembly_policy_names[] = {
- "no policy!",
+ "no policy",
"FIRST",
"LINUX",
"BSD",
i, idx, idx->seq, idx->size, idx->next, idx->prev););
if(st->seg_count < i)
- FatalError("Circular list, WTF?\n");
+ FatalError("Circular list\n");
idx = idx->next;
}
}
}
- DEBUG_WRAP(DebugMessage(DEBUG_PATTERN_MATCH, "got wildcard final char match! (b[%d]: %c -> p[%d]: %c\n", b_idx, buf[b_idx], p_idx, ptrn[p_idx]););
+ DEBUG_WRAP(DebugMessage(DEBUG_PATTERN_MATCH,
+ "got wildcard final char match! (b[%d]: %c -> p[%d]: %c\n",
+ b_idx, buf[b_idx], p_idx, ptrn[p_idx]););
}
if(p_idx == 0)
}
}
- DEBUG_WRAP(DebugMessage(DEBUG_PORTLISTS,"***\n***Port Table Compiler Consistency Check Phase-I Passed !\n"););
+ DEBUG_WRAP(DebugMessage(DEBUG_PORTLISTS,
+ "***\n***Port Table Compiler Consistency Check Phase-I Passed !\n"););
/*
case PORT_OBJECT_PORT:
if( _po2_include_po_rules( p->pt_port_object[ poi->lport ], ipo ) )
{
- FatalError("InputPortObject<->CompositePortObject consistency Check II failed!\n");
+ FatalError("InputPortObject<->CompositePortObject consistency Check II failed\n");
}
break;
{
if( _po2_include_po_rules( p->pt_port_object[ i ], ipo ) )
{
- FatalError("InputPortObject<->CompositePortObject consistency Check II failed!\n");
+ FatalError("InputPortObject<->CompositePortObject consistency Check II failed\n");
}
lastpo = p->pt_port_object[ i ];
}
if (!str)
{
- FatalError("Unable to duplicate string: NULL!\n");
+ FatalError("Unable to duplicate string: NULL\n");
}
copy = strdup(str);
if (copy == NULL)
{
- FatalError("Unable to duplicate string: %s!\n", str);
+ FatalError("Unable to duplicate string: %s\n", str);
}
return copy;
return pv;
// FIXIT-M do not FatalError() on runtime allocation failures
- FatalError("Unable to allocate memory! (%lu requested)\n", size);
+ FatalError("Unable to allocate memory (%lu requested)\n", size);
return NULL;
}