]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
23 months agobuild/nss: Remove libnss from CI 9442/head
Jeff Lucovsky [Thu, 27 Jul 2023 14:10:49 +0000 (10:10 -0400)] 
build/nss: Remove libnss from CI

23 months agocommunity-id: Fix IPv6 address sorting not respecting byte order
Arne Welzel [Sun, 20 Aug 2023 15:32:47 +0000 (17:32 +0200)] 
community-id: Fix IPv6 address sorting not respecting byte order

When comparing IPv6 addresses based on uint32_t chunks, one needs to
apply ntohl() conversion to the individual parts, otherwise on little
endian systems individual bytes are compared in the wrong order.
Avoid this all and leverage memcmp(), it'll short circuit on the first
differing byte and its return values tells us which address sorts lower.

Bug: #6276

23 months agonapatech: fix null-dereference of packet 9441/head
Ralph Eastwood [Mon, 21 Aug 2023 09:05:57 +0000 (11:05 +0200)] 
napatech: fix null-dereference of packet

23 months agonapatech: print NUMA recommendation early
Ralph Eastwood [Wed, 16 Aug 2023 11:30:01 +0000 (13:30 +0200)] 
napatech: print NUMA recommendation early

When thread affinity is set, the NUMA configuration specified in
the napatech.ini configuration could be incorrect and then fail.
This fails before the recommended configuration is printed, which
is pretty unhelpful.

23 months agonapatech: fix incorrect fmt specifiers for log
Ralph Eastwood [Wed, 16 Aug 2023 08:36:16 +0000 (10:36 +0200)] 
napatech: fix incorrect fmt specifiers for log

23 months agonapatech: remove superfluous log messages
Ralph Eastwood [Wed, 16 Aug 2023 08:30:37 +0000 (10:30 +0200)] 
napatech: remove superfluous log messages

23 months agonapatech: generalise numa config recommending
Ralph Eastwood [Mon, 14 Aug 2023 10:03:41 +0000 (12:03 +0200)] 
napatech: generalise numa config recommending

Previous implementation hardcoded up to 4 NUMA nodes.
We support arbitrary number of NUMA nodes now.

Note that this commit also removes the old SCLog logging
calls.  But since the logic has changed, these have been replaced
directly with new code.

23 months agonapatech: fix shadowed global is_inline warning
Ralph Eastwood [Tue, 15 Aug 2023 08:24:05 +0000 (10:24 +0200)] 
napatech: fix shadowed global is_inline warning

23 months agoconfigure: move -lntapi to LIBS variable
Ralph Eastwood [Mon, 14 Aug 2023 12:30:31 +0000 (14:30 +0200)] 
configure: move -lntapi to LIBS variable

Previously -lntapi was appended to LDFLAGS which did not work with
all build environments.

23 months agonapatech: fix warnings with ByteExtractStringUint8
Ralph Eastwood [Thu, 3 Aug 2023 13:32:10 +0000 (15:32 +0200)] 
napatech: fix warnings with ByteExtractStringUint8

The WARN_UNUSED attribute has been added to ByteExtractStringUint8
in commit 698816811406572c443ca1e95c309d292f489376.  The return
value is now handled and appropriate errors printed.

23 months agonapatech: fix thread flags with THV_RUNNING
Ralph Eastwood [Thu, 3 Aug 2023 12:40:13 +0000 (12:40 +0000)] 
napatech: fix thread flags with THV_RUNNING

This update the Napatech vendor module with changes introduced in
13beba141c98debc4d7e29081c91a799362f19fb that introduces THV_RUNNING.

23 months agonapatech: fix compilation with SCTIME usage
Ralph Eastwood [Thu, 3 Aug 2023 12:30:42 +0000 (12:30 +0000)] 
napatech: fix compilation with SCTIME usage

This replaces the broken compilation due to the change of SCTime_t
into a structure: 9fbe68364259ea71fcd0d22521afcaddefdc744d.

23 months agonapatech: fix missing header includes
Ralph Eastwood [Thu, 3 Aug 2023 12:18:05 +0000 (12:18 +0000)] 
napatech: fix missing header includes

23 months agonapatech: fix compilation errors in SCLog calls
Ralph Eastwood [Thu, 3 Aug 2023 13:03:41 +0000 (13:03 +0000)] 
napatech: fix compilation errors in SCLog calls

Since f8474344cdd00e3d128ffc3ec6d7e465bbe2894d, there is an extra
argument to SCLog which indicates the module and subsystem
identifier.  The Napatech vendor code is missing this argument,
which is fixed here.

23 months agoconfig/flow: fix division by zero
Philippe Antoine [Wed, 30 Aug 2023 12:48:56 +0000 (14:48 +0200)] 
config/flow: fix division by zero

Fixes: 805b07fa4236 ("src: checks to avoid divisions by zero")
Coverity id: 1539152

Ticket: #5920
Ticket: #6255

23 months agodhcp: Log Vendor Client Identifier (dhcp option 60)
Yatin Kanetkar [Sat, 19 Aug 2023 17:10:33 +0000 (13:10 -0400)] 
dhcp: Log Vendor Client Identifier (dhcp option 60)

* Log vendor client identifier (dhcp option 60) if extended dhcp
logging is turned on. This required the `vendor_client_identifier` to
be added to the json schema. Validation done using an SV Test
* Added `requested_ip` to the json schema as well, since it was
missed. My SV test failed without it.

Feature #4587

23 months agordp: do not use zero-bit bitflag 9438/head
Philippe Antoine [Wed, 30 Aug 2023 09:43:07 +0000 (11:43 +0200)] 
rdp: do not use zero-bit bitflag

cf https://docs.rs/bitflags/latest/bitflags/#zero-bit-flags

As warned by clippy 1.72.0

23 months agorust: fix clippy warnings for version 1.72.0
Philippe Antoine [Wed, 30 Aug 2023 09:24:24 +0000 (11:24 +0200)] 
rust: fix clippy warnings for version 1.72.0

Includes using the right prototype for C SRepCatGetByShortname

23 months agoiprep: fix parsing ip-rep data with carriage return 9426/head
Thomas Winter [Mon, 15 May 2023 02:18:47 +0000 (14:18 +1200)] 
iprep: fix parsing ip-rep data with carriage return

Commit e7c0f0ad91fd removed uses of atoi with a new number parsing
functions. This broke parsing ip-reputation data files that contained
trailing carriage returns as it was being included in the number
string to convert.

Bug: #6243.

23 months agothreading: set min thread stack size; set it early 9380/head 9381/head
Victor Julien [Thu, 10 Aug 2023 14:31:29 +0000 (16:31 +0200)] 
threading: set min thread stack size; set it early

Multi-tenancy uses loader threads that initialize detection engines. During
this, esp the AC family of MPM implementations, there is significant stack
usage. In most OS' threads have a lower stack size by default. In Linux, when
using the Musl C library, a thread by default gets 128KiB.

This patch does 2 things:

1. it centralizes the handling of the `threading.stack-size`. It it is not
   longer handled by the runmodes, but called from the global initialization
   logic.

2. it sets a minimum per thread stack size of 512k, unless `threading.stack-size`
   is set.

Ticket: #6265.

23 months agompm: allocate StateQueue on the heap
Philippe Antoine [Mon, 20 Mar 2023 12:21:34 +0000 (13:21 +0100)] 
mpm: allocate StateQueue on the heap

So that we can have multi-tenant on MacOS without stack
overflows because of the size of the structure...

Ticket: #6263.

23 months agodetect/loader: minor code cleanups
Victor Julien [Thu, 10 Aug 2023 11:04:47 +0000 (13:04 +0200)] 
detect/loader: minor code cleanups

23 months agoworkflows: use s-v --debug-failed
Shivani Bhardwaj [Wed, 9 Aug 2023 13:08:00 +0000 (18:38 +0530)] 
workflows: use s-v --debug-failed

23 months agodetect: fix path creation in Windows
Victor Julien [Thu, 10 Aug 2023 08:08:37 +0000 (10:08 +0200)] 
detect: fix path creation in Windows

Fixes file loading for rule files and Lua scripts.

Bug: #6095.

23 months agodoc/userguide: add reload-tenant(s) doc
Victor Julien [Wed, 9 Aug 2023 15:35:18 +0000 (17:35 +0200)] 
doc/userguide: add reload-tenant(s) doc

23 months agomulti-tenant: add reload-tenants command
Victor Julien [Wed, 9 Aug 2023 07:53:20 +0000 (09:53 +0200)] 
multi-tenant: add reload-tenants command

Command to reload all tenants. Their original yaml path will be
used.

Ticket: #6267.

23 months agomulti-tenant: allow reload w/o yaml path
Victor Julien [Tue, 8 Aug 2023 17:59:57 +0000 (19:59 +0200)] 
multi-tenant: allow reload w/o yaml path

Store yaml path in de ctx, for reloads w/o path.

This allows for a simpler `reload-tenant N`, where the previously
used yaml is reloaded.

23 months agomulti-tenant: don't init config twice in tenant reload
Victor Julien [Tue, 8 Aug 2023 17:59:24 +0000 (19:59 +0200)] 
multi-tenant: don't init config twice in tenant reload

23 months agodetect: add multi-detect.config-path
Victor Julien [Tue, 8 Aug 2023 13:56:12 +0000 (15:56 +0200)] 
detect: add multi-detect.config-path

Add option to specify path from which to load the tenants.

Mostly meant to be used in testing.

23 months agodetect: free all tenant detect engines
Victor Julien [Tue, 8 Aug 2023 13:50:53 +0000 (15:50 +0200)] 
detect: free all tenant detect engines

Free all tenants registered in the master.

23 months agopath: new funcs to merge paths
Victor Julien [Thu, 10 Aug 2023 08:07:22 +0000 (10:07 +0200)] 
path: new funcs to merge paths

Take windows directory separators into account.

Path is not checked or "resolved".

23 months agostat: add wrappers to isolate OS_WIN32 specifics
Victor Julien [Wed, 9 Aug 2023 06:00:09 +0000 (08:00 +0200)] 
stat: add wrappers to isolate OS_WIN32 specifics

23 months agothreshold: minor code cleanups
Victor Julien [Tue, 8 Aug 2023 05:22:58 +0000 (07:22 +0200)] 
threshold: minor code cleanups

23 months agothreshold: fix multi-tenant file parsing
Victor Julien [Sun, 6 Aug 2023 07:40:37 +0000 (09:40 +0200)] 
threshold: fix multi-tenant file parsing

Switch to DetectParseRegex and use a local pcre2_match_data to
avoid concurrency issues.

Bug: #6247.

23 months agooutput: deinit last so logging can happen until the end
Victor Julien [Thu, 3 Aug 2023 05:53:50 +0000 (07:53 +0200)] 
output: deinit last so logging can happen until the end

23 months agovar-names: reimplement var name handling
Victor Julien [Wed, 2 Aug 2023 06:37:45 +0000 (08:37 +0200)] 
var-names: reimplement var name handling

Implement a new design for handling var name id's. The old logic
was aware of detection engine versions and generally didn't work
well for multi-tenancy cases. Other than memory leaks and crashes,
logging of var names worked or failed based on which tenant was
loaded last.

This patch implements a new approach, where there is a global store
of vars and their id's for the lifetime of the program.

Overall Design:

Base Store: "base"

Used during keyword registration. Operates under lock. Base is shared
between all detect engines, detect engine versions and tenants.
Each variable name is ref counted.

During the freeing of a detect engine / tenant, unregistration decreases
the ref cnt.

Base has both a string to id and a id to string hash table. String to
id is used during parsing/registration. id to string during unregistration.

Active Store Pointer (atomic)

The "active" store atomic pointer points to the active lookup store. The call
to `VarNameStoreActivate` will build a new lookup store and hot swap
the pointer.

Ensuring memory safety. During the hot swap, the pointer is replaced, so
any new call to the lookup functions will automatically use the new store.
This leaves the case of any lookup happening concurrently with the pointer
swap. For this case we add the old store to a free list. It gets a timestamp
before which it cannot be freed.

Free List

The free list contains old stores that are waiting to get removed. They
contain a timestamp that is checked before they are freed.

Bug: #6044.
Bug: #6201.

23 months agodetect/pcre: use local match data during parsing
Victor Julien [Tue, 1 Aug 2023 13:36:44 +0000 (15:36 +0200)] 
detect/pcre: use local match data during parsing

Fixes multi-tenant multi-loader crashes.

Bug: #6247.

23 months agoeve/schema: add host 9377/head
Jason Ish [Thu, 10 Aug 2023 17:38:18 +0000 (11:38 -0600)] 
eve/schema: add host

The "host" field is added to EVE events if the "sensor-name" field is
configured in suricata.yaml.

23 months agoeve: fix double free of sensor-name on error
Jason Ish [Thu, 10 Aug 2023 17:31:44 +0000 (11:31 -0600)] 
eve: fix double free of sensor-name on error

Remove the free of "sensor_name" on error in output-json as this is
cleaned up by the LogFileCtx.

Bug: #6256

23 months agoaf-packet: terminate on same interface & copyiface 9370/head
Shivani Bhardwaj [Thu, 10 Aug 2023 12:17:35 +0000 (17:47 +0530)] 
af-packet: terminate on same interface & copyiface

If the interface and copy-iface are same for an af-packet IPS device
setting then fataly exit else it leads to a segfault in later stages.

Bug 5870

23 months agoaf-packet: check out_iface not NULL
Shivani Bhardwaj [Thu, 10 Aug 2023 12:16:41 +0000 (17:46 +0530)] 
af-packet: check out_iface not NULL

23 months agodetect/file: use util to turn keyword to nocase 9355/head
Victor Julien [Fri, 4 Aug 2023 15:08:06 +0000 (17:08 +0200)] 
detect/file: use util to turn keyword to nocase

This changes the way the pattern is stored by making it lowercase.

23 months agodetect/content: cleanup nocase conversion
Victor Julien [Fri, 4 Aug 2023 12:18:20 +0000 (14:18 +0200)] 
detect/content: cleanup nocase conversion

23 months agodoc: update file.magic information
jason taylor [Tue, 1 Aug 2023 15:34:08 +0000 (15:34 +0000)] 
doc: update file.magic information

Signed-off-by: jason taylor <jtfas90@gmail.com>
23 months agodoc: update fileext keyword information
jason taylor [Tue, 18 Jul 2023 21:17:31 +0000 (21:17 +0000)] 
doc: update fileext keyword information

Signed-off-by: jason taylor <jtfas90@gmail.com>
23 months agodoc: update file.name keyword information
jason taylor [Mon, 17 Jul 2023 16:36:58 +0000 (16:36 +0000)] 
doc: update file.name keyword information

Signed-off-by: jason taylor <jtfas90@gmail.com>
23 months agodoc/userguide: improve SCStreamingBuffer example
Alexandre Iooss [Fri, 28 Jul 2023 07:46:02 +0000 (09:46 +0200)] 
doc/userguide: improve SCStreamingBuffer example

Add direction indication in SCStreamingBuffer usage example.
This adds documentation for the changes introduced by commit
5b1d8c7e94ef613107870d4d9d9cdde76d4c3438.

2 years agodpdk/mlx5: fix shutdown crash in IPS mode 9349/head
Victor Julien [Thu, 3 Aug 2023 14:02:10 +0000 (16:02 +0200)] 
dpdk/mlx5: fix shutdown crash in IPS mode

Make sure to first close all ports before freeing device mempools.

Thread 1 "Suricata-Main" received signal SIGSEGV, Segmentation fault.
0x00007ffff456a3fb in ?? () from /usr/lib/x86_64-linux-gnu/dpdk/pmds-20.0/librte_pmd_mlx5.so
(gdb) bt
 #0  0x00007ffff456a3fb in ?? () from /usr/lib/x86_64-linux-gnu/dpdk/pmds-20.0/librte_pmd_mlx5.so
 #1  0x00007ffff469a948 in ?? () from /usr/lib/x86_64-linux-gnu/dpdk/pmds-20.0/librte_pmd_mlx5.so
 #2  0x00007ffff45606aa in ?? () from /usr/lib/x86_64-linux-gnu/dpdk/pmds-20.0/librte_pmd_mlx5.so
 #3  0x00007ffff6d4ed8d in rte_eth_dev_close () from /usr/lib/x86_64-linux-gnu/librte_ethdev.so.20.0
 #4  0x000000000055fc4c in DPDKCloseDevice (ldev=ldev@entry=0xe3a400) at util-dpdk.c:53
 #5  0x000000000055f4eb in LiveDeviceListClean () at util-device.c:331
 #6  0x00000000005511c8 in GlobalsDestroy (suri=<optimized out>) at suricata.c:381
 #7  0x0000000000550a76 in SuricataMain (argc=<optimized out>, argv=<optimized out>) at suricata.c:3059
 #8  0x00007ffff6a24083 in __libc_start_main (main=0x54cca0 <main>, argc=8, argv=0x7fffffffe4c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe4b8) at ../csu/libc-start.c:308
 #9  0x000000000054cbde in _start ()

Bug: #5619.

2 years agouserguide/ppa: fix typo
Juliana Fajardini [Thu, 3 Aug 2023 15:38:52 +0000 (12:38 -0300)] 
userguide/ppa: fix typo

The launchpad repo for suricata-beta read 'oisd' instead of 'oisf'

2 years agodetect/analysis: Move globals to engine ctx
Jeff Lucovsky [Thu, 3 Aug 2023 14:06:47 +0000 (10:06 -0400)] 
detect/analysis: Move globals to engine ctx

Issue: 6239

This commit moves the global variables associated with engine analysis
into the detect engine context. Doing so provides encapsulation of the
analysis components as well as thread-safe operation in a multi-tenant
(context) deployment.

2 years agouserguide/install: add info on ubuntu ppa installs 9336/head
Juliana Fajardini [Tue, 1 Aug 2023 21:42:08 +0000 (18:42 -0300)] 
userguide/install: add info on ubuntu ppa installs

Bringing info that was only in our Redmine wiki to our documentation.

Task #6231

2 years agodocs: miscellanea updates
Juliana Fajardini [Tue, 1 Aug 2023 21:19:45 +0000 (18:19 -0300)] 
docs: miscellanea updates

- Fix a DPDK reference link, add some line breaks.
- Exemplify what a good commit message looks
like, for Suricata's commit style.

2 years agogithub-ci: disable some workflows on doc only changes 9331/head
Jason Ish [Wed, 2 Aug 2023 16:49:07 +0000 (10:49 -0600)] 
github-ci: disable some workflows on doc only changes

Don't run the following GitHub workflows on documentation only
changes:
- cifuzz
- codeql
- formatting
- rust
- scan-build

2 years agodoc/userguide: display version on front page 9330/head
Jason Ish [Wed, 2 Aug 2023 16:09:40 +0000 (10:09 -0600)] 
doc/userguide: display version on front page

When viewing the docs online at Readthedocs, or similar it might be
immediately apparent what version of the documentation is being
displayed. Display the version on the first line before the table of
contents to make it clear.

2 years agorust: update cargo.lock 9320/head
Victor Julien [Mon, 31 Jul 2023 07:15:44 +0000 (09:15 +0200)] 
rust: update cargo.lock

2 years agodetect: update filename buffer description name
jason taylor [Tue, 1 Aug 2023 15:59:03 +0000 (15:59 +0000)] 
detect: update filename buffer description name

Signed-off-by: jason taylor <jtfas90@gmail.com>
2 years agostream: special handling for RST data
Victor Julien [Tue, 1 Aug 2023 06:44:53 +0000 (08:44 +0200)] 
stream: special handling for RST data

Data on RST packets is not invalid, but also shouldn't be used
in reassembly.

RFC 1122:

  4.2.2.12  RST Segment: RFC-793 Section 3.4

    A TCP SHOULD allow a received RST segment to include data.

    DISCUSSION
        It has been suggested that a RST segment could contain
        ASCII text that encoded and explained the cause of the
        RST.  No standard has yet been established for such
        data.

RST data will be presented to the detection engine per packet,
but will not be part of stream reassembly.

Bug: #6244.

2 years agostream: add stream.rst_with_data event for RST with data
Victor Julien [Tue, 1 Aug 2023 05:48:04 +0000 (07:48 +0200)] 
stream: add stream.rst_with_data event for RST with data

2 years agoftp: reenable debug check; improve debug log
Victor Julien [Mon, 31 Jul 2023 19:54:45 +0000 (21:54 +0200)] 
ftp: reenable debug check; improve debug log

2 years agopcap/file: normalize file timestamps
Victor Julien [Mon, 31 Jul 2023 19:52:18 +0000 (21:52 +0200)] 
pcap/file: normalize file timestamps

Normalize the timestamps that are too far in the past to epoch.

Bug: #6240.

2 years agothreads: improve spawn failure error reporting
Victor Julien [Tue, 1 Aug 2023 12:00:54 +0000 (14:00 +0200)] 
threads: improve spawn failure error reporting

2 years agodoc: add note about cpu prio overwrite behavior 9312/head
Andreas Herz [Tue, 25 Jul 2023 14:46:01 +0000 (16:46 +0200)] 
doc: add note about cpu prio overwrite behavior

2 years agodoc: dataset - add type to be mandatory
Andreas Herz [Tue, 25 Jul 2023 14:37:30 +0000 (16:37 +0200)] 
doc: dataset - add type to be mandatory

2 years agoradix: Detect duplicate netblocks 9306/head
Jeff Lucovsky [Mon, 24 Apr 2023 13:56:01 +0000 (09:56 -0400)] 
radix: Detect duplicate netblocks

This commit prevents duplicate IPV4/IPV6 netblocks from being added to the
radix tree.

Contributed by Giuseppe Longo <giuseppe@glongo.it>

Issue: 5748

2 years agoerror: Add SC_EEXIST for dups
Jeff Lucovsky [Wed, 14 Jun 2023 12:40:26 +0000 (08:40 -0400)] 
error: Add SC_EEXIST for dups

Issue: 5748

This commit adds SC_EEXIST to be used for cases where an
item/resource/artifact with the same attributes already exists.

2 years agogen/bool: Use bool type instead of ints
Jeff Lucovsky [Mon, 24 Apr 2023 13:55:04 +0000 (09:55 -0400)] 
gen/bool: Use bool type instead of ints

This commit converts usages of `int` to `bool` within the radix utility
code.

2 years agoreputation: Release memory on key add fails
Jeff Lucovsky [Mon, 24 Apr 2023 13:51:56 +0000 (09:51 -0400)] 
reputation: Release memory on key add fails

Ensure that memory for the reputation key is released on failed adds.

Contributed by Giuseppe Longo <giuseppe@glongo.it>

Issue: 5748

2 years agogen/typos: Correct misc. typos.
Jeff Lucovsky [Mon, 24 Apr 2023 13:49:40 +0000 (09:49 -0400)] 
gen/typos: Correct misc. typos.

2 years agogeneral: Remove unused include files 9295/head
Jeff Lucovsky [Wed, 26 Jul 2023 12:48:14 +0000 (08:48 -0400)] 
general: Remove unused include files

2 years agooutput/stats: Handle stat names w/out scope
Jeff Lucovsky [Wed, 26 Jul 2023 12:46:00 +0000 (08:46 -0400)] 
output/stats: Handle stat names w/out scope

Issue: 6094

Not all stat names are scoped, e.g. decoder.pkts is scoped to decoder;
mempressure_max is unscoped.

The concept of a short-name is added to the underlying stat structure so
- Calculation is done once, at stat registration time
- The output code can easily determine if a stat has a scope

2 years agomem/alloc: Replace malloc with calloc
Jeff Lucovsky [Wed, 26 Jul 2023 12:38:13 +0000 (08:38 -0400)] 
mem/alloc: Replace malloc with calloc

Minor cleanup so SCCalloc is used in preference to SCMalloc.

2 years agogeneral/typo: Correct spelling/grammar issues
Jeff Lucovsky [Wed, 26 Jul 2023 12:37:04 +0000 (08:37 -0400)] 
general/typo: Correct spelling/grammar issues

2 years agoschema: Add memcap pressure values
Jeff Lucovsky [Wed, 26 Jul 2023 12:33:04 +0000 (08:33 -0400)] 
schema: Add memcap pressure values

Issue: 6094

This commit extends the EVE schema with memcap_pressure values; these
are included in the stat event type records.

2 years agodcerpc: accept ALTER_CONTEXT as a valid request 9291/head
Shivani Bhardwaj [Wed, 26 Jul 2023 09:41:59 +0000 (15:11 +0530)] 
dcerpc: accept ALTER_CONTEXT as a valid request

So far, if only the starting request was a DCERPC request, it would be
considered DCERPC traffic. Since ALTER_CONTEXT is a valid request type,
it should be accepted too.

Reported and patch proposed in the following Redmine ticket by
InterNALXz.

Bug 6191

2 years agodpdk: treat unknown socket ID as a valid socket ID 9288/head
Lukas Sismis [Mon, 17 Jul 2023 09:33:18 +0000 (11:33 +0200)] 
dpdk: treat unknown socket ID as a valid socket ID

Ticket: #6232

2 years agodpdk: fix DPDK thread check for IPS mode
Lukas Sismis [Tue, 25 Jul 2023 11:07:39 +0000 (13:07 +0200)] 
dpdk: fix DPDK thread check for IPS mode

Ticket: #6233

2 years agouserguide/upgrade: link to exception policy FAQ
Juliana Fajardini [Mon, 24 Jul 2023 15:45:41 +0000 (12:45 -0300)] 
userguide/upgrade: link to exception policy FAQ

With the release of 7, people are starting to have issues with traffic
being blocked. While we don't add a more expansive documentation for
this, add a link to the FAQ covering possible fixes for drops caused by
the fail closed default behavior of the exception policies.

2 years agooutput: add storing boolean for files
Philippe Antoine [Mon, 26 Dec 2022 11:24:11 +0000 (12:24 +0100)] 
output: add storing boolean for files

When filestore keyword is triggered, the file is not yet stored,
when the alert is generated, but only marked for storing.

Ticket: 4881

2 years agojsonschema: add missing field .files[].file_id
Philippe Antoine [Mon, 26 Dec 2022 11:26:15 +0000 (12:26 +0100)] 
jsonschema: add missing field .files[].file_id

2 years agosrc: checks to avoid divisions by zero
Philippe Antoine [Fri, 30 Jun 2023 08:21:57 +0000 (10:21 +0200)] 
src: checks to avoid divisions by zero

Ticket: #5920

2 years agoprofiling: fix check to compute average bytes
Philippe Antoine [Wed, 5 Jul 2023 13:32:57 +0000 (15:32 +0200)] 
profiling: fix check to compute average bytes

2 years agostats: add drop reason counters
Victor Julien [Tue, 25 Jul 2023 05:51:02 +0000 (07:51 +0200)] 
stats: add drop reason counters

{
  "accepted": 296185,
  "blocked": 162,
  "rejected": 0,
  "replaced": 0,
  "drop_reason": {
    "decode_error": 0,
    "defrag_error": 0,
    "defrag_memcap": 0,
    "flow_memcap": 0,
    "flow_drop": 94,
    "applayer_error": 0,
    "applayer_memcap": 0,
    "rules": 3,
    "threshold_detection_filter": 0,
    "stream_error": 63,
    "stream_memcap": 0,
    "stream_midstream": 2,
    "nfq_error": 0,
    "tunnel_packet_drop": 0
  }
}

Ticket: #6230.

2 years agostats: update ips capture counters centrally
Victor Julien [Mon, 24 Jul 2023 20:13:52 +0000 (22:13 +0200)] 
stats: update ips capture counters centrally

This adds support to all capture methods for these counters.

The updates happen only on "real" packets, not on encapsulated
packets.

Ticket: #4756.

2 years agostats: register ips capture stats for each packet thread
Victor Julien [Mon, 24 Jul 2023 19:09:10 +0000 (21:09 +0200)] 
stats: register ips capture stats for each packet thread

ReleasePacket based verdicts can happen in several threads,
depending on the runmode details.

Only register and update if in IPS mode.

2 years agoeve/schema: add ips capture stats
Victor Julien [Mon, 24 Jul 2023 19:08:00 +0000 (21:08 +0200)] 
eve/schema: add ips capture stats

2 years agostats: simplify ips capture stats logic
Victor Julien [Mon, 24 Jul 2023 18:33:35 +0000 (20:33 +0200)] 
stats: simplify ips capture stats logic

Since many implementations use the ReleasePacket callback to issue
their verdict, no thread ctx is available. To work around this
just register the stats in a `thread_local` variable instead.

2 years agomime: replace small memcpy with loop
Victor Julien [Fri, 21 Jul 2023 08:05:41 +0000 (10:05 +0200)] 
mime: replace small memcpy with loop

To address:

      In file included from /usr/include/string.h:535,
                 from suricata-common.h:108,
                 from util-decode-mime.c:26:
In function ‘memcpy’,
    inlined from ‘ProcessBase64Remainder’ at util-decode-mime.c:1201:13:
/usr/include/mipsel-linux-gnu/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ forming offset 4 is out of the bounds [0, 4] of object ‘block’ with type ‘uint8_t[4]’ {aka ‘unsigned char[4]’} [-Warray-bounds=]
   29 |   return __builtin___memcpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   30 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
util-decode-mime.c: In function ‘ProcessBase64Remainder’:
util-decode-mime.c:1174:13: note: ‘block’ declared here
 1174 |     uint8_t block[B64_BLOCK];
      |             ^~~~~

Copy data should be <= 4 bytes.

2 years agodetect: fix minor compile warning
Victor Julien [Fri, 21 Jul 2023 08:32:07 +0000 (10:32 +0200)] 
detect: fix minor compile warning

      detect-engine.c: In function ‘DetectKeywordCtxHashFunc’:
detect-engine.c:3550:75: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 3550 |     uint64_t hash = StringHashDjb2((const uint8_t *)name, strlen(name)) + (uint64_t)ctx->data;
      |

2 years agosysfs: fix minor compile warning
Victor Julien [Fri, 21 Jul 2023 08:03:44 +0000 (10:03 +0200)] 
sysfs: fix minor compile warning

Seen in Debian QA on mipsel.

util-sysfs.c: In function ‘SysFsWriteValue’:
util-sysfs.c:50:45: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘int64_t’ {aka ‘long long int’} [-Wformat=]
   50 |     snprintf(sentence, sizeof(sentence), "%ld", value);
      |                                           ~~^   ~~~~~
      |                                             |   |
      |                                             |   int64_t {aka long long int}
      |                                             long int
      |                                           %lld

2 years agodecode-ipv6: Set L4 proto on ipv6 incase of GRE decode error 9267/head
Cole Dishington [Mon, 10 Jul 2023 02:02:18 +0000 (14:02 +1200)] 
decode-ipv6: Set L4 proto on ipv6 incase of GRE decode error

Set the L4 proto before decoding GRE in ipv6 decoding in case there is a
GRE header decoding error.

Bug: #6222

2 years agodecode: fix offset for DCE layer 9261/head
Philippe Antoine [Fri, 30 Jun 2023 08:45:37 +0000 (10:45 +0200)] 
decode: fix offset for DCE layer

Fixes: 136d351e403b ("decode: single network layer entrypoint")
Ticket: #3637

2 years agodetect/include: Remove unnecessary includes 9248/head
Jeff Lucovsky [Tue, 18 Jul 2023 12:31:32 +0000 (08:31 -0400)] 
detect/include: Remove unnecessary includes

2 years agoversion: start development towards 7.0.1
Victor Julien [Tue, 18 Jul 2023 15:15:53 +0000 (17:15 +0200)] 
version: start development towards 7.0.1

2 years agorelease: 7.0.0; update changelog suricata-7.0.0
Shivani Bhardwaj [Tue, 18 Jul 2023 04:35:41 +0000 (10:05 +0530)] 
release: 7.0.0; update changelog

2 years agodetect/multi-tenant: Make tenant_id 32 bits everywhere 9244/head
Jeff Lucovsky [Wed, 21 Jun 2023 13:09:45 +0000 (09:09 -0400)] 
detect/multi-tenant: Make tenant_id 32 bits everywhere

Issue: 6047

This commit ensures that the tenant id is contained in a unsigned 32 bit
container.

2 years agodetect/pcre: Use local match variables 9243/head
Jeff Lucovsky [Sun, 16 Jul 2023 15:57:14 +0000 (11:57 -0400)] 
detect/pcre: Use local match variables

pcre2 is not thread-safe wrt match objects so use locally scoped
objects.

Issue: 4797

2 years agodetect/base64_decode: use local pcre2_match_data 9240/head
Victor Julien [Sun, 16 Jul 2023 10:49:12 +0000 (12:49 +0200)] 
detect/base64_decode: use local pcre2_match_data

2 years agoreference: fix multi-tenant loading issues
Victor Julien [Sun, 16 Jul 2023 08:44:18 +0000 (10:44 +0200)] 
reference: fix multi-tenant loading issues

Bug: #4797.

2 years agoclassification: fix multi-tenant loading issues
Victor Julien [Sun, 16 Jul 2023 08:33:11 +0000 (10:33 +0200)] 
classification: fix multi-tenant loading issues

Move pcre2 data structures used for parsing into the detect engine
context, so that multiple tenant loading threads don't use the same
data structures.

Bug: #4797.

2 years agodoc/userguide: update ref to installation from git 9239/head
Juliana Fajardini [Tue, 11 Jul 2023 14:17:41 +0000 (11:17 -0300)] 
doc/userguide: update ref to installation from git

It was still pointing to the redmine wiki and the documentation to be
truthful to the new documentation.