Home page logo
/

snort logo Snort mailing list archives

Re: After updating to 2.9.4.6, S5: Session exceeded configured max bytes to queue messages
From: Gregory S Thomas <greg.thomas () pnnl gov>
Date: Tue, 30 Apr 2013 14:21:25 -0700

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;

-----Original Message-----
Date: Tue, 30 Apr 2013 09:56:34 +0000
From: Y M <snort () outlook com>
Subject: Re: After updating to 2.9.4.6, S5: Session exceeded configured max bytes to queue messages
To: "C. L. Martinez" <carlopmart () gmail com>, "snort-users () lists sourceforge net" <snort-users () lists 
sourceforge net>
Message-ID: <BLU164-W162CC5257A4D15804EC675A8B30 () phx gbl>

Take a look at the following:
http://seclists.org/snort/2012/q3/124
http://seclists.org/snort/2009/q4/518
and,
https://groups.google.com/forum/#!msg/snortusers/K6aTQ85FYv0/xgR-qdLiKmAJ
I haven't changed the max_queued_bytes value on my sensors, yet. Hope it helps.YM

-----Original Message-----
Date: Tue, 30 Apr 2013 08:28:22 +0000
From: "C. L. Martinez" <carlopmart () gmail com>
Subject: After updating to 2.9.4.6, S5: Session exceeded configured max bytes to queue messages
To: "snort-users () lists sourceforge net" <snort-users () lists sourceforge net>
Message-ID: <CAEjQA5+xjs7MuEkQn5mwLLkXLDXQywRyPEODbXMOFH0CV-DkbQ () mail gmail com>

Hi all,

  After updating to 2.9.4.6 (from 2.9.4.1) I can see a lot of errrors like
this:

Apr 30 08:19:28 nsm01 snort[34067]: S5: Session exceeded configured max
bytes to queue 1048576 using 1048634 bytes (client queue). 10.230.7.72 1544
--> 10.196.0.15 80 (0) : LWstate 0x9 LWFlags 0x6007
Apr 30 08:19:29 nsm01 snort[34067]: S5: Session exceeded configured max
bytes to queue 1048576 using 1049720 bytes (server queue). 10.196.4.5 33039
--> 10.196.0.72 25 (0) : LWstate 0x9 LWFlags 0x406007
Apr 30 08:19:53 nsm01 snort[34067]: S5: Session exceeded configured max
bytes to queue 1048576 using 1048917 bytes (server queue). 10.196.0.58 3316
--> 10.196.4.5 25 (0) : LWstate 0x9 LWFlags 0x406007

My stream5 config is:

preprocessor stream5_global: memcap 268435456, track_tcp yes, \
    track_udp yes, \
    track_icmp no, \
    max_tcp 262144, \
    max_udp 131072, \
    max_active_responses 2, \
    min_response_seconds 5
preprocessor stream5_tcp: policy windows, detect_anomalies, require_3whs
180, \
    overlap_limit 10, small_segments 3 bytes 150, timeout 180,
max_queued_segs 262100, \
     ports client 21 22 23 25 42 53 70 79 109 110 111 113 119 135 136 137
139 143 \
         161 445 513 514 587 593 691 1433 1521 1741 2100 3306 6070 6665 6666
6667 6668 6669 \
         7000 8181 32770 32771 32772 32773 32774 32775 32776 32777 32778
32779, \
     ports both 80 81 82 83 84 85 86 87 88 89 110 311 383 443 465 563 591
593 631 636 901 989 992 993 994 995 1220 1414 1830 2301 2381 2809 3037 3128
3702 4343 4848 5250 6988 7907 7000 7001 7144 \
         7145 7510 7802 7777 7779 7801 7900 7901 7902 7903 7904 7905 7906
7908 7909 7910 7911 7912 7913 7914 7915 7916 \
         7917 7918 7919 7920 8000 8008 8014 8028 8080 8085 8088 8090 8118
8123 8180 8222 8243 8280 8300 8800 8888 8899 9000 9060 9080 9090 9091 9443
9999 11371 34443 34444 41080 55555 \
         1090 3200 3210 3300 3310 3333 3600 3610 8100 50000:50010 51000:51010
preprocessor stream5_udp: timeout 180

Do I need to add "max_queued_bytes 0" to stream5_tcp ?? I'm not convinced
of it ...

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
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
_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://sourceforge.net/mailarchive/forum.php?forum_name=snort-users

Please visit http://blog.snort.org to stay current on all the latest Snort news!


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault