]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
4 months agothreads: refactor TmThreadsSlotPktAcqLoop for user threads
Jason Ish [Fri, 23 Aug 2024 18:49:20 +0000 (12:49 -0600)] 
threads: refactor TmThreadsSlotPktAcqLoop for user threads

Refactor TmThreadsSlotPktAcqLoop for user provided thread by breaking
out the init and finish code into their own functions.

For user provided threads, Suricata should not "drive" the thread, but
the setup and finish code is the same.

The finish function is exported so it can be called by the user
application when its receive loop or equivalent is done.

Also remove obsolete comment.

Ticket: #7240

4 months agolib: take pointer to LiveDevice, not name
Jason Ish [Mon, 3 Jun 2024 23:04:10 +0000 (17:04 -0600)] 
lib: take pointer to LiveDevice, not name

In the library capture example, show how the packet counter can be
updated.

Ticket: #7240

4 months agolib: remove global worker id variable
Jason Ish [Wed, 24 Apr 2024 22:47:11 +0000 (16:47 -0600)] 
lib: remove global worker id variable

Update ThreadVars creation in lib mode to have the worker_id provided
by the user.

Ticket: #7240

4 months agolib: rename threadvars creation function
Jason Ish [Wed, 24 Apr 2024 22:10:15 +0000 (16:10 -0600)] 
lib: rename threadvars creation function

Also use a proper return type (ThreadVars *).

Ticket: #7240

4 months agoexamples/lib: better command line handling
Jason Ish [Thu, 18 Apr 2024 22:53:47 +0000 (16:53 -0600)] 
examples/lib: better command line handling

Use the more conventional "--" command line handling to separate the
arguments. The first set will be passed to Suricata, and the args
after "--" will be handled by the example. Currently this is a single
PCAP filename, but will be extended to a list of PCAP filenames.

Also hard code logging to the current directory.

Ticket: #7240

4 months agothreads: don't attempt to join threads with an id of 0
Jason Ish [Thu, 18 Apr 2024 06:33:09 +0000 (00:33 -0600)] 
threads: don't attempt to join threads with an id of 0

Worker threads not created by Suricata, but instead a library user
should not be joined, as Suricata does not have access to their thread
handle, and it may in-fact be an unjoinable thread, such as the main
process.

When the thread ID is 0, assume the thread is "externally" managed,
but still mark is as dead to satisfy Suricata's view of the thread.

Ticket: #7240

4 months ago.gitignore: add more files
Jason Ish [Mon, 31 Mar 2025 18:34:04 +0000 (12:34 -0600)] 
.gitignore: add more files

- the generated binaries for lib examples
- LSP files
- man pages

4 months agoexamples: rename lib capture example to custom
Jason Ish [Wed, 10 Apr 2024 16:58:56 +0000 (10:58 -0600)] 
examples: rename lib capture example to custom

To keep the simple example simple, move the lib based capture method
example to its own example.

Ticket: #7240

4 months agolibsuricata: add library runmode
Angelo Mirabella [Wed, 3 Apr 2024 08:06:39 +0000 (01:06 -0700)] 
libsuricata: add library runmode

Add library source and runmode modules. Reorganized
library example to create a worker thread and replay a pcap
file using the library mode.
No API layer is added at this stage.

Edits by Jason Ish:
- fix guard
- add copyright/license headers

Ticket: #7240

4 months agodoc/exceptions: change stats counters names
Juliana Fajardini [Mon, 24 Mar 2025 20:49:53 +0000 (13:49 -0700)] 
doc/exceptions: change stats counters names

As we've changed them for more search-friendly ones.

Related to
Task #7185

4 months agoexceptions: move midstream stats to common counter
Juliana Fajardini [Mon, 24 Mar 2025 19:34:31 +0000 (12:34 -0700)] 
exceptions: move midstream stats to common counter

Part of making the exception policy stats counters more search
friendly.

Task #7185

4 months agoexceptions: move reassembly memcap stats to common counter
Juliana Fajardini [Mon, 24 Mar 2025 19:29:40 +0000 (12:29 -0700)] 
exceptions: move reassembly memcap stats to common counter

Part of making the exception policy stats counters more search
friendly.

Task #7185

4 months agoexceptions: move ssn memcap stats to common counter
Juliana Fajardini [Mon, 24 Mar 2025 19:24:14 +0000 (12:24 -0700)] 
exceptions: move ssn memcap stats to common counter

Part of making the exception policy stats counters more search
friendly.

Task #7185

4 months agoexceptions: move flow memcap stats to common counter
Juliana Fajardini [Mon, 24 Mar 2025 19:16:52 +0000 (12:16 -0700)] 
exceptions: move flow memcap stats to common counter

Part of making the exception policy stats counters more search
friendly.

Task #7185

4 months agoexceptions: move defrag stats to common counter
Juliana Fajardini [Mon, 24 Mar 2025 19:05:20 +0000 (12:05 -0700)] 
exceptions: move defrag stats to common counter

Part of making the exception policy stats counters more search
friendly.

Task #7185

4 months agoexceptions: move app_layer stats to common counter
Juliana Fajardini [Mon, 24 Mar 2025 19:03:33 +0000 (12:03 -0700)] 
exceptions: move app_layer stats to common counter

Part of making the exception policy stats counters more search
friendly.

Task #7185

4 months agooutput: Add linktype name
Jeff Lucovsky [Sat, 8 Jun 2024 14:37:14 +0000 (10:37 -0400)] 
output: Add linktype name

Issue: 6954

This commit adds the linktype name to the output stream. The name is
determined from the pcap utility function pcap_datalink_val_to_name

4 months agooutput/datalink: Use Rust-based linktype hashmap
Jeff Lucovsky [Sat, 19 Oct 2024 12:07:01 +0000 (08:07 -0400)] 
output/datalink: Use Rust-based linktype hashmap

Use the hasmap to gather linktype display names.

Issue: 6954

4 months agodecode/datalink: Add datalink value/name logic
Jeff Lucovsky [Sat, 19 Oct 2024 12:02:20 +0000 (08:02 -0400)] 
decode/datalink: Add datalink value/name logic

Issue: 6954

Add Rust based logic that maintains a hash map of link type values and
their associated output names.

4 months agogithub-ci: use git cli command for netmap instead of action 12888/head
Jason Ish [Mon, 31 Mar 2025 16:14:47 +0000 (10:14 -0600)] 
github-ci: use git cli command for netmap instead of action

This action hits API limits often, however our other uses of git clone
do not seem to, so try use git clone here instead of the github
action.

4 months agodetect: SC prefix for extern pub Rust functions
Jason Ish [Mon, 31 Mar 2025 15:59:16 +0000 (09:59 -0600)] 
detect: SC prefix for extern pub Rust functions

Ticket: #7498

4 months agosnmp: rust naming and visibility cleanups
Jason Ish [Mon, 31 Mar 2025 15:50:33 +0000 (09:50 -0600)] 
snmp: rust naming and visibility cleanups

Ticket: #7498

4 months agodpdk: adjust auto mempool calculation when no TX queues set
Lukas Sismis [Sat, 29 Mar 2025 12:36:51 +0000 (13:36 +0100)] 
dpdk: adjust auto mempool calculation when no TX queues set

4 months agodpdk: allow zero TX queues when running in IDS mode
Lukas Sismis [Sat, 29 Mar 2025 12:31:15 +0000 (13:31 +0100)] 
dpdk: allow zero TX queues when running in IDS mode

When running in non-forwarding (IDS) mode, it is not required
to create TX queues for the interface.
This can be acheived by setting tx-descriptors configuration
field to 0.

Ticket: 7633

4 months agodocs: double quote technical terms in DPDK section
Lukas Sismis [Sat, 29 Mar 2025 12:27:08 +0000 (13:27 +0100)] 
docs: double quote technical terms in DPDK section

4 months agodpdk: NULL freed variables
Lukas Sismis [Tue, 25 Mar 2025 11:31:48 +0000 (12:31 +0100)] 
dpdk: NULL freed variables

The DPDKDeviceResourcesDeinit function now accepts second-level
reference to NULL the provided variable after deinitialization..

4 months agodpdk: document vlan stripping offload
Lukas Sismis [Wed, 5 Feb 2025 09:45:17 +0000 (10:45 +0100)] 
dpdk: document vlan stripping offload

Ticket: 5838

4 months agodpdk: check for link up before full startup
Lukas Sismis [Tue, 4 Feb 2025 10:13:42 +0000 (11:13 +0100)] 
dpdk: check for link up before full startup

ICE card (Intel E810) was not receiving packets immediatelly
after startup, Suricata workers would act as processing while
it was not. This eliminates the problem by only continuing
in the initialization if the link is already up.

The setting can be turned off manually from the configuraiton
file.

Ticket: 7381

4 months agodpdk: use default iface-copy value if not specified
Lukas Sismis [Tue, 4 Feb 2025 09:17:46 +0000 (10:17 +0100)] 
dpdk: use default iface-copy value if not specified

Ticket: 7374

4 months agodpdk: replace global with per-thread mempools
Lukas Sismis [Thu, 20 Jul 2023 07:42:06 +0000 (09:42 +0200)] 
dpdk: replace global with per-thread mempools

It turned out that having global (interface-specific) mempool
that is shared by the threads of the interface is slower than
having individual mempools per queue for each interface.

The commit brings this change and should be user-invisible,
the config setting remains still as a number of objects of
all mempools summed (of that interface).

Ticket: 7382

4 months agodpdk: remove mempool pointer from the thread structure
Lukas Sismis [Mon, 27 Jan 2025 13:45:58 +0000 (14:45 +0100)] 
dpdk: remove mempool pointer from the thread structure

4 months agodpdk: auto configure Rx/Tx descriptors and mempool size
Lukas Sismis [Mon, 27 Jan 2025 13:26:23 +0000 (14:26 +0100)] 
dpdk: auto configure Rx/Tx descriptors and mempool size

Ticket: 7380
Ticket: 7373

4 months agodetect: allow rule which need both directions to match 12875/head
Philippe Antoine [Thu, 18 Jan 2024 13:15:14 +0000 (14:15 +0100)] 
detect: allow rule which need both directions to match

Ticket: 5665

This is done with `alert ip any any => any any`
The => operator means that we will need both directions

4 months agondpi: ignore packets that have a different proto than the flow
Jason Ish [Thu, 27 Mar 2025 21:32:40 +0000 (15:32 -0600)] 
ndpi: ignore packets that have a different proto than the flow

This can happen when the flow is UDP, but an ICMP unreachable is
returned, which gets assigned to the same flow.

Reference: https://github.com/ntop/nDPI/issues/2762

4 months agodoc/ndpi: move ndpi docs to new plugins section
Jason Ish [Fri, 24 Jan 2025 16:51:45 +0000 (10:51 -0600)] 
doc/ndpi: move ndpi docs to new plugins section

Moves the nDPI documentation to an nDPI page in the plugins
section. Remove the duplication of installation and setup
documentation.

Includes some minor cleanups.

4 months agondpi: fix memory in keyword setup
Jason Ish [Fri, 24 Jan 2025 17:18:54 +0000 (11:18 -0600)] 
ndpi: fix memory in keyword setup

- remove duplicate calls to ndpi_init_detection_module
- cleanup ndpi_init_detection_module when no longer needed

4 months agodetect: split new keyword id from registration
Jason Ish [Fri, 17 Jan 2025 20:46:07 +0000 (14:46 -0600)] 
detect: split new keyword id from registration

Split DetectHelperKeywordRegister into 2 functions, one for acquiring
a new keyword ID, and another to perform the registration.

This makes it easier to do the traditional C keyword initialization
with a dynamic ID.

4 months agoeve/schema: add top level ndpi object
Jason Ish [Wed, 15 Jan 2025 21:25:20 +0000 (15:25 -0600)] 
eve/schema: add top level ndpi object

The format is left free-form, as its controled by a plugin.

4 months agogithub-ci: add ndpi build to the centos-stream9 build
Jason Ish [Wed, 15 Jan 2025 18:04:02 +0000 (12:04 -0600)] 
github-ci: add ndpi build to the centos-stream9 build

- Download and build nDPI
- Enable nDPI during Suricata ./configure
- Test that the plugin was built and installed

4 months agondpi: initial implementation of nDPI plugin
Alfredo Cardigliano [Mon, 4 Nov 2024 09:25:31 +0000 (10:25 +0100)] 
ndpi: initial implementation of nDPI plugin

Ticket: #7231

4 months agodetect: add email.date keyword
Alice Akaki [Fri, 28 Mar 2025 20:06:01 +0000 (16:06 -0400)] 
detect: add email.date keyword

email.date matches on MIME EMAIL DATE
This keyword maps to the EVE field email.date
It is a sticky buffer
Supports prefiltering

Ticket: #7591

4 months agomime/email: log date and subject fields
Alice Akaki [Fri, 28 Mar 2025 20:06:26 +0000 (16:06 -0400)] 
mime/email: log date and subject fields

4 months agodetect: per tx detect flags to a u8 progress value 12862/head
Victor Julien [Mon, 24 Mar 2025 10:20:39 +0000 (11:20 +0100)] 
detect: per tx detect flags to a u8 progress value

Reduce per tx space for tracking detection/prefilter progress. Instead
of a per direction u64 of flags, where each bit reflected a progress
value, use a simple u8 to track the linear progression through the
progress values. Use an offset to allow 0 to mean no value.

Add flags field as well to track "skip detect" and "inspect complete".

4 months agoapp-layer: add helper for AppLayerTxData cleanup
Victor Julien [Sat, 22 Mar 2025 09:18:43 +0000 (10:18 +0100)] 
app-layer: add helper for AppLayerTxData cleanup

4 months agodoc/tls: add more detail on tls.random
Victor Julien [Mon, 24 Mar 2025 12:25:25 +0000 (13:25 +0100)] 
doc/tls: add more detail on tls.random

4 months agodetect: reorder struct
Victor Julien [Thu, 27 Feb 2025 10:37:14 +0000 (11:37 +0100)] 
detect: reorder struct

4 months agolandlock: add read/write permission to MPM cache directory
Lukas Sismis [Wed, 26 Mar 2025 12:52:29 +0000 (19:52 +0700)] 
landlock: add read/write permission to MPM cache directory

4 months agohyperscan: add caching mechanism for hyperscan contexts
Lukas Sismis [Mon, 28 Oct 2024 14:46:17 +0000 (15:46 +0100)] 
hyperscan: add caching mechanism for hyperscan contexts

Cache Hyperscan serialized databases to disk to prevent compilation
of the same databases when Suricata is run again with the same
ruleset.
Hyperscan binary files are stored per rulegroup in the designated
folder, by default in the cached library folder.
Since caching is per signature group heads,
some chunk of the ruleset can change and it still can reuse part of
the unchanged signature groups.

Loading *fresh* ET Open ruleset:  19 seconds
Loading *cached* ET Open ruleset: 07 seconds

Ticket: 7170

4 months agoutil-mpm: prepare MPM codebase for ruleset caching
Lukas Sismis [Mon, 28 Oct 2024 14:44:09 +0000 (15:44 +0100)] 
util-mpm: prepare MPM codebase for ruleset caching

4 months agoutil-mpm-hs: refactor Hyperscan Pattern DB initialization to smaller functions
Lukas Sismis [Mon, 28 Oct 2024 14:41:07 +0000 (15:41 +0100)] 
util-mpm-hs: refactor Hyperscan Pattern DB initialization to smaller functions

4 months agodetect-engine: remove commented out code
Lukas Sismis [Wed, 24 Jul 2024 20:46:15 +0000 (22:46 +0200)] 
detect-engine: remove commented out code

4 months agoutil-path: remove dead code
Lukas Sismis [Wed, 24 Jul 2024 20:45:20 +0000 (22:45 +0200)] 
util-path: remove dead code

4 months agoutil-hash: add iterator for hash function
Lukas Sismis [Sat, 5 Oct 2024 18:27:19 +0000 (20:27 +0200)] 
util-hash: add iterator for hash function

4 months agohashlittle: add a safe variant of hashlittle2 function
Lukas Sismis [Thu, 25 Jul 2024 08:34:21 +0000 (10:34 +0200)] 
hashlittle: add a safe variant of hashlittle2 function

This variant of hashlittle2() ensures that it avoids
accesses beyond the last byte of the string, which will
cause warnings from tools like Valgrind or Address
Sanitizer.

4 months agodoc/http2: explicit behavior for some http keywords
Philippe Antoine [Wed, 26 Mar 2025 15:21:56 +0000 (16:21 +0100)] 
doc/http2: explicit behavior for some http keywords

HTTP/2 does not define a way to carry the version or reason phrase
that is included in an HTTP/1.1 status line.

Ticket: 6548

4 months agoci: test cargo fmt for some subdirs
Philippe Antoine [Fri, 7 Mar 2025 14:04:01 +0000 (15:04 +0100)] 
ci: test cargo fmt for some subdirs

The ones that respect it as new

4 months agoplugins: check version for all plugins
Philippe Antoine [Thu, 6 Mar 2025 13:15:27 +0000 (14:15 +0100)] 
plugins: check version for all plugins

4 months agoplugins: bind constant SC_PLUGIN_API_VERSION
Philippe Antoine [Wed, 19 Feb 2025 20:15:09 +0000 (21:15 +0100)] 
plugins: bind constant SC_PLUGIN_API_VERSION

4 months agoplugin: constify some fields
Philippe Antoine [Wed, 19 Feb 2025 20:09:16 +0000 (21:09 +0100)] 
plugin: constify some fields

including the tx parameter to the logger function

4 months agorust/detect: extend visibility of SIGMATH_NOOPT
Philippe Antoine [Thu, 23 Jan 2025 09:18:09 +0000 (10:18 +0100)] 
rust/detect: extend visibility of SIGMATH_NOOPT

so that it can be used by plugins

Avoid export by cbindgen as this constant is also defined in C

4 months agotemplate: rustfmt
Philippe Antoine [Tue, 21 Jan 2025 13:56:08 +0000 (14:56 +0100)] 
template: rustfmt

and use generic logger callback prototype with later cast

and do some other small modifications so that the plugin
has less diff

4 months agostream: make counter fns static
Shivani Bhardwaj [Wed, 26 Mar 2025 07:07:45 +0000 (12:37 +0530)] 
stream: make counter fns static

4 months agoutil/stream: remove duplicate nested statement
Shivani Bhardwaj [Fri, 21 Mar 2025 13:49:16 +0000 (19:19 +0530)] 
util/stream: remove duplicate nested statement

4 months agostream: use max-region setting from suricata.yaml
Shivani Bhardwaj [Fri, 21 Mar 2025 10:36:58 +0000 (16:06 +0530)] 
stream: use max-region setting from suricata.yaml

1. Add key (commented) to suricata.yaml
2. Give the configured/default key preference, save a check

4 months agostream: replace explicit logic w pre-existing fn
Shivani Bhardwaj [Sat, 15 Mar 2025 09:43:23 +0000 (15:13 +0530)] 
stream: replace explicit logic w pre-existing fn

4 months agostream: combine statements w same outcome
Shivani Bhardwaj [Sat, 15 Mar 2025 09:42:34 +0000 (15:12 +0530)] 
stream: combine statements w same outcome

4 months agostream: fix minor typos
Shivani Bhardwaj [Sat, 15 Mar 2025 09:42:03 +0000 (15:12 +0530)] 
stream: fix minor typos

4 months agostream: use bool wherever possible
Shivani Bhardwaj [Sat, 15 Mar 2025 09:41:34 +0000 (15:11 +0530)] 
stream: use bool wherever possible

4 months agostream: add defensive checks and comments
Shivani Bhardwaj [Sat, 15 Mar 2025 09:40:39 +0000 (15:10 +0530)] 
stream: add defensive checks and comments

4 months agostream: remove unneeded else
Shivani Bhardwaj [Sat, 15 Mar 2025 09:38:51 +0000 (15:08 +0530)] 
stream: remove unneeded else

4 months agooutput/buffer: Change buffer-size default value
Jeff Lucovsky [Fri, 28 Feb 2025 16:02:29 +0000 (11:02 -0500)] 
output/buffer: Change buffer-size default value

The buffer-size value that controls file output buffering defaults to
8k. To be consistent with previous logic, the default is being changed
to 0 (e.g., needed if there are old config files that don't specifically
enable the new value).

4 months agodetect/ja: use multi-protocol support
Philippe Antoine [Mon, 25 Nov 2024 08:30:51 +0000 (09:30 +0100)] 
detect/ja: use multi-protocol support

instead of hardcoding list : removes usage of ALPROTO_QUIC and
ALPROTO_TLS in generic SigValidate

Ticket: 7304

4 months agodetect: clean support for multi-protocol keywords
Philippe Antoine [Fri, 4 Oct 2024 12:53:02 +0000 (14:53 +0200)] 
detect: clean support for multi-protocol keywords

such as ja4.

Why ?

We do not want to see hard-coded protocol constants such as
ALPROTO_QUIC directly used in generic code in detect-parse.c

How ?
From the keyword point of view, this commit adds the function
DetectSignatureSetMultiAppProto which is similar to
DetectSignatureSetAppProto but takes multiple alprotos.
It restricts the signature alprotos to a set of possible alprotos
and errors out if the interstion gets empty.

The data structure SignatureInitData gets extended with
a fixed-length array, as the use case is a sparse number of protocols

Ticket: 7304

4 months agoapp-layer: improve limits on number of probing parsers
Philippe Antoine [Mon, 11 Nov 2024 07:52:28 +0000 (08:52 +0100)] 
app-layer: improve limits on number of probing parsers

There was an implicit limit of 32 app-layer protocols
used by probing parsers through a mask, meaning that
Suricata should not support more than 32 app-layer protocols
in total.

This limit is relaxed to each flow not being able to
run more than 32 probing parsers, meaning that for each source
and destination port combination, the sum of registered
probing parsers should not exceed 32, even if there are more
than 32 in total.

Also sets probing parsers done sooner in the case the other
side of the connection was detected first.

Ticket: 7437

4 months agodoc/userguide: add lua flowlib docs 12854/head
Juliana Fajardini [Wed, 26 Mar 2025 23:08:12 +0000 (16:08 -0700)] 
doc/userguide: add lua flowlib docs

Task #7489

4 months agodoc: remove old lua flow methods
Juliana Fajardini [Thu, 27 Mar 2025 02:07:16 +0000 (19:07 -0700)] 
doc: remove old lua flow methods

Task #7489

4 months agolua: remove old lua flow calls
Juliana Fajardini [Wed, 26 Mar 2025 23:02:06 +0000 (16:02 -0700)] 
lua: remove old lua flow calls

Moving forward, the flowlib is to be used.

Task #7489

4 months agolua: add initial suricata.flow lib
Juliana Fajardini [Tue, 25 Mar 2025 21:53:19 +0000 (14:53 -0700)] 
lua: add initial suricata.flow lib

Methods:
`get` creates the flow object.
`id`  returns the flow id.
`has_alerts` returns a boolean indicating if the flow triggered alerts.
`app_layer_proto` returns various app-layer related fields as 5 strings:
  alproto, alproto_ts, alproto_tc, alproto_orig, alproto_expect.
`stats` returns cnts for bytes and packets to sever and to client, as 4
  numbers.
`tuple` -- returns various fields: srcip, dstip, proto, sp, dp.
`timestamps` returns time as 4 numbers: seconds and microseconds, for
  first and last packet of the flow.
`timestring_legacy` returns the first packet from the flow's timestring
  as a string (like fastlog).
`timestring_iso8601` returns the first packet from the flow's
  timestring as an iso8601 compat timestring (like eve).

Example:

```
name = "lua-scflowstats.log"

local flow = require("suricata.flow")

function init(args)
    local needs = {}
    needs["type"] = "flow"
    return needs
end

function setup(args)
    filename = SCLogPath() .. "/" .. name
    file = assert(io.open(filename, "a"))
    SCLogInfo("lua SCFlowStats Log Filename " .. filename)
end

function log(args)
    local f = flow.get()
    timestring = f:timestring_legacy()
    tscnt, tsbytes, tccnt, tcbytes = f:stats()

   file:write ("[**] " .. timestring .. "\nSCFlowStats is\nPacket count to server:  " .. tscnt .. "\nByte count to server: " .. tsbytes .. "\nPacket count to client: " .. tccnt .. "\nByte count to client: " .. tcbytes .. "\n[**]")
    file:flush()
end

function deinit(args)
    file:close(file)
end
```

Task #7489

4 months agolua: fix typos
Juliana Fajardini [Tue, 25 Mar 2025 21:49:52 +0000 (14:49 -0700)] 
lua: fix typos

4 months agolua/dnp3: convert done and complete to boolean 12847/head
Jason Ish [Thu, 27 Mar 2025 17:24:17 +0000 (11:24 -0600)] 
lua/dnp3: convert done and complete to boolean

These were integers, 1 of true, 0 for false. Convert to boolean as
that is how they are in eve, and Lua has boolean types.

Ticket: #7601

4 months agolua/dnp3: add is_request boolean
Jason Ish [Thu, 27 Mar 2025 17:10:21 +0000 (11:10 -0600)] 
lua/dnp3: add is_request boolean

A DNP3 message can be a request or response, but not both. This is how
the transaction is structured.

Instead of having 2 values, "has_request" and "has_response", just
provide one field, "is_request" as a boolean.

Ticket: #7601

4 months agolua: convert dnp3 to suricata.dnp3 lib
Jason Ish [Thu, 27 Mar 2025 16:46:49 +0000 (10:46 -0600)] 
lua: convert dnp3 to suricata.dnp3 lib

This is an initial 1:1 conversion which is rather simple, as DNP3 only
had one function which converted the whole transaction to a DNP3
table.

Ticket: #7601

4 months agolua: remove buffer type dns.rrname, not needed
Jason Ish [Wed, 26 Mar 2025 23:12:05 +0000 (17:12 -0600)] 
lua: remove buffer type dns.rrname, not needed

DNS is transaction based, Lua scripts need only express interest in
the request or the response.

4 months agolua: allow for real booleans in "needs" expression
Jason Ish [Wed, 26 Mar 2025 22:16:03 +0000 (16:16 -0600)] 
lua: allow for real booleans in "needs" expression

In addition to

    function init (args)
        local needs = {}
        needs["dnp3"] = tostring(true)
        return needs
    end

allow for

    function init (args)
        return {dnp3=true}
    end

with the idea that the former will be completely removed for 8.0.

This works with all existing SV tests and as a string value, any value
is considered "truthy".

4 months agoscript/dnp3_gen.py: use current clang style
Jason Ish [Wed, 26 Mar 2025 18:29:48 +0000 (12:29 -0600)] 
script/dnp3_gen.py: use current clang style

4 months agoscript/dnp3-gen.py: update for newer versions of Python
Jason Ish [Wed, 26 Mar 2025 18:25:58 +0000 (12:25 -0600)] 
script/dnp3-gen.py: update for newer versions of Python

More recent yaml loaders require the loader as an argument.

4 months agodetect: add email.cc keyword 12840/head
Alice Akaki [Sat, 22 Mar 2025 01:25:48 +0000 (21:25 -0400)] 
detect: add email.cc keyword

email.cc matches on MIME EMAIL Carbon Copy
This keyword maps to the EVE field email.cc[]
It is a sticky buffer
Supports prefiltering

Ticket: #7588

4 months agodetect-email.c: don't return NULL for empty buffer
Alice Akaki [Mon, 24 Mar 2025 21:08:31 +0000 (17:08 -0400)] 
detect-email.c: don't return NULL for empty buffer

Just return NULL if tx->mime_state is NULL or if SCDetectMimeEmailGetData return 0

Fixes:
09db7c7 ("detect: add mime email.subject keyword")
90aab0d ("detect: add email.from")

4 months agodoc: add keywords to the multi-buffer-matching list
Alice Akaki [Mon, 24 Mar 2025 21:29:28 +0000 (17:29 -0400)] 
doc: add keywords to the multi-buffer-matching list

4 months agorust: fixes for breaking change on deranged crate
Jason Ish [Tue, 25 Mar 2025 22:02:29 +0000 (16:02 -0600)] 
rust: fixes for breaking change on deranged crate

Deranged v0.4.1 (a dependency of the time crate) has implemented
PartialOrd for some integer types that conflict with the
implementation in the standard library creating an ambiguity as such
implementation are global. For more info see
https://github.com/jhpratt/deranged/issues/18.

To fix, use "::from" directly, instead of using .into() which is where
we run into amgibuity.

4 months agodoc/userguide: group af-packet upgrade notes together
Jason Ish [Tue, 25 Mar 2025 17:17:54 +0000 (11:17 -0600)] 
doc/userguide: group af-packet upgrade notes together

Also fix the rendering of the sip nest list.

4 months agodoc/userguide: upgrade note about defrag now off for inline use
Jason Ish [Tue, 25 Mar 2025 17:08:36 +0000 (11:08 -0600)] 
doc/userguide: upgrade note about defrag now off for inline use

Ticket: #7617

4 months agoaf-packet: don't default to defrag when inline
Jason Ish [Mon, 24 Mar 2025 01:39:26 +0000 (19:39 -0600)] 
af-packet: don't default to defrag when inline

Don't default to defrag true when inline. It can still be enabled by
setting defrag to true however it is not recommended.

Ticket: #7617

4 months agodoc/userguide: upgrade note about tpacket-v3 default for ids
Jason Ish [Sun, 23 Mar 2025 16:55:45 +0000 (10:55 -0600)] 
doc/userguide: upgrade note about tpacket-v3 default for ids

Ticket: #4798

4 months agoapplayer: fix alp_ctx indexing in tests
Binghui Niu [Tue, 25 Mar 2025 06:35:48 +0000 (14:35 +0800)] 
applayer: fix alp_ctx indexing in tests

Fix problem that some app-layer unittests regist failed.

4 months agodetect: add email.to keyword 12836/head
Alice Akaki [Wed, 26 Mar 2025 08:36:29 +0000 (04:36 -0400)] 
detect: add email.to keyword

email.to matches on MIME EMAIL TO
This keyword maps to the EVE field email.to[]
It is a sticky buffer
Supports prefiltering

Ticket: #7596

4 months agofuzz: set flow flags as in Suricata 12821/head
Philippe Antoine [Mon, 24 Mar 2025 15:11:44 +0000 (16:11 +0100)] 
fuzz: set flow flags as in Suricata

Fixes: d8ddef4c1485 ("detect: delay tx cleanup in some edge case")
4 months agodetect: add mime email.subject keyword 12815/head
Alice Akaki [Thu, 20 Mar 2025 21:32:58 +0000 (17:32 -0400)] 
detect: add mime email.subject keyword

email.subject matches on MIME EMAIL SUBJECT
This keyword maps to the EVE field email.subject
It is a sticky buffer
Supports prefiltering

Ticket: #7595

4 months agoaf-packet: use tpacket v3 by default for ids mode
Jason Ish [Wed, 19 Feb 2025 05:07:40 +0000 (23:07 -0600)] 
af-packet: use tpacket v3 by default for ids mode

If "tpacket-v3" is not present in the configuration file, and we are
in IDS mode, default to "tpacket-v3".

Required moving the check for tpacket-v3 after the copy-mode
configuration, so the warning about tpacket-v3 in active modes has
been moved as well.

Ticket: #4798

4 months agoaf-packet: remove use-mmap option
Jason Ish [Thu, 20 Mar 2025 22:35:49 +0000 (16:35 -0600)] 
af-packet: remove use-mmap option

This option is obsolete and was not used in 7.0 as tpacket-v1 support
was removed (see ticket #4796).