The following patch adds a new max_queued_log_exceeded option to the stream5 preprocessor so that you can configure (i.e., disable or enable) the logging. Here is how you use the new option in your snort.conf to disable the logging:
preprocessor stream5_tcp: max_queued_log_exceeded 0, ...
diff -aur snort-2.9.4.6.orig/src/preprocessors/Stream5/snort_stream5_tcp.c snort-2.9.4.6/src/preprocessors/Stream5/snort_stream5_tcp.c
--- snort-2.9.4.6.orig/src/preprocessors/Stream5/snort_stream5_tcp.c 2013-03-21 13:03:47.000000000 +0000
+++ snort-2.9.4.6/src/preprocessors/Stream5/snort_stream5_tcp.c 2013-04-30 20:50:39.000000000 +0000
@@ -1195,6 +1195,7 @@
s5TcpPolicy->flags = 0;
s5TcpPolicy->max_queued_bytes = S5_DEFAULT_MAX_QUEUED_BYTES;
s5TcpPolicy->max_queued_segs = S5_DEFAULT_MAX_QUEUED_SEGS;
+ s5TcpPolicy->max_queued_log_exceeded = S5_DEFAULT_MAX_QUEUED_LOG_EXCEEDED;
s5TcpPolicy->max_consec_small_segs = S5_DEFAULT_CONSEC_SMALL_SEGS;
s5TcpPolicy->max_consec_small_seg_size = S5_DEFAULT_MAX_SMALL_SEG_SIZE;
@@ -1468,6 +1469,27 @@
}
max_s_toks = 2;
}
+ else if(!strcasecmp(stoks[0], "max_queued_log_exceeded"))
+ {
+ if(stoks[1])
+ {
+ long_val = SnortStrtol(stoks[1], &endPtr, 10);
+ if (errno == ERANGE)
+ {
+ errno = 0;
+ FatalError("%s(%d) => Invalid Max Queued Log Exceeded. Integer parameter required.\n",
+ file_name, file_line);
+ }
+ s5TcpPolicy->max_queued_log_exceeded = (uint32_t)long_val;
+ }
+
+ if (!stoks[1] || (endPtr == &stoks[1][0]))
+ {
+ FatalError("%s(%d) => Invalid Max Queued Log Exceeded. Integer parameter required.\n",
+ file_name, file_line);
+ }
+ max_s_toks = 2;
+ }
else if (!strcasecmp(stoks[0], "small_segments"))
{
char **ptoks;
@@ -1912,6 +1934,7 @@
LogMessage(" Maximum number of segs to queue per session: %d\n",
s5TcpPolicy->max_queued_segs);
}
+ LogMessage(" Log when max queued bytes or segs is exceeded: %d\n", s5TcpPolicy->max_queued_log_exceeded);
if (s5TcpPolicy->flags)
{
LogMessage(" Options:\n");
@@ -6396,6 +6419,8 @@
sfip_set_ip(&server_ip, &tcpssn->lwssn->server_ip);
client_ip_str = SnortStrdup(inet_ntoa(&client_ip));
server_ip_str = SnortStrdup(inet_ntoa(&server_ip));
+ if (s5TcpPolicy->max_queued_log_exceeded)
+ {
LogMessage("S5: Session exceeded configured max bytes to queue %d "
"using %d bytes (%s). %s %d --> %s %d "
#ifdef TARGET_BASED
@@ -6411,6 +6436,7 @@
#endif
tcpssn->lwssn->session_state,
tcpssn->lwssn->session_flags);
+ }
free(client_ip_str); // FIXTHIS eliminate strdup and free
free(server_ip_str);
@@ -6435,6 +6461,8 @@
sfip_set_ip(&server_ip, &tcpssn->lwssn->server_ip);
client_ip_str = SnortStrdup(inet_ntoa(&client_ip));
server_ip_str = SnortStrdup(inet_ntoa(&server_ip));
+ if (s5TcpPolicy->max_queued_log_exceeded)
+ {
LogMessage("S5: Session exceeded configured max segs to queue %d "
"using %d segs (%s). %s %d --> %s %d "
#ifdef TARGET_BASED
@@ -6449,6 +6477,7 @@
tcpssn->lwssn->application_protocol,
#endif
tcpssn->lwssn->session_state, tcpssn->lwssn->session_flags);
+ }
free(client_ip_str); // FIXTHIS eliminate strdup and free
free(server_ip_str);
diff -aur snort-2.9.4.6.orig/src/preprocessors/Stream5/stream5_common.h snort-2.9.4.6/src/preprocessors/Stream5/stream5_common.h
--- snort-2.9.4.6.orig/src/preprocessors/Stream5/stream5_common.h 2013-02-19 22:14:24.000000000 +0000
+++ snort-2.9.4.6/src/preprocessors/Stream5/stream5_common.h 2013-04-30 20:50:39.000000000 +0000
@@ -66,6 +66,8 @@
#define S5_MIN_MAX_QUEUED_SEGS 2 /* Don't let this go below 2 */
#define S5_MAX_MAX_QUEUED_SEGS 0x40000000 /* 1 GB worth of one-byte segments */
+#define S5_DEFAULT_MAX_QUEUED_LOG_EXCEEDED 1 /* enabled */
+
#define S5_DEFAULT_MAX_SMALL_SEG_SIZE 0 /* disabled */
#define S5_MAX_MAX_SMALL_SEG_SIZE 2048 /* 2048 bytes in single packet, uh, not small */
#define S5_MIN_MAX_SMALL_SEG_SIZE 0 /* 0 means disabled */
@@ -275,6 +277,7 @@
#endif
uint32_t max_queued_bytes;
uint32_t max_queued_segs;
+ uint32_t max_queued_log_exceeded;
uint32_t max_consec_small_segs;
uint32_t max_consec_small_seg_size;
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1