]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
3 years agoci: do not use ppa for cocci 6802/head
Philippe Antoine [Mon, 17 Jan 2022 14:14:54 +0000 (15:14 +0100)] 
ci: do not use ppa for cocci

As this version segfaults

3 years agorust/http2: convert parser to nom7 functions (HTTP2 ranges)
Pierre Chifflier [Wed, 12 Jan 2022 15:41:15 +0000 (16:41 +0100)] 
rust/http2: convert parser to nom7 functions (HTTP2 ranges)

3 years agorust/http2: convert parser to nom7 functions (HTTP2 core functions)
Pierre Chifflier [Wed, 12 Jan 2022 15:17:40 +0000 (16:17 +0100)] 
rust/http2: convert parser to nom7 functions (HTTP2 core functions)

3 years agodpdk: fix received/error counters
Lukas Sismis [Wed, 15 Dec 2021 13:24:55 +0000 (14:24 +0100)] 
dpdk: fix received/error counters

3 years agotests/pppoe: clean up more tests to use PASS/FAIL macros
Victor Julien [Mon, 17 Jan 2022 12:02:51 +0000 (13:02 +0100)] 
tests/pppoe: clean up more tests to use PASS/FAIL macros

3 years agopppoe: fix protocol field length variation
Steven Ottenhoff [Thu, 13 Jan 2022 13:05:58 +0000 (13:05 +0000)] 
pppoe: fix protocol field length variation

Detect when protocol field is not a 16 bit field.
Added tests to prove logic

Ticket: 4810

3 years agotest/pppoe: refactor to use FAIL/PASS macros
Steven Ottenhoff [Thu, 13 Jan 2022 12:38:01 +0000 (12:38 +0000)] 
test/pppoe: refactor to use FAIL/PASS macros

3 years agodetect-file-data: remove SMTP unittests
Modupe Falodun [Fri, 14 Jan 2022 15:53:28 +0000 (16:53 +0100)] 
detect-file-data: remove SMTP unittests

These tests are reimplemented as Suricata-verify tests

Task: 4938

3 years agooutput/alert: don't call basic logging twice
Eric Leblond [Mon, 17 Jan 2022 08:31:06 +0000 (09:31 +0100)] 
output/alert: don't call basic logging twice

Issue: 4106

3 years agostream: suppress noisy debug message
Victor Julien [Fri, 14 Jan 2022 10:48:16 +0000 (11:48 +0100)] 
stream: suppress noisy debug message

3 years agostream: fix stream pruning being too aggressive 6781/head
Victor Julien [Thu, 13 Jan 2022 11:13:43 +0000 (12:13 +0100)] 
stream: fix stream pruning being too aggressive

Pruning of StreamBufferBlocks could remove blocks that fell entirely
after the target offset due to a logic error. This could lead to data
being evicted that was still meant to be processed in theapp-layer
parsers.

Bug: #4953.

3 years agostream: debug code for showing segment list state
Victor Julien [Thu, 13 Jan 2022 11:12:56 +0000 (12:12 +0100)] 
stream: debug code for showing segment list state

3 years agodetect: Avoid recomputing ntohl() in addr match 6779/head
Jeff Lucovsky [Sun, 26 Dec 2021 15:22:34 +0000 (10:22 -0500)] 
detect: Avoid recomputing ntohl() in addr match

This commit makes a small optimization when comparing IPv4 and IPv6
addresses by making the host order value invariant and calculating the
value once, before entering the loop.

3 years agofile: define own variable instead of PATH_MAX
Philippe Antoine [Wed, 8 Dec 2021 20:14:54 +0000 (21:14 +0100)] 
file: define own variable instead of PATH_MAX

to be used for maximum size of file names,
and not depend on the OS

3 years agossl: fix int warnings
Philippe Antoine [Mon, 6 Dec 2021 08:44:12 +0000 (09:44 +0100)] 
ssl: fix int warnings

especially increasing padding_len size

3 years agosmtp: fix int warnings
Philippe Antoine [Mon, 6 Dec 2021 08:36:14 +0000 (09:36 +0100)] 
smtp: fix int warnings

and explicitly truncating filename's length

3 years agoapp: fix int warnings in generic app files
Philippe Antoine [Mon, 6 Dec 2021 08:26:54 +0000 (09:26 +0100)] 
app: fix int warnings in generic app files

3 years agohttp: : fix int warnings
Philippe Antoine [Mon, 6 Dec 2021 08:22:52 +0000 (09:22 +0100)] 
http: : fix int warnings

Explicitly truncate file names to UINT16_MAX

Before, they got implicitly truncated, meaning a UINT16_MAX + 1
file name, went to 0 file name (because of modulo 65536)

3 years agoftp: fix int warnings
Philippe Antoine [Mon, 6 Dec 2021 08:11:09 +0000 (09:11 +0100)] 
ftp: fix int warnings

Explicitly truncate a file name if it is longer
than UINT16_MAX

3 years agolog: Coverity REVERSE_INULL warnings
Jeff Lucovsky [Tue, 21 Sep 2021 13:52:11 +0000 (09:52 -0400)] 
log: Coverity REVERSE_INULL warnings

This commit addresses Coverity reported "REVERSE_INULL" warnings.

Issue: 4699

3 years agodoc: fix typo lenght/length
Philippe Antoine [Thu, 6 Jan 2022 13:07:21 +0000 (14:07 +0100)] 
doc: fix typo lenght/length

3 years agonfs4_records: add unittests for nom7 parsers
Sam Muhammed [Fri, 7 Jan 2022 17:27:06 +0000 (19:27 +0200)] 
nfs4_records: add unittests for nom7 parsers

Task #4866

3 years agonfs4_records: add missing field to res_sequence_ok()
Sam Muhammed [Mon, 10 Jan 2022 23:52:34 +0000 (01:52 +0200)] 
nfs4_records: add missing field to res_sequence_ok()

Missing _seqid in sequence op struct left a trailing four zeros
that are parsed by nfs4_res_compound_command() as a cmd
causing a Switch Error Code

3 years agonfs3-records: add unittests to nom7 parsers
Sam Muhammed [Sun, 2 Jan 2022 05:31:34 +0000 (07:31 +0200)] 
nfs3-records: add unittests to nom7 parsers

Task #4866

3 years agonfs3-records: add missing fields and update parsers
Sam Muhammed [Sun, 2 Jan 2022 04:57:39 +0000 (06:57 +0200)] 
nfs3-records: add missing fields and update parsers

Add missing fields to some record structures and
update their respective parsers

3 years agonfs2-records: add unittests for nom7 parsers
Sam Muhammed [Mon, 27 Dec 2021 12:19:27 +0000 (14:19 +0200)] 
nfs2-records: add unittests for nom7 parsers

Task #4866

3 years agosuricatasc: Handle incomplete/empty recv values
Jeff Lucovsky [Tue, 11 Jan 2022 19:16:24 +0000 (14:16 -0500)] 
suricatasc: Handle incomplete/empty recv values

Issue: 4947

Improve handling of values returned by recv. Sometimes, recv returns an
empty string if suricata terminates asynchronously.

3 years agonfs2: improve READ parsing 6764/head
Victor Julien [Tue, 11 Jan 2022 07:09:56 +0000 (08:09 +0100)] 
nfs2: improve READ parsing

Take fill_bytes into account.

3 years agorust/app-layer: expose AppLayerEvent derive macro
Jason Ish [Fri, 17 Dec 2021 22:33:48 +0000 (16:33 -0600)] 
rust/app-layer: expose AppLayerEvent derive macro

Export the AppLayerEvent derive macro so plugin (or library code) can
use it as expected, for example:

use suricata::applayer::AppLayerEvent;

enum MyEvent {
    EventOne,
    EventTwo,
}

3 years agorust/derive: make usable from a plugin or lib user
Jason Ish [Fri, 17 Dec 2021 22:32:05 +0000 (16:32 -0600)] 
rust/derive: make usable from a plugin or lib user

The macro was generating code that references names use the "crate"
prefix which will fail if the macro is used by a library user or plugin.
Dynamically check where we are running an use the correct import paths
as needed.

3 years agorust: rename to suricata (from suricata_rust)
Jason Ish [Fri, 17 Dec 2021 22:28:56 +0000 (16:28 -0600)] 
rust: rename to suricata (from suricata_rust)

Rename the Rust lib to simply "suricata" instead of "suricata_rust".
This allows Rust plugin/library code to use it under the name "suricata"
which is what should be expected.

The name was only "suricata_rust" to prevent on-disk conflict with the C
code, so just rename the file on disk, which doesn't affect how the code
is interacted with from an API layer.

3 years agorust: remove feature function-macro
Jason Ish [Fri, 17 Dec 2021 22:25:47 +0000 (16:25 -0600)] 
rust: remove feature function-macro

The function macro existed so it would only be enabled on Rust
versions that supported.  Now that our MSRV is 1.41, which is
greater than 1.38 we can assume we always have support for
this macro.

3 years agorust: bump MSRV to 1.41.1
Shivani Bhardwaj [Tue, 14 Dec 2021 15:44:30 +0000 (21:14 +0530)] 
rust: bump MSRV to 1.41.1

Ticket: #4902.
(cherry picked from commit 87f04475aaa75ee205b1b699e59fb2b5ba7ed59f)

3 years agorust/http2: use base64 crate for base64 decode
Jason Ish [Thu, 6 Jan 2022 17:28:40 +0000 (11:28 -0600)] 
rust/http2: use base64 crate for base64 decode

3 years agobase64: use the Rust base64 encode implementation
Jason Ish [Fri, 3 Sep 2021 21:04:58 +0000 (15:04 -0600)] 
base64: use the Rust base64 encode implementation

Replace our internal base64 implementation with a ffi wrapper
around the Rust implementation provided by an external crate.

3 years agoeve: use JsonBuilder for encoding base64
Jason Ish [Thu, 24 Jun 2021 16:21:52 +0000 (10:21 -0600)] 
eve: use JsonBuilder for encoding base64

Replaces all usages of Base64Encode just before writing to a
JsonBuilder with jb_set_base64 and jb_append_base64.

3 years agojsonbuilder: add methods to encode values as base64
Jason Ish [Thu, 24 Jun 2021 16:20:09 +0000 (10:20 -0600)] 
jsonbuilder: add methods to encode values as base64

Add new methods to set a value as a base64 encoded string of
a byte array. This uses the Rust base64 crate and encodes
directly into the JsonBuilder buffer with no intermediate
buffer required.

jb_set_base64: set a field on an object
jb_append_base64: append a value to an array

3 years agoapp-layer: use StreamSlice as input to parsers 6763/head
Victor Julien [Mon, 6 Dec 2021 07:31:25 +0000 (08:31 +0100)] 
app-layer: use StreamSlice as input to parsers

Remove input, input_len and flags in favor of stream slice.

3 years agoapp-layer: add StreamSlice to pass data to parsers
Victor Julien [Sun, 5 Dec 2021 10:16:06 +0000 (11:16 +0100)] 
app-layer: add StreamSlice to pass data to parsers

Since object to contain relevant pointer, length, offset, flags to make
it easy to pass these to the parsers.

3 years agodoc/yaml: Signal-termination option description 6744/head
Jeff Lucovsky [Thu, 17 Jun 2021 13:24:46 +0000 (09:24 -0400)] 
doc/yaml: Signal-termination option description

3 years agologging/diag: Enable stacktrace diagnostic if config'd
Jeff Lucovsky [Thu, 17 Jun 2021 13:07:29 +0000 (09:07 -0400)] 
logging/diag: Enable stacktrace diagnostic if config'd

This commit adds a signal handler for SIGSEGV when configured. The
signal handler emits a one line stack trace using SCLogError. The intent
is to provide diagnostic information in deployments where core files are
not possible.

The diagnostic message is from the offending thread and includes the
stack trace; each frame includes the symbol + offset.

3 years agologging: Stacktrace on signal term setting
Jeff Lucovsky [Thu, 17 Jun 2021 13:04:56 +0000 (09:04 -0400)] 
logging: Stacktrace on signal term setting

This commit adds a configuration setting to enable a stack trace message
if Suricata receives a signal that terminates execution, such as
SIGSEGV, SIGABRT.

3 years agoerror: Add error code for sig-related diagnostics
Jeff Lucovsky [Thu, 17 Jun 2021 12:54:30 +0000 (08:54 -0400)] 
error: Add error code for sig-related diagnostics

This commit adds an error code for the diagnostic code used for
diagnostic messages following unexpected termination due to signals..

3 years agoconfigure.ac: Support libunwind configuration
Jeff Lucovsky [Thu, 17 Jun 2021 12:52:17 +0000 (08:52 -0400)] 
configure.ac: Support libunwind configuration

This commit adds support for enabling libunwind -- a library that can be
used to display stack information.

Libunwind is enabled and used by Suricata if present during
configuration.  A diagnostic message is displayed if libunwind
cannot be found.

3 years agodoc: replace ohloh with openhub link
Juliana Fajardini [Wed, 29 Dec 2021 17:24:16 +0000 (17:24 +0000)] 
doc: replace ohloh with openhub link

3 years agouserguide: update references to Suricata website
Juliana Fajardini [Thu, 16 Dec 2021 12:07:44 +0000 (12:07 +0000)] 
userguide: update references to Suricata website

Many places were still referencing the old Suricata page.
Used git grep with replace to update them. Checked that new links work.
Left old references when they were only documentation examples (for
output or unittests).

Task#4915

3 years agouserguide: fix low-hanging typos Config page
Juliana Fajardini [Thu, 16 Dec 2021 12:07:16 +0000 (12:07 +0000)] 
userguide: fix low-hanging typos Config page

3 years agodetect: fix app-layer-protocol keyword for HTTP
Philippe Antoine [Wed, 22 Dec 2021 21:44:54 +0000 (22:44 +0100)] 
detect: fix app-layer-protocol keyword for HTTP

Ticket: 4920

Completes commit c8dbe24fb6202550bbca1fab452ddbe864b2c9e2
which introduced AppProtoEquals to have a generic
check for http in signature can mean http1 or http2 in
traffic.

This commit missed this case, as I only looked for
git grep "alproto ==" and here we deal with
alproto_tc and alproto_ts, but not alproto by itself.

3 years agodoc/eve-json-format/dns: Describing Z-bit
Odin Jenseg [Tue, 8 Jun 2021 19:56:41 +0000 (21:56 +0200)] 
doc/eve-json-format/dns: Describing Z-bit

3 years agodns: add dns flag to dns request logging
Jason Ish [Tue, 21 Dec 2021 22:49:21 +0000 (16:49 -0600)] 
dns: add dns flag to dns request logging

Ticket #4515

3 years agodns: Logging of Z-bit
Odin Jenseg [Tue, 8 Jun 2021 19:55:36 +0000 (21:55 +0200)] 
dns: Logging of Z-bit

[Edit by Jason Ish: fix flag bit value]

Ticket #4515

3 years agodns: create transaction even if z-bit was set
Jason Ish [Tue, 21 Dec 2021 22:34:05 +0000 (16:34 -0600)] 
dns: create transaction even if z-bit was set

It appears that DNS servers will still process a DNS request even if the
z-bit is set, our parser will fail the transaction. So create the
transaction, but still set the event.

Ticket #4924

3 years agodpdk: add DPDK test support in Github CI 6708/head
Lukas Sismis [Fri, 20 Aug 2021 19:27:51 +0000 (21:27 +0200)] 
dpdk: add DPDK test support in Github CI

Add DPDK dependency to the build process in distributions with
a native support of DPDK in their default package managers.

3 years agodpdk: add documentation for the DPDK runmode
Lukas Sismis [Mon, 24 May 2021 18:11:24 +0000 (20:11 +0200)] 
dpdk: add documentation for the DPDK runmode

Briefly present the DPDK runmode through configuration file.

3 years agodpdk/ice: setup RSS for Intel ICE PMD
Lukas Sismis [Mon, 29 Nov 2021 21:17:58 +0000 (22:17 +0100)] 
dpdk/ice: setup RSS for Intel ICE PMD

Set RSS hash function according to Intel ICE PMD available hash functions

Set hash functions according to the support by the ICE PMD, so that no warning
regarding RSS setting is issued.

3 years agodpdk/ixgbe: setup RSS for Intel IXGBE PMD
Lukas Sismis [Mon, 22 Nov 2021 15:43:29 +0000 (16:43 +0100)] 
dpdk/ixgbe: setup RSS for Intel IXGBE PMD

Set RSS hash function according to Intel IXGBE PMD available hash functions.

During configuration, a warning appeared stating that RSS hash function
has been changed from one value to the other. This has meant that
the supported hash functions did not cover all required hash functions
by the configuration. This commit solves the warning.

3 years agodpdk/i40e: support RSS on Intel i40e PMD driver
Lukas Sismis [Sun, 21 Nov 2021 22:22:24 +0000 (23:22 +0100)] 
dpdk/i40e: support RSS on Intel i40e PMD driver

Due to peculiar behavior of i40e PMD driver, the RSS is required to be set
via rte_flow rules or a hash filter as compared to other NICs where RSS is
configured through port configuration structure.
RTE_FLOW rules are created on 5-tuples (as opposed to 3-tuple configured
on the other NICs). Fragmented traffic have been tested with this setup
and it has been proven that fragmented packets of the same flow are
received on the same queue. At the same time, setting 3-tuple on rte_flow
rules have not yield in the expected results.

Notes from the experiments:

- Configuration of 5-tuple (as is in the commit):
    fragmented and nonfragmented packets are received by the same workers
    even when I applied seed to alter them via tcpreplay-edit (option --seed)

- Setting only ETH_RSS_FRAG_IPV4 and ETH_RSS_IPV4 (i.e. setting 3-tuple):
    when setting ETH_RSS_IPV4, the PMD driver says that pctype is not
    supported (generally this means that the "type" of traffic is not
    a valid configuration for the i40e)

- Setting only ETH_RSS_FRAG_IPV4 and ETH_RSS_NONFRAG_IPV4_OTHER:
    this doesn't work well, packets of the same flow are received on
    the different workers (my explanation is that the fragmented packets are
    matched with ETH_RSS_FRAG_IPV4 but the other UDP packets are not matched
    with ETH_RSS_NONFRAG_IPV4_OTHER rte_flow rule (they would be matched with
    ETH_RSS_NONFRAG_IPV4_UDP).

3 years agodpdk: add RSS flags that are set in the NIC
Victor Julien [Sun, 14 Nov 2021 18:47:24 +0000 (19:47 +0100)] 
dpdk: add RSS flags that are set in the NIC

3 years agodpdk: add specific error counters
Victor Julien [Sun, 14 Nov 2021 14:49:43 +0000 (15:49 +0100)] 
dpdk: add specific error counters

3 years agodpdk: initial support with workers runmode
Lukas Sismis [Sun, 21 Nov 2021 22:18:36 +0000 (23:18 +0100)] 
dpdk: initial support with workers runmode

Register a new runmode - DPDK. This enables a new flag on Suricata start
(--dpdk).

With the flag given, DPDK runmode is enabled.

Runmode loads the configuration and then initializes EAL.

If successful, it configures the physical NICs according to the configuration
file. After that, worker threads are initialized and then are in continuous
receive loop.

3 years agodpdk: edit configure.ac to include DPDK compilation option
Lukas Sismis [Sun, 29 Aug 2021 21:43:14 +0000 (23:43 +0200)] 
dpdk: edit configure.ac to include DPDK compilation option

Add a build flag --enable-dpdk to support DPDK parts in the source code.

3 years agonetmap: allow specifying a library directory 6707/head
Jeff Lucovsky [Sat, 11 Dec 2021 13:45:57 +0000 (08:45 -0500)] 
netmap: allow specifying a library directory

Ticket: #4482

3 years agodatasets: initialize after dropping privileges
Jason Ish [Thu, 9 Dec 2021 22:59:04 +0000 (16:59 -0600)] 
datasets: initialize after dropping privileges

Move initialization of datasets to a point after privileges
have been dropped.

Ticket 4239

3 years agorust/smb: convert parser to nom7 functions (SMB1) 6705/head
Pierre Chifflier [Sun, 14 Nov 2021 17:24:00 +0000 (18:24 +0100)] 
rust/smb: convert parser to nom7 functions (SMB1)

3 years agorust/smb: convert parser to nom7 functions (DCERPC records)
Pierre Chifflier [Sun, 14 Nov 2021 16:18:14 +0000 (17:18 +0100)] 
rust/smb: convert parser to nom7 functions (DCERPC records)

3 years agorust/smb: convert parser to nom7 functions (SMB2)
Pierre Chifflier [Fri, 12 Nov 2021 17:20:51 +0000 (18:20 +0100)] 
rust/smb: convert parser to nom7 functions (SMB2)

3 years agorust/smb: convert parser to nom7 functions (SMB3)
Pierre Chifflier [Fri, 12 Nov 2021 16:38:14 +0000 (17:38 +0100)] 
rust/smb: convert parser to nom7 functions (SMB3)

3 years agorust/smb: convert parser to nom7 functions (NTLM/SSP records)
Pierre Chifflier [Fri, 12 Nov 2021 16:28:45 +0000 (17:28 +0100)] 
rust/smb: convert parser to nom7 functions (NTLM/SSP records)

3 years agorust/smb: convert parser to nom7 functions (NBSS records)
Pierre Chifflier [Fri, 12 Nov 2021 13:32:09 +0000 (14:32 +0100)] 
rust/smb: convert parser to nom7 functions (NBSS records)

3 years agorust: add nom7 combinator take_until_and_consume
Pierre Chifflier [Fri, 12 Nov 2021 12:45:40 +0000 (13:45 +0100)] 
rust: add nom7 combinator take_until_and_consume

3 years agodoc: fix typo in "Stream engine" documentation
Lukas Sismis [Wed, 8 Dec 2021 18:26:07 +0000 (19:26 +0100)] 
doc: fix typo in "Stream engine" documentation

3 years agoftp: do not set alproto if one was already found
Philippe Antoine [Mon, 29 Nov 2021 09:59:10 +0000 (10:59 +0100)] 
ftp: do not set alproto if one was already found

Ticket: 4857

If a pattern such as GET is seen ine the beginning of the
file transferred over ftp-data, this flow will get recognized
as HTTP, and a HTTP state will be created during parsing.

Thus, we cannot override directly alproto's values

This solves the segfault, but not the logical bug that the flow
should be classified as FTP-DATA instead of HTTP

3 years agoapp-layer/htp: cleanup test
Victor Julien [Fri, 10 Dec 2021 07:00:23 +0000 (08:00 +0100)] 
app-layer/htp: cleanup test

3 years agohtp: rename callbacks to make purpose clearer
Victor Julien [Fri, 10 Dec 2021 13:05:35 +0000 (14:05 +0100)] 
htp: rename callbacks to make purpose clearer

3 years agostream: unify ack'd right edge handling
Victor Julien [Sat, 11 Dec 2021 07:12:31 +0000 (08:12 +0100)] 
stream: unify ack'd right edge handling

Use util function in all code needing the ack'd data.

3 years agodetect/engine: store buffer name in local array
Victor Julien [Fri, 3 Dec 2021 06:57:52 +0000 (07:57 +0100)] 
detect/engine: store buffer name in local array

Instead of storing a name and description as a pointer in DetectBufferType
store them in fixed size arrays. This is in preparation of runtime registration
of buffer types, where a constant name/desc is not available.

3 years agomingw: add bcrypt to LDADD for rust compilation 6681/head
Victor Julien [Tue, 7 Dec 2021 08:56:51 +0000 (09:56 +0100)] 
mingw: add bcrypt to LDADD for rust compilation

3 years agostream/reassembly: ignore min_inspect_depth on TCP state CLOSED
Victor Julien [Fri, 26 Nov 2021 12:06:00 +0000 (13:06 +0100)] 
stream/reassembly: ignore min_inspect_depth on TCP state CLOSED

3 years agodetect/http: don't set min-inspect-depth higher than setting
Victor Julien [Fri, 26 Nov 2021 10:05:46 +0000 (11:05 +0100)] 
detect/http: don't set min-inspect-depth higher than setting

3 years agoeve/ftp-data: log alert metadata in ftp-data object
Philippe Antoine [Tue, 30 Nov 2021 13:21:48 +0000 (14:21 +0100)] 
eve/ftp-data: log alert metadata in ftp-data object

Ticket: 4860

instead of directly in root

3 years agorust: export constants via cbindgen
Philippe Antoine [Tue, 30 Nov 2021 08:19:20 +0000 (09:19 +0100)] 
rust: export constants via cbindgen

so that constants are not defined twice in Rust anc C
So that we are sure they have the same value

3 years agomime: handles multiple sections for a parameter
Philippe Antoine [Fri, 4 Jun 2021 13:06:10 +0000 (15:06 +0200)] 
mime: handles multiple sections for a parameter

Ticket: 4386

as per RFC2231.
For instance filename can be split between filename*0,
filename*1, etc...

3 years agomime: move FindMimeHeaderTokenRestrict to rust
Philippe Antoine [Fri, 4 Jun 2021 13:05:14 +0000 (15:05 +0200)] 
mime: move FindMimeHeaderTokenRestrict to rust

Also fixes the case where the token name is present
in a value

3 years agodetect-ipopts: convert unittests to FAIL/PASS APIs
Modupe Falodun [Mon, 6 Dec 2021 08:28:42 +0000 (09:28 +0100)] 
detect-ipopts: convert unittests to FAIL/PASS APIs

Bug: 4047

3 years agomqtt: fix transaction completion
Philippe Antoine [Thu, 2 Dec 2021 09:29:40 +0000 (10:29 +0100)] 
mqtt: fix transaction completion

Ticket: 4862

A transaction to client is always considered
complete in the direction to server and vice versa.
Otherwise, transactions are never complete for
AppLayerParserTransactionsCleanup

3 years agodetect/fast_pattern: allow for rule time registration
Victor Julien [Fri, 24 Sep 2021 05:45:39 +0000 (07:45 +0200)] 
detect/fast_pattern: allow for rule time registration

In preparation of more dynamic logic in rule loading also doing
some registration, allow for buffers to be registered as fast_patterns
during rule parsing.

Leaves the register time registrations mostly as-is, but copies the
resulting list into the DetectEngineCtx and works with that onwards.
This list can then be extended.

3 years agodetect: add buffer helper functions
Victor Julien [Fri, 3 Dec 2021 08:45:56 +0000 (09:45 +0100)] 
detect: add buffer helper functions

3 years agodetect: split register time and detect load time buffer funcs
Victor Julien [Wed, 22 Sep 2021 19:07:17 +0000 (21:07 +0200)] 
detect: split register time and detect load time buffer funcs

3 years agodetect: use hashes for all buffer to id
Victor Julien [Wed, 22 Sep 2021 17:26:02 +0000 (19:26 +0200)] 
detect: use hashes for all buffer to id

Instead of a map that is constantly realloc'd, use 2 hash tables for
DetectBufferType entries: one by name (+transforms), the other by
id. Use these everywhere.

3 years agodetect: increase SigMatch type from u8 to u16
Victor Julien [Fri, 3 Dec 2021 07:01:51 +0000 (08:01 +0100)] 
detect: increase SigMatch type from u8 to u16

3 years agodetect: use bool for uint16_t used as bool
Victor Julien [Tue, 30 Nov 2021 12:35:48 +0000 (13:35 +0100)] 
detect: use bool for uint16_t used as bool

3 years agocommon: fix missing ; in header
Victor Julien [Fri, 3 Dec 2021 15:26:32 +0000 (16:26 +0100)] 
common: fix missing ; in header

3 years agodetect: allows <> syntax for uint ranges 6642/head
Philippe Antoine [Thu, 18 Feb 2021 14:43:03 +0000 (15:43 +0100)] 
detect: allows <> syntax for uint ranges

3 years agodetect: use prefilter values for modes
Philippe Antoine [Wed, 17 Feb 2021 16:26:38 +0000 (17:26 +0100)] 
detect: use prefilter values for modes

3 years agodetect: errors for rule with impossible conditions
Philippe Antoine [Wed, 17 Feb 2021 16:14:21 +0000 (17:14 +0100)] 
detect: errors for rule with impossible conditions

Such as >255 for an uint8 field

3 years agouserguide: (nit) fix typo in lua-output page
Juliana Fajardini [Fri, 15 Oct 2021 15:36:24 +0000 (16:36 +0100)] 
userguide: (nit) fix typo in lua-output page

3 years agouserguide: rename pg Lua Scripting->Lua Detection
Juliana Fajardini [Thu, 14 Oct 2021 22:06:01 +0000 (23:06 +0100)] 
userguide: rename pg Lua Scripting->Lua Detection

Since we can have scripts for output _or_ detection, it seems more
clear to rename this page to add more meaning

3 years agouserguide: update buffers list for lua-scripting
Juliana Fajardini [Thu, 14 Oct 2021 21:48:47 +0000 (22:48 +0100)] 
userguide: update buffers list for lua-scripting

3 years agouserguide/lua: add explanation about `need` diffs
Juliana Fajardini [Thu, 14 Oct 2021 21:42:11 +0000 (22:42 +0100)] 
userguide/lua: add explanation about `need` diffs

The differences on how the `need` key works, depending on script
usage (output or detection) confuses users, sometimes (cf doc#4725).
While we don't fix that, just explain this behavior.

3 years agofuzz: restrict flags passed to AppLayerProtoDetectGetProto
Philippe Antoine [Tue, 23 Nov 2021 21:13:56 +0000 (22:13 +0100)] 
fuzz: restrict flags passed to AppLayerProtoDetectGetProto

Completes commit 05f9b3ffc687d1afcfc5984ac9f0ce1888d06bf5