From 8e9dac99f318151328e3d7e52a34c25f97b9f228 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 9 Jan 2023 17:53:07 +0100 Subject: [PATCH] stream/reassembly: make max-regions configurable; set default --- src/stream-tcp-reassemble.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index ce5f90309b..8cde25e23f 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -484,7 +484,22 @@ static int StreamTcpReassemblyConfig(bool quiet) StreamTcpReassembleConfigEnableOverlapCheck(); } + uint16_t max_regions = 8; + ConfNode *mr = ConfGetNode("stream.reassembly.max-regions"); + if (mr) { + uint16_t max_r = 0; + if (StringParseUint16(&max_r, 10, (uint16_t)strlen(mr->val), mr->val) < 0) { + SCLogError("max-regions %s is invalid", mr->val); + return -1; + } + max_regions = max_r; + } + if (!quiet) + SCLogConfig("stream.reassembly \"max-regions\": %u", max_regions); + + stream_config.prealloc_segments = segment_prealloc; stream_config.sbcnf.buf_size = 2048; + stream_config.sbcnf.max_regions = max_regions; stream_config.sbcnf.Calloc = ReassembleCalloc; stream_config.sbcnf.Realloc = StreamTcpReassembleRealloc; stream_config.sbcnf.Free = ReassembleFree;