]> git.ipfire.org Git - thirdparty/suricata.git/commit
detect/flow: optimize only_stream/no_stream options
authorVictor Julien <vjulien@oisf.net>
Sat, 9 Sep 2023 15:38:17 +0000 (17:38 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Nov 2023 20:36:36 +0000 (21:36 +0100)
commit58c7a438ed22e82f7ed1fd853676fd789ff82f05
tree7439ec863b6a7c97274b25ce59c6e8bed034dff3
parente3cd0d073f18a9d760e332852d53bce080ea96f0
detect/flow: optimize only_stream/no_stream options

Until now the implementation would scan the stream, fallback to the
packet payload in exception cases, then keep track of where the match
was and in the flow match logic reject the match if it was in the wrong
buffer.

This patch simplifies this logic, by refusing to inspect the packet
payload when `only_stream` is set.

To do this the `only_stream`/`no_stream` options are now translated
to the pseudo protocols `tcp-stream` and `tcp-pkt` at parsing, so that
the `flow` keyword doesn't have to evaluate these conditions anymore.
src/detect-engine.c
src/detect-flow.c
src/detect.h