Commit Graph

28 Commits (f83ec543e37f8e10c46b9da40e962c9354c21df8)

Author SHA1 Message Date
Philippe Antoine f83ec543e3 http2: add settings from newer RFCs
Including the one for websocket over HTTP/2
1 year ago
Philippe Antoine b141eb9f11 rust: fix single_match
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/http2/parser.rs:882:17
    |
882 | /                 match ctx.value {
883 | |                     Some(_) => {
884 | |                         panic!("Unexpected value");
885 | |                     }
886 | |                     None => {}
887 | |                 }
    | |_________________^
2 years ago
Philippe Antoine 6350736882 http2: avoid quadratic complexity in headers
When adding an element to the dynamic headers table, the oldest
ones may get evicted. When multiple elements get evicted, they
should get evicted all at once with drain, instead of one by one
as there will be a massive move each time.

Ticket: #6103
2 years ago
Victor Julien ee7ed99b6f rust: spelling 2 years ago
Philippe Antoine 9adb59bcdb http2: faster when reducing dynamic headers size
avoid quadratic complexity from removing the first element
and copying all the contents a big number fo times.

Ticket: #5909
2 years ago
Jason Ish 7ba2dadc7f rust/clippy: fix lint: upper_case_acronyms 3 years ago
Jason Ish 3044565cf4 rust/clippy: fix lint: needless_range_loop 3 years ago
Philippe Antoine c6349d3cfc http2: support padded data frames
Ticket: #5691
3 years ago
Jason Ish f342d4aacd rust: fix clippy lints for clippy::len_zero 3 years ago
Jason Ish c4034dafa1 rust: fix clippy lints for clippy::derive_partial_eq_without_eq 3 years ago
Jason Ish 7d623f0854 rust: fix clippy lint for explicit_auto_deref
This adds unnecessary complexity to code.
3 years ago
Jeff Lucovsky 484c34bc60 detect/uint: Move uint logic into a separate module
This commit moves the uint logic into its own module.
3 years ago
Jeff Lucovsky 8bfe427a74 rust/detect: Create detect module for rule parsing
This commit creates a module named "detect" for rule parsing logic. As
part of this commit, detect.rs is moved from its toplevel position into
the new module. Thus, use crate::detect::detect to refer to items within
detect.rs (instead of create::detect).

Ticket: 5077
3 years ago
Philippe Antoine f29b43defd detect: rust generic functions for integers
Move it away from http2 to generic core crate.
And use it for DCERPC (and SMB)

And remove the C version.
Main change in API is the free function is not free itself, but
a rust wrapper around unbox.

Ticket: #4112
3 years ago
Philippe Antoine 4f90d4254e http2: makes some settings configurable
max-streams and max-table-size

Allows users to find balance between completeness of decoding
and increases resource consumption, which can DOS suricata.
4 years ago
Philippe Antoine df2cbd6517 http2: event for variable-length integer overflow
http2_parse_var_uint can overflow the variable-length
integer it is decoding. In this case, it now returns an error
of kind LengthValue.

The new function http2_parse_headers_blocks, which factorizes
the code loop for headers, push promise, and continuation, will
check for this specific error, and instead of erroring itself,
will return the list of so far parsed headers, plus another one
with HTTP2HeaderDecodeStatus::HTTP2HeaderDecodeIntegerOverflow

This status is then checked by process_headers to create an
app-layer event.
4 years ago
Philippe Antoine b86beb9b68 http2: check overflow before it happens
instead of checking afterwards if value got smaller
4 years ago
Pierre Chifflier c61cbd9b35 rust: simplify bits parser annotations 4 years ago
Pierre Chifflier f8647b0ffb rust/http2: convert parser to nom7 functions (HTTP2 core functions) 4 years ago
Victor Julien 20e8f90981 http2: set Debug on structs 4 years ago
Philippe Antoine 3de0123ffb http2: adds check about dynamic headers table size 4 years ago
Philippe Antoine a63ee5adbd http2: allow multiple size updates in one headers batch
cf RFC 7541 section 4.2
5 years ago
Philippe Antoine 64fcba228b http2: complete parsing of priority frames 5 years ago
Philippe Antoine c300a859a0 http2: keep track of dynamic headers table size
And evict entries accordingly to maximum size
5 years ago
Philippe Antoine 1a21eea0e9 http2: variable size integers decoded everywhere 5 years ago
Philippe Antoine 89573060d9 http2: use variable integer for headers lengths 5 years ago
Philippe Antoine e3b28bcf2a http2: returns error in case of index 0
As is documented in RFC 7541, section 6.1
The index value of 0 is not used.  It MUST be treated as a decoding
error if found in an indexed header field representation.
5 years ago
Philippe Antoine 1422b18a99 http2: initial support 5 years ago