From: rcombs Date: Thu, 13 Nov 2014 21:33:21 +0000 (-0500) Subject: legacy paf_max implementation X-Git-Tag: 3.0.0-233~1226 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f45367974c0ce7013de4fa4a783ee14a7397a900;p=thirdparty%2Fsnort3.git legacy paf_max implementation --- diff --git a/ChangeLog b/ChangeLog index 66cb1d5b9..702ad77e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ -- fixed inspector reinit -- fixed byte_extract and byte_jump endianisms -- suspend active when purging caches +-- temporary support for legacy paf_max 127 -- REG_TEST out logging tcp options for rebuilt packets to match snort bug diff --git a/src/stream/stream_splitter.cc b/src/stream/stream_splitter.cc index 4207420f2..86103c8a5 100644 --- a/src/stream/stream_splitter.cc +++ b/src/stream/stream_splitter.cc @@ -29,8 +29,13 @@ static THREAD_LOCAL uint8_t pdu_buf[65536]; static THREAD_LOCAL StreamBuffer str_buf; +unsigned StreamSplitter::max_pdu = 16384; + +void StreamSplitter::set_max(unsigned m) +{ max_pdu = m; } + unsigned StreamSplitter::max() -{ return 16384; } // subclasses should override this +{ return max_pdu; } const StreamBuffer* StreamSplitter::reassemble( Flow*, unsigned, unsigned offset, const uint8_t* p, diff --git a/src/stream/stream_splitter.h b/src/stream/stream_splitter.h index e5637d92a..83f0a1fc0 100644 --- a/src/stream/stream_splitter.h +++ b/src/stream/stream_splitter.h @@ -69,6 +69,11 @@ public: virtual bool is_paf() { return false; }; virtual unsigned max(); + // FIXIT-L this is temporary for legacy paf_max required only + // for HI; it is not appropriate for multiple stream_tcp with + // different paf_max; the HI splitter should pull from there + static void set_max(unsigned); + virtual void reset() { }; virtual void update() { }; @@ -79,7 +84,7 @@ protected: StreamSplitter(bool b) { c2s = b; }; private: - static unsigned s_max; + static unsigned max_pdu; bool c2s; }; diff --git a/src/stream/tcp/stream_tcp.cc b/src/stream/tcp/stream_tcp.cc index cb56868a4..a4a0947ea 100644 --- a/src/stream/tcp/stream_tcp.cc +++ b/src/stream/tcp/stream_tcp.cc @@ -31,6 +31,7 @@ #include "main/snort.h" #include "stream/flush_bucket.h" +#include "stream/stream_splitter.h" //------------------------------------------------------------------------- // inspector stuff @@ -43,6 +44,7 @@ public: ~StreamTcp(); void show(SnortConfig*) override; + bool configure(SnortConfig*) override; void tinit() override; void tterm() override; @@ -68,6 +70,12 @@ void StreamTcp::show(SnortConfig*) tcp_show(config); } +bool StreamTcp::configure(SnortConfig*) +{ + StreamSplitter::set_max(config->paf_max); + return true; +} + void StreamTcp::tinit() { FlushBucket::set(config->footprint);