Jason Ish
cf21694ba6
rust(lint): suppress clippy lints that we should fix
...
Suppress all remaining clippy lints that we trip. This can be
fixed on a per-lint basis.
4 years ago
Jason Ish
91402f9fba
rust(lint): remove manual implement of map method
...
Using `if let` expressions in these cases is better expressed
by the map method, and considered idiomatic Rust for this usage.
4 years ago
Jason Ish
b021726a0d
rust(lint): map the error instead of using or_else
...
This is the preffered style and easier to understand the meaning
of the code.
4 years ago
Jason Ish
dcf57ecd96
rust(lint): replace push_str of single char to push(<char>)
4 years ago
Jason Ish
d5c0962299
rust(lint): fix some usages of references
...
- ref is discouraged for top level variables
- the other borrow is not required
4 years ago
Jason Ish
d0772e04b1
rust(lint): replace checked_mul with saturating_mul
...
When defaulting checked_mul to u64::max, Rust has a method
that does the same thing called saturating_mul.
4 years ago
Jason Ish
d0be7541e9
rust(lint): removed unused unit () return
...
This is code that is not needed and is a bit confusing to see.
4 years ago
Jason Ish
4abbfd0d97
rust(lint): remove extra parens around bitwise or
...
This is a readability fix, as on first look they almost look
like a Rust tuple.
4 years ago
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
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
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
Philippe Antoine
31dccd1171
modbus: do not claim to handle gaps
4 years ago
Sascha Steinbiss
d541b3d4a8
rust: fix warnings with nightly
4 years ago
Philippe Antoine
9e7ea631b2
dns: improve probing parser
...
Checks opcode is valid
Checks additional_rr do not exceed message length
Better logic for incomplete cases
4 years ago
Philippe Antoine
6f03ee2e47
dcerpc: handles bigger inputs than 2^16
...
By comparing integers with the largest size
4 years ago
Philippe Antoine
7d0a39412b
detect: use u32 for InspectionBufferMultipleForList
...
So that we do not have an endless loop casting index to
u16 and having more than 65536 buffers in one transaction
Changes for all protocols, even ones where it is impossible
to have such a pattern, so as to avoid bad pattern copy/paste
in the future
4 years ago
Philippe Antoine
b3c1f2ab48
nfs: improve probing parser
...
Checks credentials flavor is known
4 years ago
Philippe Antoine
39575e2cc9
modbus: use ascii character classes while parsin rule
...
As the rust regex crate is unicode aware, which was
not the case of the C version
4 years ago
Philippe Antoine
ef5755338f
rust: SCLogDebug is real nop when built as release
...
Before, even if there were no outputs, all the arguments
were evaluated, which could turn expensive
All variables which are used only in certain build configurations
are now prefixed by underscore to avoid warnings
4 years ago
Victor Julien
20e8f90981
http2: set Debug on structs
4 years ago
Victor Julien
3587033d9e
files: construct with default, free on drop
...
Update protocols.
4 years ago
Victor Julien
d757545f03
files: implement default support
4 years ago
Philippe Antoine
fdab22d924
rust: fix app-layer parser flags
...
This especially allows for SSH bypass to work
4 years ago
Jeff Lucovsky
aa8871a5be
rust/default: Enable Default usage
4 years ago
Jeff Lucovsky
6028ca7827
nfs: Rework constructs to use Self/Default
4 years ago
Jeff Lucovsky
aafb0a60b7
dhcp: Rework constructs to use Self/Default
4 years ago
Jeff Lucovsky
1ef0bd580b
dcerpc: Rework constructs to use Self/Default
4 years ago
Jeff Lucovsky
00167121dc
dns: Rework constructs to use Self/Default
4 years ago
Jeff Lucovsky
02dccb1529
smb: Rework constructs to use Self/Default
...
This commit modifies the constructors to use Self and/or
Default::default() when feasible
4 years ago
Jeff Lucovsky
f502f21f9e
rust/default: Enable Default usage in SMB
4 years ago
Shivani Bhardwaj
581cb6223d
dcerpc/udp: Add rust registration function
...
Get rid of the C glue code and move registration completely to Rust.
4 years ago
Shivani Bhardwaj
d7007424bd
dcerpc/udp: 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