]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 months agoquic: decrypt only initial packets 12631/head
Philippe Antoine [Wed, 19 Feb 2025 09:08:58 +0000 (10:08 +0100)] 
quic: decrypt only initial packets

Ticket: 7556

Avoids failed_decrypt events when the first packet seen is not
a Quic Initial packet

5 months agoquic: handle retry packets
Philippe Antoine [Wed, 19 Feb 2025 12:01:36 +0000 (13:01 +0100)] 
quic: handle retry packets

Ticket: 7556

5 months agoquic: handle fragmented hello over multiple packets
Philippe Antoine [Mon, 17 Feb 2025 10:13:20 +0000 (11:13 +0100)] 
quic: handle fragmented hello over multiple packets

Ticket: 7556

To do so, we need to add 2 buffers (one for each direction)
to the QuicState structure, so that on parsing the second packet
with hello/crypto fragment, we still have the data of the first
hello/crypto fragment.

Use a hardcoded limit so that these buffers cannot grow indefinitely
and set an event when reaching the limit

5 months agoquic: parse ack frame number 3
Philippe Antoine [Mon, 17 Feb 2025 14:04:59 +0000 (15:04 +0100)] 
quic: parse ack frame number 3

cf rfc9000 section 19.3. ACK Frames

Ticket: 7556

5 months agoquic: move all_consuming check to callee
Philippe Antoine [Mon, 17 Feb 2025 10:04:50 +0000 (11:04 +0100)] 
quic: move all_consuming check to callee

Will alow to have decode_frames accept one additional parameter
with past fragment data

5 months agoquic: rustfmt
Philippe Antoine [Mon, 17 Feb 2025 09:27:49 +0000 (10:27 +0100)] 
quic: rustfmt

5 months agohtp: macro hygiene
Philippe Antoine [Tue, 18 Feb 2025 20:23:19 +0000 (21:23 +0100)] 
htp: macro hygiene

make clang-tidy happy even if unneeded for the temporary workaround

5 months agohttp: aliases for htp log code
Philippe Antoine [Thu, 6 Feb 2025 15:09:10 +0000 (16:09 +0100)] 
http: aliases for htp log code

In preparation of libhtp rust

5 months agohttp: constify some variables
Philippe Antoine [Thu, 6 Feb 2025 13:51:28 +0000 (14:51 +0100)] 
http: constify some variables

In preparation of libhtp rust

5 months agohttp: aliases for opaque htp_conn_t
Philippe Antoine [Thu, 6 Feb 2025 13:31:40 +0000 (14:31 +0100)] 
http: aliases for opaque htp_conn_t

In preparation of libhtp rust

5 months agohttp: aliases for opaque htp_tx_data_t
Philippe Antoine [Thu, 6 Feb 2025 13:26:14 +0000 (14:26 +0100)] 
http: aliases for opaque htp_tx_data_t

In preparation of libhtp rust

5 months agobuild: use expanded localstatedir for #define 12625/head
Jason Ish [Tue, 18 Feb 2025 21:15:43 +0000 (15:15 -0600)] 
build: use expanded localstatedir for #define

Use the expanded form of localstatedir in autoconf.h instead of the
unexpanded one, the difference being:

    #define LOCAL_STATE_DIR "${prefix}/var"

and

    #define LOCAL_STATE_DIR "/usr/local/var"

assuming default ./configure arguments.

Fixes commit b6a610df2669336756c67f77eb857b190b77770a.

5 months agopgsql/parser: fix type complexity clippy warning
Juliana Fajardini [Tue, 18 Feb 2025 20:17:13 +0000 (17:17 -0300)] 
pgsql/parser: fix type complexity clippy warning

Cf https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

5 months agopgsql/logger: don't log empty transactions
Juliana Fajardini [Mon, 17 Feb 2025 19:50:38 +0000 (16:50 -0300)] 
pgsql/logger: don't log empty transactions

This may happen in some situations if the app-layer parser only sees
unknown messages and sets an event: there will be an empty transaction,
but nothing to log.

Related to
Task #5566

5 months agopgsql: add case for Unknown response message state
Juliana Fajardini [Mon, 17 Feb 2025 15:06:39 +0000 (12:06 -0300)] 
pgsql: add case for Unknown response message state

No state change, but since we added Unknown responses, we should handle
that case -- should we have a specific state for such cases?

Related to
Bug #5524
Task #5566

5 months agopgsql: add events
Juliana Fajardini [Mon, 17 Feb 2025 15:05:09 +0000 (12:05 -0300)] 
pgsql: add events

Events for:
- parsing error when parsing pgsql packet length
- parsing error for pgsql requests (post length parsing)
- parsing error for pgsql responses (post length parsing)
- too many transactions

Include `pgsql-events.rules` file, and PGSQL events SID range definition

Task #5566

5 months agopgsql/parser: add more debug statements
Juliana Fajardini [Fri, 14 Feb 2025 17:46:00 +0000 (14:46 -0300)] 
pgsql/parser: add more debug statements

5 months agopgsql: apply rustfmt changes
Juliana Fajardini [Fri, 14 Feb 2025 16:29:33 +0000 (13:29 -0300)] 
pgsql: apply rustfmt changes

5 months agopgsql: don't always return error for parsing errors
Juliana Fajardini [Thu, 15 Sep 2022 15:19:43 +0000 (12:19 -0300)] 
pgsql: don't always return error for parsing errors

This allows the app-proto to continue onto parsing next PDUs, if
possible.

Bug #5524

5 months agopgsql: don't fail if proto parses unknown message
Juliana Fajardini [Fri, 7 Feb 2025 21:40:08 +0000 (18:40 -0300)] 
pgsql: don't fail if proto parses unknown message

Even if unknown, if the message is properly parsed, allow the parser to
proceed.

Related to
Bug #5524

5 months agopgsql/parser: always use fn for parsing PDU length
Juliana Fajardini [Mon, 17 Feb 2025 22:13:50 +0000 (19:13 -0300)] 
pgsql/parser: always use fn for parsing PDU length

Some inner parsers were using it, some weren't. Better to standardize
this. Also take the time to avoid magic numbers for representing the
expected lengths for pgsql PDUs.
Also throwing PgsqlParseError and allowing for incomplete results.

Related to
Task #5566
Bug #5524

5 months agopgsql: add PgsqlParserError
Juliana Fajardini [Mon, 17 Feb 2025 22:24:22 +0000 (19:24 -0300)] 
pgsql: add PgsqlParserError

Building on top of work done by Jason Ish.

Related to
Bug #5524

5 months agopgsql/parser: simplify response parsing
Juliana Fajardini [Fri, 7 Feb 2025 20:57:50 +0000 (17:57 -0300)] 
pgsql/parser: simplify response parsing

The initial parsing for message type checking was more complex than
needed be.

Related to
Bug #5524

5 months agopgsql/parser: fix response message length
Juliana Fajardini [Fri, 7 Feb 2025 15:16:53 +0000 (12:16 -0300)] 
pgsql/parser: fix response message length

Some backend messages can be the shortest pgsql length possible,
4 bytes, but the parser expectd all messages to be longer than that.

Related to
Bug #5524

5 months agogen/typo: Improve grammar
Jeff Lucovsky [Mon, 17 Feb 2025 17:08:00 +0000 (12:08 -0500)] 
gen/typo: Improve grammar

5 months agogen/bool: Clarify bool checks
Jeff Lucovsky [Mon, 17 Feb 2025 14:11:03 +0000 (09:11 -0500)] 
gen/bool: Clarify bool checks

Remove comparisons with true or false with C bools.

5 months agodetect/flow: move keyword parsing code to rust
Philippe Antoine [Mon, 17 Feb 2025 11:49:59 +0000 (12:49 +0100)] 
detect/flow: move keyword parsing code to rust

for flow.pkts and flow.bytes keywords

Ticket: 7562

Avoid null deref when parsing flow.bytes:toserver;

5 months agodetect/krb5: avoid integer underflow with krb5.ticket_encryption
Philippe Antoine [Mon, 17 Feb 2025 08:08:54 +0000 (09:08 +0100)] 
detect/krb5: avoid integer underflow with krb5.ticket_encryption

Ticket: 7560

When passing INT32_MIN aka 0x80000000, we cannot compute -vali
as it does not fit into a i32

5 months agoanalysis: report rule state altered by other rule
Juliana Fajardini [Fri, 17 Jan 2025 20:43:34 +0000 (17:43 -0300)] 
analysis: report rule state altered by other rule

Flowbits can make a rule such as a packet rule be treated as a stateful
rule, without actually changing the rule type.

Add a flag to allow reporting such cases via engine analysis.

Task #7456

5 months agodetect/flowbits: only walk over array if needed
Juliana Fajardini [Fri, 17 Jan 2025 20:41:19 +0000 (17:41 -0300)] 
detect/flowbits: only walk over array if needed

For setting s->init_data for flowbit rules impacted by `set`, we can
first check whether this will be needed, and *then* walk over the
flowbits array.

5 months agorust: add bindings to SCPlugin.* to sys crate 12357/head 12590/head
Jason Ish [Fri, 24 Jan 2025 15:56:58 +0000 (09:56 -0600)] 
rust: add bindings to SCPlugin.* to sys crate

Also disable bindgen's generated layout tests.  They are valid for the
platform generating the tests, but may not be valid for other
platforms. For example, if the tests are generated on a 64 bit
platform the tests will not be valid when run on a 32 bit platform as
pointers are a different size.

However, the generating bindings are valid for both platform.

Ticket: #7341

5 months agorust: add auto-generated header to sys.rs
Jason Ish [Fri, 24 Jan 2025 15:05:03 +0000 (09:05 -0600)] 
rust: add auto-generated header to sys.rs

We don't keep bindgen's autogenerated do not edit line as it contains
the bindgen version which could break the CI check for out of date
bindings. So add our own do not edit line.

Ticket: #7341

5 months agogithub-ci: test that bindgen bindings are up to date
Jason Ish [Fri, 24 Jan 2025 14:59:39 +0000 (08:59 -0600)] 
github-ci: test that bindgen bindings are up to date

Regenerates the `sys.rs` and looks for any difference. Check will fail
if there is a difference.

Ticket: #7341

5 months agorust: use AppProto from generated bindings instead of duplicating
Jason Ish [Thu, 23 Jan 2025 22:40:22 +0000 (16:40 -0600)] 
rust: use AppProto from generated bindings instead of duplicating

Have bindgen generate bindings for app-layer-protos.h, then use the
generated definitions of AppProto/AppProtoEnum instead if defining
them ourselves.

This header was chosen as its used by Rust, and its a simple header
with no circular dependencies.

Ticket: #7341

5 months agorust: integrate bindgen to generate Rust bindings to C
Jason Ish [Thu, 23 Jan 2025 22:26:25 +0000 (16:26 -0600)] 
rust: integrate bindgen to generate Rust bindings to C

Bindgen works by processing a header file which includes all other
header files it should generate bindings for. For this I've created
bindgen.h which just includes app-layer-protos.h for now as an
example.

These bindings are then generated and saved in the "suricata-sys"
crate and become availale as "suricata_sys::sys".

Ticket: #7341

5 months agorust/sys: stub in suricata-sys crate for Rust bindings to C
Jason Ish [Thu, 23 Jan 2025 22:19:09 +0000 (16:19 -0600)] 
rust/sys: stub in suricata-sys crate for Rust bindings to C

Follow Rust convention of using a "sys" crate for bindings to C
functions. The bindings don't exist yet, but will be generated by
bindgen and put into this crate.

Ticket: #7341

5 months agoconfigure: check for existence of bindgen
Jason Ish [Thu, 23 Jan 2025 22:14:36 +0000 (16:14 -0600)] 
configure: check for existence of bindgen

Require a minimum version of 0.66.0.

Ticket: #7341

5 months agodetect/profile: convert rule grouping dump to json builder
Victor Julien [Sat, 15 Feb 2025 18:20:14 +0000 (19:20 +0100)] 
detect/profile: convert rule grouping dump to json builder

Ticket: #7558.

5 months agotls: more permissive empty data eof check
Victor Julien [Thu, 13 Feb 2025 13:30:39 +0000 (14:30 +0100)] 
tls: more permissive empty data eof check

If not all data is ACK'd during the FIN session shutdown, the last calls
to the parser can be with a non-NULL data pointer, but a input length of
0. This wasn't considered by the EOF check, which then lead to it being
seen as an error. No event was raised, but the tls error stats were
incremented.

Bug: #7554.

5 months agoconfigure: require minimum version of cbindgen to be 0.20.0 12584/head
Jason Ish [Thu, 13 Feb 2025 17:35:46 +0000 (11:35 -0600)] 
configure: require minimum version of cbindgen to be 0.20.0

0.10.0 doesn't work anymore. In some combinations 0.20.0 doesn't work
either, however it does work in our CI jobs.

5 months agodatasets: move initial file reading to rust
Shivani Bhardwaj [Thu, 9 Jan 2025 06:48:24 +0000 (12:18 +0530)] 
datasets: move initial file reading to rust

In a recent warning reported by scan-build, datasets were found to be
using a blocking call in a critical section.

datasets.c:187:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  187 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:292:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  292 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:368:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  368 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:442:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  442 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:512:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  512 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.

These calls are blocking in the multi tenant mode where several tenants
may be trying to load the same dataset in parallel.
In a single tenant mode, this operation is performed as a part of a
single thread before the engine startup.

In order to evade the warning and simplify the code, the initial file
reading is moved to Rust with this commit with a much simpler handling
of dataset and datarep.

Bug 7398

5 months agorust: add C callback for FatalErrorOnInit
Shivani Bhardwaj [Thu, 9 Jan 2025 06:47:13 +0000 (12:17 +0530)] 
rust: add C callback for FatalErrorOnInit

5 months agorust: add macro to return val if unwrap fails
Shivani Bhardwaj [Thu, 9 Jan 2025 06:46:09 +0000 (12:16 +0530)] 
rust: add macro to return val if unwrap fails

5 months agodatasets: remove unused fn definition
Shivani Bhardwaj [Fri, 29 Nov 2024 10:10:16 +0000 (15:40 +0530)] 
datasets: remove unused fn definition

5 months agodoc/userguide: upgrade notes for Lua 12581/head
Jason Ish [Tue, 11 Feb 2025 22:37:54 +0000 (16:37 -0600)] 
doc/userguide: upgrade notes for Lua

- Sandboxed Lua for rules
- Search path changes for Lua output scripts

5 months agooutput-lua: lua module search path configuration
Jason Ish [Tue, 11 Feb 2025 22:26:39 +0000 (16:26 -0600)] 
output-lua: lua module search path configuration

By default, use an empty search path. This gives us a predictable
default. If a user needs access to external modules, the search path
must be set in the configuration file.

Ticket: #7169

5 months agooutput-lua: remove unused includes
Jason Ish [Tue, 11 Feb 2025 21:52:29 +0000 (15:52 -0600)] 
output-lua: remove unused includes

5 months agooutput-lua: rename script directory variable
Jason Ish [Tue, 11 Feb 2025 21:51:25 +0000 (15:51 -0600)] 
output-lua: rename script directory variable

It had a rather generic name of "path", which in Lua usually means a
search path, which we'll be adding.

5 months agodoc/userguide: document Lua base64 library 12579/head
Jason Ish [Mon, 27 Jan 2025 22:56:29 +0000 (16:56 -0600)] 
doc/userguide: document Lua base64 library

Ticket: #7074

5 months agolua: add base64 lib
Jason Ish [Mon, 27 Jan 2025 21:57:13 +0000 (15:57 -0600)] 
lua: add base64 lib

Export our base64 decoding and encoding functions to Lua.

Ticket: #7074

5 months agobase64: expose no padding and padding optional variants
Jason Ish [Thu, 30 Jan 2025 16:49:37 +0000 (10:49 -0600)] 
base64: expose no padding and padding optional variants

A no padding option is provided as a mode, as its a variant suitable
for encoding and decoding.

A padding optional function is added that is indifferent to padding
when decoding. This can be useful when you're not sure if padding
exists, and don't really care.

5 months agobase64: prefix base64 C API with "SC"
Jason Ish [Thu, 30 Jan 2025 16:29:36 +0000 (10:29 -0600)] 
base64: prefix base64 C API with "SC"

5 months agolua: update lua to 5.4.7
Jason Ish [Fri, 24 Jan 2025 17:50:42 +0000 (11:50 -0600)] 
lua: update lua to 5.4.7

This version of out Lua crate also supports cross compiling.

5 months agodoc/userguide: add lua packetlib docs 12569/head
Victor Julien [Mon, 10 Feb 2025 15:57:55 +0000 (16:57 +0100)] 
doc/userguide: add lua packetlib docs

5 months agodetect/lua: register built-in libs also for open setup
Victor Julien [Wed, 22 Jan 2025 18:28:43 +0000 (19:28 +0100)] 
detect/lua: register built-in libs also for open setup

Register internal libs for the case where loading external modules is allowed.

5 months agodoc: remove old lua packet methods
Victor Julien [Tue, 11 Feb 2025 10:05:48 +0000 (11:05 +0100)] 
doc: remove old lua packet methods

5 months agolua: remove old lua payload/packet calls
Victor Julien [Tue, 21 Jan 2025 19:14:07 +0000 (20:14 +0100)] 
lua: remove old lua payload/packet calls

Moving forward the packetlib is to be used.

Ticket: #7488.

5 months agolua: add initial suricata.packet lib
Victor Julien [Tue, 21 Jan 2025 19:03:17 +0000 (20:03 +0100)] 
lua: add initial suricata.packet lib

Example:

```
local packet = require "suricata.packet"

function init (args)
    local needs = {}
    return needs
end

function match (args)
    p = packet.get()
    payload = p:payload()
    ts = p:timestring()

    for line in payload:gmatch("([^\r\n]*)[\r\n]+") do
        if line == "GET /index.html HTTP/1.0" then
            ipver, srcip, dstip, proto, sp, dp = p:tuple()
            SCLogNotice(string.format("%s %s->%s %d->%d (pcap_cnt:%d) match! %s", ts, srcip, dstip, sp, dp, p:pcap_cnt(), line));
            return 1
        end
    end

    return 0
end
```

Methods:
`get` creates the packet object.
`payload` returns the packet payload as a buffer
`packet` returns the whole packet (includes headers)
`pcap_cnt` returns the `pcap_cnt` (pcap file mode only)
`tuple` returns various fields: srcip, dstip, proto, sp, dp
`sp` returns source port
`dp` returns destination port
`timestamp` returns time as 2 numbers: seconds and microseconds
`timestring_legacy` returns a timestamp as a string (like fastlog)
`timestring_iso8601` returns a iso8601 compat timestring (like eve)

Ticket: #7488.

5 months agodetect/lua: minor code cleanup
Victor Julien [Sun, 19 Jan 2025 09:53:54 +0000 (10:53 +0100)] 
detect/lua: minor code cleanup

5 months agodetect/lua: remove unused tls flag
Victor Julien [Sun, 19 Jan 2025 09:53:30 +0000 (10:53 +0100)] 
detect/lua: remove unused tls flag

5 months agothreads: fix int as pointer warning for pthread_exit 12565/head
Victor Julien [Tue, 11 Feb 2025 18:32:40 +0000 (19:32 +0100)] 
threads: fix int as pointer warning for pthread_exit

 clang-tidy:
        warning: integer to pointer cast pessimizes optimization opportunities

Since the returned code of -1 was never read, just return NULL.

5 months agocommandline: fix undefined behavior in parsing list-keywords
Victor Julien [Tue, 11 Feb 2025 18:31:43 +0000 (19:31 +0100)] 
commandline: fix undefined behavior in parsing list-keywords

Flagged by clang-tidy.

5 months agoflow/queue: remove circular dependency
Victor Julien [Tue, 11 Feb 2025 18:18:41 +0000 (19:18 +0100)] 
flow/queue: remove circular dependency

flow-queue.h included flow.h, but was also included by it.

5 months agoincludes: explicitly check for and include mm_malloc.h
Victor Julien [Tue, 11 Feb 2025 18:17:27 +0000 (19:17 +0100)] 
includes: explicitly check for and include mm_malloc.h

Helps code analyzers.

5 months agobuild: pass LOCAL_STATE_DIR through autoconf.h
Victor Julien [Tue, 11 Feb 2025 12:50:32 +0000 (13:50 +0100)] 
build: pass LOCAL_STATE_DIR through autoconf.h

Helps tooling like cppcheck, clang-tidy.

5 months agodetect: remove unused arg from get detect tx
Victor Julien [Tue, 11 Feb 2025 11:58:50 +0000 (12:58 +0100)] 
detect: remove unused arg from get detect tx

5 months agodetect: don't cast void on void func
Victor Julien [Tue, 11 Feb 2025 11:57:03 +0000 (12:57 +0100)] 
detect: don't cast void on void func

5 months agodetect: remove unused args from detect flag storing
Victor Julien [Tue, 11 Feb 2025 11:56:21 +0000 (12:56 +0100)] 
detect: remove unused args from detect flag storing

5 months agodetect/mpm: fix chop flag passed on incorrectly
Victor Julien [Tue, 11 Feb 2025 11:42:37 +0000 (12:42 +0100)] 
detect/mpm: fix chop flag passed on incorrectly

5 months agoautoconf: don't pretent we can build w/o autoconf.h
Victor Julien [Tue, 11 Feb 2025 11:41:11 +0000 (12:41 +0100)] 
autoconf: don't pretent we can build w/o autoconf.h

Helps tooling like cppcheck and clang-tidy.

5 months agomacros: provide fallbacks for common macros
Victor Julien [Tue, 11 Feb 2025 11:40:27 +0000 (12:40 +0100)] 
macros: provide fallbacks for common macros

These are set by our build-system, but some tools like cppcheck don't use that.

5 months agoaf-packet: code cleaning
Eric Leblond [Sat, 11 Jan 2025 19:16:02 +0000 (20:16 +0100)] 
af-packet: code cleaning

clang-tidy did detect the -1 return value was not compatible with
TmEcode enum.

5 months agogithub-ci: update actions/cache 12562/head
Jason Ish [Tue, 11 Feb 2025 15:40:59 +0000 (09:40 -0600)] 
github-ci: update actions/cache

The version we have been using will be deprecated soon.

https://github.blog/changelog/2024-12-05-notice-of-upcoming-releases-and-breaking-changes-for-github-actions/#actions-cache-v1-v2-and-actions-toolkit-cache-package-closing-down

5 months agodoc/userguide: fix typo
AlirezaPourchali [Sat, 1 Feb 2025 13:26:11 +0000 (16:56 +0330)] 
doc/userguide: fix typo

Issue: #7540

fixed doc/userguide/performance/hyperscan.rst
fixed doc/userguide/performance/runmodes.rst

5 months agodetect/integers: add support for negated strings when enum is used
Alice Akaki [Tue, 21 Jan 2025 04:23:54 +0000 (00:23 -0400)] 
detect/integers: add support for negated strings when enum is used

function detect_parse_uint_enum can parse strings like !bind_request

Ticket: #7513

5 months agodcerpc: prevent integer underflow 12553/head
Philippe Antoine [Mon, 3 Feb 2025 15:20:20 +0000 (16:20 +0100)] 
dcerpc: prevent integer underflow

in case a fragment has a length lesser than DCERPC_HDR_LEN

Fixes: 9daf8528b72c ("dcerpc: tidy up code")
Ticket: 7548

5 months agodpdk/rss: add rte_flow rss support for mlx5
Adam Kiripolsky [Tue, 14 Jan 2025 11:58:47 +0000 (12:58 +0100)] 
dpdk/rss: add rte_flow rss support for mlx5

The configuration of this rule is the same as for ixgbe driver except
the hash function is not RTE_ETH_HASH_FUNCTION_DEFAULT but
RTE_ETH_HASH_FUNCTION_TOEPLITZ.

The syntax in dpdk-testpmd for this rule with attributes:
port index == 0
used rx queue indices == 0 1 2 3
<hash_key> == 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6
end queues 0 1 2 3 end key <hash_key> key_len 40 func toeplitz / end"

Ticket: 7337

5 months agodpdk/rss: add rte_flow rss support for ice
Adam Kiripolsky [Tue, 10 Dec 2024 15:27:23 +0000 (16:27 +0100)] 
dpdk/rss: add rte_flow rss support for ice

ice driver requires 2 rte_flow rules for matching and
redistributing incoming traffic with RSS.

The rules set up by iceDeviceSetRSSFlowIPv4() and
iceDeviceSetRSSFlowIPv6() are different only in the pattern
("pattern eth / ipv4 / end" or "pattern eth / ipv6 / end"
in dpdk-testpmd syntax) and in the hash type (ipv4 src dst / ipv6 src
dst). ice will match all ipv4 or ipv6 traffic independently of
following l4 protocol. The rules can not have queues configured,
implicitly they will use all queues available.
The hash function is set to RTE_ETH_HASH_FUNCTION_TOEPLITZ.
The hash key can not be set.

The syntax in dpdk-testpmd for rule to match all ipv4 traffic
with attributes:
port index == 0
is as follows:
"flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4
end queues end func toeplitz / end"
(queues need to be set to NULL)

Ticket: 7337

5 months agodpdk/rss: add rte_flow rss support for ixgbe
Adam Kiripolsky [Tue, 10 Dec 2024 15:26:49 +0000 (16:26 +0100)] 
dpdk/rss: add rte_flow rss support for ixgbe

ixgbe driver requires different configuration of RSS rte_flow
rule than i40e, with just one generic rule matching all traffic.

The generic rule configured by DeviceCreateRSSFlowGeneric() has pattern
equivalent to "pattern eth / end" in dpdk-testpmd syntax. The rule must
have rx queues configured. The rule hashes traffic to different queues
based on ipv4 and ipv6 hash types (ipv4 src dst / ipv6 src dst).
The hash key is 40 bytes long  symmetric hash key. ixgbe does not
support any other hash function than RTE_ETH_HASH_FUNCTION_DEFAULT.

The syntax in dpdk-testpmd for this rule with attributes:
port index == 0
used rx queue indices == 0 1 2 3
<hash_key> == 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6
end queues 0 1 2 3 end key <hash_key> key_len 40 func default / end"

Ticket: 7337

5 months agodpdk/rss: move and change rss rte_flow functions
Adam Kiripolsky [Thu, 12 Dec 2024 12:28:02 +0000 (13:28 +0100)] 
dpdk/rss: move and change rss rte_flow functions

Move and adjust the base of  RSS configuration from util-dpdk-i40e.c to
a new file that can be later utilized by other cards.

RSS configuration can be configured via rte_flow rules. This is useful
for possible future features such as specific header offload
(vxlan, nvgre) also implemented via rte_flow rules, as rte_flow
rules can be chained via groups and priorities.

i40e uses multiple different rte_flow rules to setup RSS. At first,
function DeviceSetRSSFlowQueues() is used to setup rx queues.
This rule matches all types of traffic, so the equivalent
to dpdk-testpmd pattern would be "pattern end"
This rule can not contain hash types (ipv4, ipv6 etc.) nor hash key.
The hash function used here is RTE_ETH_HASH_FUNCTION_DEFAULT.

The syntax in dpdk-testpmd for this rule with attributes:
port index == 0
used rx queue indices == 0 1 2 3
is as follows:
"flow create 0 ingress pattern end actions rss queues 0 1 2 3 end
func default / end"

The other rules configured by i40eDeviceSetRSSFlowIPv4() and
i40eDeviceSetRSSFlowIPv6() match specific type of traffic by l4 protocol
(none, TCP, UDP, SCTP). For example, pattern to match l3 ipv4 with l4
tcp traffic in dpdk-testpmd syntax would be equivalent of
"pattern eth / ipv4 / tcp / end".
These rules can not have rx queues configured, but have hash types
(l3 src and dst address). This means that the traffic distribution
is affected only by l3 addresses, independent of the l4 specifics.

Also these pattern matching rules have symmetric 6d5a
hash key configured. The length of the key is dependent on DPDK version.
The hash function (either RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ or
RTE_ETH_HASH_FUNCTION_TOEPLITZ, depending on DPKD version) used
in these rules hashes symmetricaly due to the symmetric hash key.

The syntax in dpdk-testpmd for rule to match ipv4-tcp traffic with
attributes:
port index == 0
<hash_key> == 52 bytes long 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types
ipv4-tcp l3-src-only l3-dst-only end queues end key <hash_key>
key_len 52 func toeplitz / end"
(queues need to be set to NULL)

Ticket: 7337

5 months agofuzz: init reverse before calling AppLayerProtoDetectGetProto
Philippe Antoine [Mon, 3 Feb 2025 12:47:37 +0000 (13:47 +0100)] 
fuzz: init reverse before calling AppLayerProtoDetectGetProto

Completes commit fec06f8ac3954c19081fcf4005543b845dbef245

The 2 callers in suricata itself already do that

5 months agoaf-packet: clean up IPS config check
Victor Julien [Wed, 22 Nov 2023 09:41:47 +0000 (10:41 +0100)] 
af-packet: clean up IPS config check

Don't emmit generic error statements on things that are not errors. Instead,
for cases where (part of) the config is missing, use the defaults and log
only a more detailed explanation at the 'config' level.

Minor code cleanups.

5 months agogithub-actions: bump actions/upload-artifact from 4.5.0 to 4.6.0 11996/head 12521/head
dependabot[bot] [Sat, 1 Feb 2025 19:44:44 +0000 (19:44 +0000)] 
github-actions: bump actions/upload-artifact from 4.5.0 to 4.6.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/6f51ac03b9356f520e9adb1b1b7802705f340c2b...65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
5 months agogithub-actions: bump github/codeql-action from 3.28.0 to 3.28.8
dependabot[bot] [Sat, 1 Feb 2025 19:44:41 +0000 (19:44 +0000)] 
github-actions: bump github/codeql-action from 3.28.0 to 3.28.8

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.0 to 3.28.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.0...v3.28.8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
6 months agogithub-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1 12518/head
dependabot[bot] [Sat, 1 Feb 2025 19:44:26 +0000 (19:44 +0000)] 
github-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/1e68e06f1dbfde0e4cefc87efeba9e4643565303...13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
6 months agooutput: Log ethernet type 12514/head
Jeff Lucovsky [Tue, 1 Oct 2024 13:19:25 +0000 (09:19 -0400)] 
output: Log ethernet type

Issue 7129

When configured with the existing "ethernet" switch, include the ether
type in the output.

This is most useful with anomaly records indicating unknown ethertypes.

6 months agodoc/decode-events: new: unknown event description
Jeff Lucovsky [Fri, 27 Sep 2024 14:33:49 +0000 (10:33 -0400)] 
doc/decode-events: new: unknown event description

Issue: 7129

Document the unknown ethertype event.

6 months agodoc/threshold: Threshold keyword clarifications
Jeff Lucovsky [Sun, 7 Jul 2024 13:24:33 +0000 (09:24 -0400)] 
doc/threshold: Threshold keyword clarifications

Issue: 7129

6 months agodecode/ethertype: Event on unknown ethertype
Jeff Lucovsky [Wed, 3 Jul 2024 12:30:44 +0000 (08:30 -0400)] 
decode/ethertype: Event on unknown ethertype

Issue: 7129

Create a decode/engine event if unknown ethertypes are observed.

6 months agohttp: remove obsolete comment
Philippe Antoine [Thu, 30 Jan 2025 13:56:11 +0000 (14:56 +0100)] 
http: remove obsolete comment

In preparation of libhtp rust

6 months agohttp: minor cleanups for unit tests
Philippe Antoine [Thu, 30 Jan 2025 13:44:53 +0000 (14:44 +0100)] 
http: minor cleanups for unit tests

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for log
Philippe Antoine [Thu, 30 Jan 2025 12:48:06 +0000 (13:48 +0100)] 
http: minor cleanups for log

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for lua
Philippe Antoine [Thu, 30 Jan 2025 12:42:19 +0000 (13:42 +0100)] 
http: minor cleanups for lua

In preparation of libhtp rust

Mainly adding some const

6 months agoprotodetect: simplify code since DCERPC UDP detection is improved
Ilya Bakhtin [Sun, 21 Jul 2024 18:01:51 +0000 (20:01 +0200)] 
protodetect: simplify code since DCERPC UDP detection is improved

Protocol detection code is simplified. Removed dependency on explicit
alproto constants from the common part of code that must not be aware of
the each specific protocol features.

Ticket - 7111

6 months agoprotodetect/dcerpc: improve DCERPC UDP probing parser
Ilya Bakhtin [Sun, 21 Jul 2024 17:15:00 +0000 (19:15 +0200)] 
protodetect/dcerpc: improve DCERPC UDP probing parser

Several additional checks are added to the probing parser to avoid false
detection of DNS as DCERPC

Ticket - 7111

6 months agodetect: remove unused SignatureInitData member
Victor Julien [Sat, 25 Jan 2025 09:12:32 +0000 (10:12 +0100)] 
detect: remove unused SignatureInitData member

6 months agodetect/prefilter: fix prefilter setup
Victor Julien [Sat, 25 Jan 2025 08:52:16 +0000 (09:52 +0100)] 
detect/prefilter: fix prefilter setup

If `prefilter` is used it should override automatic fast pattern
selection.

Fixes: d6b56929d3c6 ("detect: set mpm/prefilter during signature parsing")
Ticket: #7523.

6 months agofuzz: better init for signature parsing target 12507/head
Philippe Antoine [Thu, 30 Jan 2025 07:54:53 +0000 (08:54 +0100)] 
fuzz: better init for signature parsing target

Fixes https://issues.oss-fuzz.com/u/1/issues/391975646

6 months agodcerpc/tcp: add frames support
Shivani Bhardwaj [Fri, 28 Jul 2023 05:43:54 +0000 (11:13 +0530)] 
dcerpc/tcp: add frames support

Frames of the following types have been added for toserver direction:
1. Pdu: The entire Protocol Data Unit
2. Hdr: Header of the request
3. Data: PDU data

Feature 4904

6 months agoapplayer: remove complex unittest
Shivani Bhardwaj [Wed, 4 Dec 2024 10:44:39 +0000 (16:14 +0530)] 
applayer: remove complex unittest

as it is now covered by the suricata-verify test
dcerpc-request-http-response.