Commit Graph

15 Commits (main-7.0.x)

Author SHA1 Message Date
Victor Julien 9287320330 license: fixup file headers
Thanks to Josh Soref.
3 years ago
Victor Julien c15d511064 frames: enable only used frames
Enable only frames that are actually used.

Ticket: #4979.
3 years ago
Victor Julien aa376a3b21 detect/frame: improve frame detection
Add a per frame progress tracker.
3 years ago
Victor Julien 6cbb5306c6 frame: add debug validation check 3 years ago
Victor Julien b43dc5a64a app-layer/frames: use absolute frame offset
Frame offset was already a 64 bit integer, so simplify things by
making it an absolute offset from the start of the stream.
3 years ago
Victor Julien 39d9b3adbe frames: implement generic <alproto>.stream frames
Add a hard coded <alproto>.stream option for all stream data for
a protocol.

Starts at stream offset 0 or at the point of a protocol upgrade
in case of STARTTLS or CONNECT.
3 years ago
Victor Julien 17cd41c887 frames: suppress cppcheck warning
src/app-layer-frames.c:471:5: warning: Identical condition 'stream_slice->input==NULL', second condition is always false [identicalConditionAfterEarlyExit]
    BUG_ON(stream_slice->input == NULL);
    ^
src/app-layer-frames.c:468:29: note: If condition 'stream_slice->input==NULL' is true, the function will return/exit
    if (stream_slice->input == NULL)
                            ^
src/app-layer-frames.c:471:5: note: Testing identical condition 'stream_slice->input==NULL'
    BUG_ON(stream_slice->input == NULL);
    ^
src/app-layer-frames.c:548:5: warning: Identical condition 'stream_slice->input==NULL', second condition is always false [identicalConditionAfterEarlyExit]
    BUG_ON(stream_slice->input == NULL);
    ^
src/app-layer-frames.c:545:29: note: If condition 'stream_slice->input==NULL' is true, the function will return/exit
    if (stream_slice->input == NULL)
                            ^
src/app-layer-frames.c:548:5: note: Testing identical condition 'stream_slice->input==NULL'
    BUG_ON(stream_slice->input == NULL);
    ^
3 years ago
Victor Julien 39cf5b151a src: includes cleanup
Work towards making `suricata-common.h` only introduce system headers
and other things that are independent of complex internal Suricata
data structures.

Update files to compile after this.

Remove special DPDK handling for strlcpy and strlcat, as this caused
many compilation failures w/o including DPDK headers for all files.

Remove packet macros from decode.h and move them into their own file,
turn them into functions and rename them to match our function naming
policy.
3 years ago
Victor Julien e250ef6402 debug: remove empty header 3 years ago
Philippe Antoine 02f2602dde src: rework includes as per cppclean 4 years ago
Victor Julien 3a7d09edfc detect/frame: get data using stream callback
Inspect only data that has already been consumed by the
app-layer parser. This allows for simpler progress tracking.
4 years ago
Philippe Antoine f30975fb16 app-layer: fix integer warnings
Ticket: 4516
4 years ago
Victor Julien 013fb2dde3 frames: remove dead condition in eof check 4 years ago
Victor Julien c96d22e8a1 frames: support UDP frames
UDP frames point to the UDP packet payloads.

The frames are removed after each packet.

Ticket: #4983.
4 years ago
Victor Julien 1556e86c7d app/frames: initial support
The idea of stream frames is that the applayer parsers can tag PDUs and
other arbitrary frames in the stream while parsing. These frames can then
be inspected from the rule language. This will allow rules that are more
precise and less costly.

The frames are stored per direction in the `AppLayerParserState` and will only
be initialized when actual frames are in use. The per direction storage has a
fixed size static portion and dynamic support for a larger number. This is done
for effeciency.

When the Stream Buffer slides, frames are updated as they use offsets relative
to the stream. A negative offset is used for frames that started before the
current window.

Frames have events to inspect/log parser errors that don't fit the TX model.

Frame id starts at 1. So implementations can keep track of frame ids where 0
is not set.

Frames affect TCP window sliding. The frames keep a "left edge" which
signifies how much data to keep for frames that are still in progress.
4 years ago