]> git.ipfire.org Git - thirdparty/suricata.git/commit
stream: add TCP urgent handling options
authorVictor Julien <vjulien@oisf.net>
Thu, 10 Oct 2024 14:12:09 +0000 (16:12 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 11 Dec 2024 13:50:39 +0000 (14:50 +0100)
commit6882bcb3e51bd3cf509fb6569cc30f48d7bb53d7
tree38b4e0af3ad6d564ceb03142fd3b86fa84c1bcb5
parent4c1554f4f690a7e89c4190b0fa3f31a19d0bbedc
stream: add TCP urgent handling options

TCP urgent handling is a complex topic due to conflicting RFCs and
implementations.

Until now the URG flag and urgent pointer values were simply ignored,
leading to an effective "inline" processing of urgent data. Many
implementations however, do not default to this behavior.

Many actual implementations use the urgent mechanism to send 1 byte of
data out of band to the application.

Complicating the matter is that the way the urgent logic is handled is
generally configurable both of the OS and the app level. So from the
network it is impossible to know with confidence what the settings are.

This patch adds the following policies:

`stream.reassembly.urgent.policy`:

- drop: drop URG packets before they affect the stream engine

- inline: ignore the urgent pointer and process all data inline

- oob (out of band): treat the last byte as out of band

- gap: skip the last byte, but do no adjust sequence offsets, leading to
       gaps in the data

For the `oob` option, tracking of a sequence number offset is required,
as the OOB data does "consume" sequence number space. This is limited to
64k. For this reason, there is a second policy:

`stream.reassembly.urgent.oob-limit-policy`:

- drop: drop URG packets before they affect the stream engine

- inline: ignore the urgent pointer and process all data inline

- gap: skip the last byte, but do no adjust sequence offsets, leading to
       gaps in the data

Bug: #7411.
14 files changed:
etc/schema.json
rules/stream-events.rules
src/app-layer.c
src/decode-events.c
src/decode-events.h
src/decode.c
src/decode.h
src/stream-tcp-list.c
src/stream-tcp-private.h
src/stream-tcp-reassemble.c
src/stream-tcp-reassemble.h
src/stream-tcp.c
src/stream-tcp.h
suricata.yaml.in