123 Commits
Author SHA1 Message Date
Juliana Fajardini d4aa40df61 detect: allow banning kw from td in firewall mode
In case a keyword should work in firewall mode, with firewall rules
only. The engine errors out if threat detection rules use the given keyword.

Part of
Ticket #9041
2026-10-08 13:08:26 +00:00
Philippe Antoine 6f57427977 doc: keywords can register a callback for further info
Ticket: 8675

Will be used by enum uint keywords to print the list of possible
enum values
2026-10-08 13:08:20 +00:00
Victor Julien 0e297d26ff detect: honor the P+1 eof rule for generic hook list engines
DetectEngineInspectGenericList returned NO_MATCH for every keyword miss,
also when the tx had moved past the phase the engine is registered at.
Unlike the buffer engines it never produced a terminal no match, so a
firewall LTE rule using such a keyword (tls.version on a hook) stayed
provisional and was accepted for the rest of the session.

Make a miss terminal at P + 1. This engine also backs the lua
on-request/on-response hooks and the tls_cert_*, dnp3/dnp3_ind and
ftpdata/ftp mode keywords, so a plain IDS rule using them keeps its
verdict once the tx has moved past the registered phase.

Export the parser's end state computation as AppLayerParserGetTxEndState()
here, so the version keyword can use it; the remaining call sites are
converted later.

Ticket: #8944.
2026-10-03 14:09:36 +00:00
Jason Ish f3332694e3 rust/ffi: bindgen flow storage
Ticket: #8447
2026-08-19 17:23:02 +00:00
Jason Ish bedd65f766 flow: add accessors for flow addresses
Expose source and destination addresses as raw byte pointers, so FFI
callers do not need the internal FlowAddress layout.
2026-08-19 17:23:02 +00:00
Jason Ish c0de5bca46 flow: add accessor functions
Add accessor functions to allow NDPI and our plugin examples to access
flow fields in an opaque manner.

Provides accessors for:

- is ipv4
- is ipv6
- ip protocol
- to server packet count
- to destination packet count

Ticket: #8632
2026-08-19 17:23:02 +00:00
Lukas Sismis 3adbd677e8 app-layer: query raw protocol names
To avoid back-and-forth of http1 conversion
a second query function was added to support
existing use cases.

This change will be handy for the upcoming
default-policy for firewall settings
2026-08-18 08:06:22 +00:00
Victor Julien 95365ce05b detect: support per tx sub states
Support for per transaction sub states: different state machines per
transaction type.

Skip engines not belonging to our substate.

Store tx_type in DetectTransaction.

Each protocol supporting sub states will register states from 1 and up.

To support:

Ticket: #8386.
2026-07-09 17:19:29 +00:00
Victor Julien b6bc025789 app-layer: start of substate API support
Allow registration of per substate progress name mappings.

Implement logic for getting sub-state names, id's.

Add transaction type and end of progress values to AppLayerTxData.

Introduce helpers to keep logic clean.
2026-07-09 17:19:29 +00:00
Philippe Antoine 752dae89ea detect: add progress argument to SCDetectRegisterMpmGeneric
Will be needed by snmp
2026-07-09 05:25:08 +00:00
Philippe Antoine 7d024a840c rust: bindgen detect ThreadCtx keyword functions 2026-07-09 05:25:08 +00:00
Philippe Antoine 89dbce1b46 detect: convert tx_progress to uint8_t 2026-06-24 20:14:22 +00:00
Philippe Antoine a9e1dff4a6 conf: introduce SCConfGetNonNull
Ticket: 8651

Behaves like SCConfGet but returns 0 on null value
2026-06-12 21:04:12 +00:00
Jason Ish 546209ff12 bindgen: fix include ordering
At some point, bindgen include ordering changed such that
AppLayerGetFileState was being bindgen'd as opaque, as the definition of
StreamBufferingConfig was not available when bindgen hit
AppLayerGetFileState, and bindgen processes in order.

Move the util includes before the app-layer includes to fix the ordering
problem, but still keep util includes grouped.

The sys diff is large as many things have been re-ordered.
2026-06-05 12:38:58 +00:00
Giuseppe Longo 13df0f7a06 llmnr: implement parser
This adds a parser for LLMNR protocol over both UDP and TCP.

The parser reuses the existing DNS functions since LLMNR shares
the same wire format as DNS, but implements its own protocol-specific
validation:

- LLMNR-specific flag checks (C, TC, T bits)
- Opcode validation (only standard query opcode 0 is valid)
- An Event is set if Z-flag is set, since it's must be zero per RFC4795

LLMNR transactions inherit DNS behavior where each packet creates a new state
with one transaction.

Ticket #8366
2026-06-02 06:26:10 +00:00
Jason Ish 9f40968bba rust/ffi: bindgen thread storage
Ticket: #8445
2026-06-01 15:56:57 +00:00
Juliana Fajardini 372cb8c692 rust/sys: update bindgen SIGMATCH_ constants
Part of
Ticket #8551
2026-05-29 15:18:49 +00:00
Jason Ish c689af0bbb rust/ffi: bindgen thread lifecycle callbacks
Ticket: #8605
2026-05-28 20:49:56 +00:00
Philippe Antoine 4c42998feb detect/engine: helper to know if a transform happens in-place 2026-05-18 07:41:33 +02:00
Jason Ish d4dc8be3b2 rust: bindgen flow lifecycle callbacks
Ticket: #8446
2026-05-09 04:17:38 +00:00
Philippe Antoine 3d56472d16 detect: bindgen more functions
To prepare to move dcerpc.stub_data keyword to full rust
2026-04-28 12:18:44 +00:00
Philippe Antoine a36af353bc rust: bindgen SCFlowGetAppProtocol 2026-04-21 07:20:31 +00:00
Philippe Antoine 8f824458c2 detect: helper for buffer register requires progress
Ticket: 8395

For protocols where tx are complete at start, that is
the `tx_get_progress` function returns 1 inconditionnally,
we can use the progress 1, not losing time on detection in ips
mode, and getting ready for firewall mode

For the other protocols (where a tx needs both a request and response
for instance), keep progress 0 as was the case before
2026-04-16 05:58:16 +00:00
Philippe Antoine d14af54b3b detect/transforms: constify some callbacks arguments
Ticket: 8298
2026-04-08 20:44:47 +00:00
Philippe Antoine 4f4912c042 rust: bindgen SIGMATCH_ constants 2026-04-01 19:55:48 +00:00
Jason Ish f6b11ac855 output-eve: finish exposing to bindgen
As all out output-eve.h is now exposed, merge output-eve.h and
output-eve-bindgen.h back into one file, output-eve.h.
2026-02-13 13:34:27 +00:00
Jason Ish f79158ae55 rust/sys: generate jsonbuilder bindings in sys
Bindgen the Rust bindings to the C JsonBuilder API along with the rest
of the Rust bindings to C. Breaking it out was probably the wrong
idea.

This should make it easier, and more correct to bindgen C functions
that use SCJsonBuilder types.
2026-02-13 13:34:27 +00:00
Jason Ish 2d0bf9a2ed output-eve: bindgen SCEveFileType callback types 2026-02-13 13:34:26 +00:00
Jason Ish e9611a4d7c output-eve: bindgen SCRegisterEveFileType to Rust
Used by Rust output plugins.
2026-02-13 13:34:26 +00:00
Jason Ish 1b182025bc output-eve: expose SCEveFileType to Rust with bindgen
There is an unfortunate side-affect that one has to read
output-eve-bindgen.h for the documentation on this type, however, I
think we can resolve that in time.
2026-02-13 13:34:26 +00:00
Philippe Antoine df495d7e22 rust: bindgen SCDetectGetLastSMFromLists
to use it from rust keywords
2026-02-13 13:34:25 +00:00
Victor Julien a2e9ac21f8 flow: turn flags field into uint64_t
Entire space is used.
2026-02-12 14:10:51 +00:00
Jason Ish c7f806a728 rust/sys: allow unknown lints
allow(unpredictable_function_pointer_comparisons) is needed on newer
versions of Rust, but is unknown to our MSRV, so for now, allow unknown
lints.
2026-02-09 05:41:18 +00:00
Philippe Antoine 364d2c077d rust: bindgen SCAppLayerRegisterParser
Ticket: 7662
2026-02-05 21:11:16 +00:00
Philippe Antoine 8857b78f6a rust: move AppLayerTxData definition to C
and bindgen it to rust

Will make easier the bindgen of RustParser structure which uses
a callback which uses AppLayerTxData

Move also the free function to C SCAppLayerTxDataCleanup
As suricata-sys crate defines AppLayerTxData for rust,
It must itself implement the Drop trait, and thus,
We need to define a feature surest
2026-02-05 21:11:16 +00:00
Philippe Antoine 8eaced3c1e rust: move AppLayerResult definition to C
and bindgen it to rust

Will make easier the bindgen of RustParser structure which uses
a callback which uses AppLayerResult

Keep From<> impl in sys crate that defines it
2026-02-05 21:11:16 +00:00
Philippe Antoine 06f78b2a22 rust: move StreamSlice definition to C
and bindgen it to rust

Will make easier the bindgen of RustParser structure which uses
a callback which uses StreamSlice
2026-02-05 21:11:16 +00:00
Philippe Antoine 41f543ca35 rust: move AppLayerGetTxIterTuple definition to C
and bindgen it to rust

Will make easier the bindgen of RustParser structure which uses
a callback which uses AppLayerGetTxIterTuple
2026-02-05 21:11:16 +00:00
Philippe Antoine 64d29fcd1c rust: move AppLayerStateData definition to C
and bindgen it to rust, and use default trait instead of new

Will make easier the bindgen of RustParser structure which uses
a callback which uses AppLayerStateData
2026-02-05 21:11:16 +00:00
Philippe Antoine 76efb8af4d rust: move AppLayerGetFileState definition to C
and bindgen it to rust.

Will make easier the bindgen of RustParser structure which uses
a callback which uses AppLayerGetFileState
2026-02-05 21:11:16 +00:00
Philippe Antoine fc23e54c6d rust: bindgen with derive eq
As will be needed such as AppLayerTxData
2026-02-05 21:11:16 +00:00
Philippe Antoine 7dbe033ae0 app-layer: function to register ci pattern + probe
Ticket: 6591
2026-02-02 15:49:25 +00:00
Philippe Antoine 2cf9a327d5 detect/ssh: move ssh.hassh to rust
Introduces helper SCDetectRegisterBufferLowerMd5Callbacks
2026-01-29 03:45:00 +00:00
Philippe Antoine 83360cfce0 detect/ssh: move ssh.hassh string to rust
bindgen needed SCSigMatchSilentErrorEnabled on the way
2026-01-29 03:45:00 +00:00
Philippe Antoine ea8ac2a02a detect/ssh: move ssh.software to rust
Adds helper function SCDetectHelperBufferProgressMpmRegister on the way
2026-01-16 21:07:39 +00:00
Philippe Antoine c0d6747e82 app-layer: GetTxIteratorFn uses a AppLayerGetTxIterState
Even if every current rust parser uses the u64 variant of the C union
2026-01-16 21:07:38 +00:00
Philippe Antoine 4b541b39f2 rust: move AppLayerEventType definition to C
and bindgen it to rust.

Will make easier the bindgen of RustParser structure which uses
a callback which uses AppLayerEventType
2026-01-16 21:07:38 +00:00
Lukas Sismis 3e4fdb2118 misc: time unit parsing function 2026-01-16 06:09:37 +00:00
Jason Ish d89b35db56 conf: add SCConfNodeChildValueIsFalse to check for false value
New function to check is a value is actually set to a false value.
2025-12-17 09:48:14 -06:00
Jeff Lucovsky 9c81f817e8 rust: bindgen update
Issue: 7389

Update bindgen with `make update-bindgen`
2025-12-15 22:18:55 +00:00