]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: use max-region setting from suricata.yaml
authorShivani Bhardwaj <shivani@oisf.net>
Fri, 21 Mar 2025 10:36:58 +0000 (16:06 +0530)
committerVictor Julien <victor@inliniac.net>
Sat, 29 Mar 2025 05:37:59 +0000 (06:37 +0100)
1. Add key (commented) to suricata.yaml
2. Give the configured/default key preference, save a check

src/util-streaming-buffer.c
suricata.yaml.in

index fb9ffe98fd477cb01b9059a1dfb4c2131b5c5717..2b7d3c441fb5c0f7930a8461ea126a7434644c41 100644 (file)
@@ -213,7 +213,7 @@ static StreamingBufferRegion *FindRightEdge(const StreamingBufferConfig *cfg,
 static inline StreamingBufferRegion *InitBufferRegion(
         StreamingBuffer *sb, const StreamingBufferConfig *cfg, const uint32_t min_size)
 {
-    if (sb->regions == USHRT_MAX || (cfg->max_regions != 0 && sb->regions >= cfg->max_regions)) {
+    if ((cfg->max_regions != 0 && sb->regions >= cfg->max_regions) || (sb->regions == UINT16_MAX)) {
         SCLogDebug("max regions reached");
         sc_errno = SC_ELIMIT;
         return NULL;
index 4d46c2502ff038398b13c3fd99279319e9436f93..0bd021b09640cb709b354793d030c2f4aa4672c9 100644 (file)
@@ -1643,6 +1643,9 @@ flow-timeouts:
 #                               # is used or when stream-event:reassembly_overlap_different_data;
 #                               # is used in a rule.
 #
+#     max-regions: 8            # maximum number of concurrent regions per streaming buffer
+#                               # defaults to 8, if no configuration was provided. 0 means no limit.
+
 stream:
   memcap: 64 MiB
   #memcap-policy: ignore