Commit Graph

12268 Commits (093ed6f9bc3b7365f3f598ad57851407feb541ec)
 

Author SHA1 Message Date
Jason Ish ac3a20b6e0 rust(lint): remove useless conversions and clones
These add complexity and may not be optimized out by the compiler.
4 years ago
Jason Ish 8bb6dab69d rust(lint): remove useless format calls
In these simple cases to_string() is recommended and likely
performs better as the formatter is not called.
4 years ago
Jason Ish 5bf5de3350 rust(lint): don't use unwrap_or for function calls
Calling a function in unwrap_or causes that function to always
be called even when not needed. Instead use unwrap_or_else with
a closure which will only be called when needed.
4 years ago
Jason Ish 602bb05e75 rust(lint): fix redundant closures
This lint checks for a closure where a function can be directly
supplied.  Runtime performance is unchanged, but this makes
less work for the compiler.
4 years ago
Jason Ish 69cf5c9eea rust(lint): remove needless borrows
These are needless borrows (references) as the item is already
a reference.
4 years ago
Jason Ish 363b5f99c3 rust: functions that reference raw pointers are unsafe
Based on the Rust clippy lint that recommends that any public
function that dereferences a raw pointer, mark all FFI functions
that reference raw pointers with build_slice and cast_pointer
as unsafe.

This commits starts by removing the unsafe wrapper inside
the build_slice and cast_pointer macros then marks all
functions that use these macros as unsafe.

Then fix all not_unsafe_ptr_arg_deref warnings from clippy.

Fixes clippy lint:
https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
4 years ago
Jason Ish 53413f2d7a rust: remove all usage of transmute
All cases of our transmute can be replaced with more idiomatic
solutions and do no require the power of transmute.

When returning an object to C for life-time management, use
Box::into_raw to convert the boxed object to pointer and use
Box::from_raw to convert back.

For cases where we're just returning a pointer to Rust managed
data, use a cast.
4 years ago
KevinWang cbd03c7ea4 output/redis: Fix possible segv 4 years ago
Philippe Antoine 7ca4b13568 qa: use time on fuzz targets being run on corpus 4 years ago
Juliana Fajardini ff976df704 stream-tcp-reassemble: fix typo, updt copyright yr 4 years ago
Juliana Fajardini 613f9b2f5a stream-tcp-reassemble: fix ConfGetBool unc'kd call 4 years ago
Juliana Fajardini 2e0d76e6e7 stream-tcp: fix typos, update copyright year 4 years ago
Juliana Fajardini 4839088359 stream-tcp: fix ConfGetBool unchecked call 4 years ago
Juliana Fajardini 7198355324 util-napatech: fix typos, update copyright year 4 years ago
Juliana Fajardini fbade25848 util-napatech: fix ConfGetBool unchecked call 4 years ago
Juliana Fajardini 09ea412614 util-debug: fix unchecked ConfGetBool call 4 years ago
Victor Julien 9d24a53c53 nfs: minor code cleanup 4 years ago
Victor Julien aa9d8658ef smb: minor formatting fixup 4 years ago
Victor Julien 094208823b smb: minor code cleanup 4 years ago
Shivani Bhardwaj 8fd47cb84c smtp: fix clang fmt 4 years ago
Shivani Bhardwaj 0a1747c1ba nfs: fix comment 4 years ago
Shivani Bhardwaj 58ac9b0f38 nfs: Add rust registration function
Get rid of the C glue code and move registration completely to Rust.
4 years ago
Shivani Bhardwaj 61fca4e9db nfs: add missing code from rust impl of fns 4 years ago
Shivani Bhardwaj de50ac631e nfs: Change fn sign as per rust registration requirement
Registering parsers in Rust requires signatures to be a certain way and
compatible with C. Change signatures of all the functions.
Probe fn has also been changed to return AppProto as required by the new
fn signature.
4 years ago
Shivani Bhardwaj e5c948df87 smb: Add rust registration function
Get rid of the C glue code and move registration completely to Rust.
4 years ago
Shivani Bhardwaj 27af4bb002 smb: add missing code from rust impl of fns 4 years ago
Shivani Bhardwaj 6420df84b7 smb: Change fn sign as per rust registration requirement
Registering parsers in Rust requires signatures to be a certain way and
compatible with C. Change signatures of all the functions.
4 years ago
Shivani Bhardwaj 4d6b6b5dfe smb: add constants 4 years ago
Shivani Bhardwaj d1ea00521b rust/core: Add flow flags 4 years ago
Jason Ish 222e55847c flow: provide flags accessor function
Add an accessor function for flow flags. To be used by Rust where
the flow struct is an opaque data type.
4 years ago
Shivani Bhardwaj cb8bd8c669 rust/applayer: add more externs 4 years ago
Victor Julien 843c4b20da stream: check if ACK packet is outdated
Outdated packets are ACK packets w/o data that have an ACK value
lower than our last_ack and also don't have an SACK records that
are new.

This can happen when some packets come in later than others (possibly
due to different paths taken).
4 years ago
Victor Julien b7a79978ac stream/sack: clean up includes 4 years ago
Victor Julien 8eccd02c94 stream/sack: minor debug improvements 4 years ago
Victor Julien 35c2a02eb8 stream: minor debug additions 4 years ago
Shivani Bhardwaj 51be8f0238 doc/dcerpc: add proto keywords 4 years ago
Sascha Steinbiss 9aedc7fd1a mqtt: enable in config and remove misleading comment 4 years ago
Victor Julien b08a7b9a66 stream: update memcaps in code to match config 4 years ago
Philippe Antoine f77b027ada app-layer/pd: review bailout conditions
To take TCP window into account
And to actually bail out if we received too much data
where the limit is configured by stream.reassembly.depth
4 years ago
Victor Julien 7a114e506a app-layer/pd: only consider actual available data
For size limit checks consider only available data at the stream start
and before any GAPS.

The old check would consider too much data if there were temporary gaps,
like when a data packet was in-window but (far) ahead of the expected
segment.
4 years ago
Victor Julien be1baa8cab streaming/buffer: account sbb data size
When tracking data track the size of the blocks so that in case
of gaps we can still know how much data we hold.
4 years ago
Juliana Fajardini b8499de498 detect/iprep: convert to FAIL/PASS API 4 years ago
Philippe Antoine 31dccd1171 modbus: do not claim to handle gaps 4 years ago
showipintbri a39025bf24 doc: Grammar Correction 4 years ago
Shivani Bhardwaj a17da8374a counters: only print alerts if stats are enabled 4 years ago
Juliana Fajardini b24fb5781b detect: fix typos and update copyright year 4 years ago
Juliana Fajardini a15fada727 detect: fix bug where rule without sid is accepted
Before, if Suricata parsed a rule without a 'sid' option, instead of
failing that rule, the rule was parsed and attributed a sid 0.
Changes to:
detect-parse:
- add logic to filter out rules without sid;
- change unittest which didn't have a sid, but used to pass.
detect-sid: add unittest for rules without sid or with sid: 0
4 years ago
Philippe Antoine 0eefd90a93 fuzz: only build fuzz_sigpcap_aware if asked
With the other fuzz targets, and do not build it if fuzzpcap
is available but we did not want to build the fuzz targets
4 years ago
Sascha Steinbiss d541b3d4a8 rust: fix warnings with nightly 4 years ago
Eric Leblond 2c8c043185 stream/tcp: limit ACK validation
Only limit ACK value validation for packet where the ACK bit is
set.
4 years ago