]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
21 months agodns/eve: make removed v1 style a warning, not an error 9714/head
Jason Ish [Mon, 30 Oct 2023 18:16:33 +0000 (12:16 -0600)] 
dns/eve: make removed v1 style a warning, not an error

We don't error out in this case, but instead default to v2. So use a
warning instead of an error.

21 months agodns/eve: use default formats if formats is empty
Jason Ish [Fri, 27 Oct 2023 16:19:31 +0000 (10:19 -0600)] 
dns/eve: use default formats if formats is empty

If the configuration field "formats" is empty, DNS response records do
not have any relevant information other than that there was a
response, but not much about the response.

I'm pretty sure the intention here was to log the response details if
no formats were provided, which is what happens when the field is
commented out.

So if no formats are specified, use the default of all.

Bug: #6420

21 months agodetect/bytejump: convert unittests to FAIL/PASS
Daniel Olatunji [Mon, 30 Oct 2023 01:13:17 +0000 (01:13 +0000)] 
detect/bytejump: convert unittests to FAIL/PASS

Issue: #6328

21 months agorunmodes: remove obsolete references to pcap auto modes
Jason Ish [Fri, 27 Oct 2023 22:58:08 +0000 (16:58 -0600)] 
runmodes: remove obsolete references to pcap auto modes

These auto modes were remove many years ago. Also cleanup the wording
a little.

Task: #6427

21 months agodetect/bytejump: Improve end-of-buffer handling
Jeff Lucovsky [Fri, 27 Oct 2023 13:10:47 +0000 (09:10 -0400)] 
detect/bytejump: Improve end-of-buffer handling

Issue: 4623

This commit addresses the issues reported in issue 4623 when the jump
value points at the last byte in the buffer.

21 months agodetect/bytejump: Remove unused "Match" function
Jeff Lucovsky [Fri, 27 Oct 2023 13:09:43 +0000 (09:09 -0400)] 
detect/bytejump: Remove unused "Match" function

Issue: 4623

DetectBytejumpMatch is no longer used -- it's counterpart --
DetectByteJumpDoMatch is and will remain.

21 months agounix-manager: prioritize the shutdown check
Lukas Sismis [Mon, 25 Sep 2023 13:37:07 +0000 (15:37 +0200)] 
unix-manager: prioritize the shutdown check

Make sure Suricata is in the running state before
you attempt to execute commands on the Unix sockets.
UnixMain is being called in an infinite loop where
TmThreadsCheckFlag(th_v, THV_KILL) is checked for the
deinit phase. However, it may take some time between
the start of Suricata's deinitialization and
the receipt of THV_KILL flag in the Unix thread.

In between this time period, the Unix manager can still
perform select() operation on the Unix socket while
the socket being already deinitialized.

Likely with a longer time span between the initial shutdown
command and actual closing of Unix sockets resulted in
an error of invalid file descriptors.

Ticket: #6272

21 months agogithub: improve template CLA request info 9701/head
Juliana Fajardini [Mon, 23 Oct 2023 18:25:44 +0000 (15:25 -0300)] 
github: improve template CLA request info

Indicate that the CLA only has to be signed once, as we have had
contributors think that was required for each new PR.

21 months agouserguide: add proper label to RPM install section
Juliana Fajardini [Mon, 23 Oct 2023 18:19:45 +0000 (15:19 -0300)] 
userguide: add proper label to RPM install section

Use a reference label that is stable, instead of one that could change
in case a new section is added above it.

21 months agodetect-tcp-window: Convert unittests to new FAIL/PASS API
Hadiqa Alamdar Bukhari [Mon, 23 Oct 2023 15:25:28 +0000 (20:25 +0500)] 
detect-tcp-window: Convert unittests to new FAIL/PASS API

Task #6339

21 months agoflow-bit: Convert unittests to new FAIL/PASS API
Hadiqa Alamdar Bukhari [Fri, 20 Oct 2023 21:25:50 +0000 (02:25 +0500)] 
flow-bit: Convert unittests to new FAIL/PASS API

Task #6329

21 months agoutil-misc: Convert unittests to new FAIL/PASS API
Hadiqa Alamdar Bukhari [Thu, 19 Oct 2023 19:40:50 +0000 (00:40 +0500)] 
util-misc: Convert unittests to new FAIL/PASS API

Task #6345

21 months agomisc: improve code documentation
Liza Opar [Thu, 12 Oct 2023 11:07:48 +0000 (14:07 +0300)] 
misc: improve code documentation

Task #6383

21 months agorust: remove cbindgen:ignore on frames module
Daniel Olatunji [Thu, 12 Oct 2023 11:13:41 +0000 (11:13 +0000)] 
rust: remove cbindgen:ignore on frames module

This directive is no longer required, and does
mess up the rustdoc description of the module.

21 months agorust/doc: add docstring to rust module files.
Daniel Olatunji [Wed, 11 Oct 2023 19:24:03 +0000 (19:24 +0000)] 
rust/doc: add docstring to rust module files.

Issue: #4584

21 months agodoc: be consistent with the use of "sudo"
Daniel Olatunji [Wed, 11 Oct 2023 21:42:47 +0000 (21:42 +0000)] 
doc: be consistent with the use of "sudo"

Issue: #5720

21 months agoversion: start development towards 7.0.3
Victor Julien [Thu, 19 Oct 2023 14:13:19 +0000 (16:13 +0200)] 
version: start development towards 7.0.3

21 months agorelease: 7.0.2; update changelog suricata-7.0.2
Shivani Bhardwaj [Wed, 18 Oct 2023 14:14:53 +0000 (19:44 +0530)] 
release: 7.0.2; update changelog

21 months agomime: avoid quadratic complexity in MimeDecAddEntity
Philippe Antoine [Mon, 11 Sep 2023 14:49:48 +0000 (16:49 +0200)] 
mime: avoid quadratic complexity in MimeDecAddEntity

Ticket: #6306

Keep a reference to last child, consume a bit more RAM to save CPU

21 months agodetect: error early when too many buffers 9645/head
Philippe Antoine [Thu, 5 Oct 2023 07:18:50 +0000 (09:18 +0200)] 
detect: error early when too many buffers

Ticket: #6104

To get a chance to clean properly, before we leak memory.

21 months agodetect: inspect all packets in multi-layer tunneling 9637/head
Victor Julien [Fri, 13 Oct 2023 11:47:05 +0000 (13:47 +0200)] 
detect: inspect all packets in multi-layer tunneling

When the decoders encounter multiple layers of tunneling, multiple tunnel
packets are created. These are then stored in ThreadVars::decode_pq, where
they are processed after the current thread "slot" is done. However, due
to a logic error, the tunnel packets after the first, where not called
for the correct position in the packet pipeline. This would lead to these
packets not going through the FlowWorker module, so skipping everything
from flow tracking, detection and logging.

This would only happen for single and workers, due to how the pipelines
are constructed.

The "slot" holding the decoder, would contain 2 packets in
ThreadVars::decode_pq. Then it would call the pipeline on the first
packet with the next slot of the pipeline through a indirect call to
TmThreadsSlotVarRun(), so it would be called for the FlowWorker.
However when that first (the most inner) packet was done, the call
to TmThreadsSlotVarRun() would again service the ThreadVars::decode_pq
and process it, again moving the slot pointer forward, so past the
FlowWorker.

This patch addresses the issue by making sure only a "decode" thread
slot will service the ThreadVars::decode_pq, thus never moving the
slot past the FlowWorker.

Bug: #6402.

21 months agodetect: fix legacy modifiers leading to multi-buffer
Victor Julien [Tue, 10 Oct 2023 10:09:09 +0000 (12:09 +0200)] 
detect: fix legacy modifiers leading to multi-buffer

Fix non-continious matches with content and pcre modifiers setting up
multiple buffers.

To address this store whether a buffer is multi-capable and if not reuse
an earlier buffer if possible.

Bug: #6397.

Fixes: ad88efc2d868 ("detect: support multi buffer matching")
21 months agodpdk: update DPDK builder versions
Lukas Sismis [Wed, 4 Oct 2023 14:59:39 +0000 (16:59 +0200)] 
dpdk: update DPDK builder versions

21 months agodpdk: support new 23.11 DPDK bonding API
Lukas Sismis [Wed, 4 Oct 2023 14:57:52 +0000 (16:57 +0200)] 
dpdk: support new 23.11 DPDK bonding API

Ticket: #6381

21 months agodpdk: add hugepage hint on low number of hugepages
Lukas Sismis [Wed, 23 Aug 2023 05:57:50 +0000 (07:57 +0200)] 
dpdk: add hugepage hint on low number of hugepages

If a user doesn't allocate/allocates too little hugepages,
Suricata fails to start and outputs a hint to increase
number of hugepages (if enabled).

Ticket: #5966

21 months agodpdk: add hugepage hint to lower the amount of reserved hugepages
Lukas Sismis [Wed, 16 Aug 2023 21:51:10 +0000 (23:51 +0200)] 
dpdk: add hugepage hint to lower the amount of reserved hugepages

If a user allocates too many hugepages and those are largely not used
then Suricata suggests that the user can lower the amount of hugepages
and therefore save memory for other purposes.

Ticket: #5966

21 months agouserguide: cover install-full and install-conf
Comfort Amaechi [Sat, 7 Oct 2023 23:38:22 +0000 (19:38 -0400)] 
userguide: cover install-full and install-conf

Ticket: #6342

21 months agodoc: add tls.cert_chain_len docs
jason taylor [Thu, 5 Oct 2023 21:04:26 +0000 (21:04 +0000)] 
doc: add tls.cert_chain_len docs

Ticket: #6386

Signed-off-by: jason taylor <jtfas90@gmail.com>
21 months agodetect-ssh-proto-version: use FAIL macros in tests
Bruno Franca [Sat, 7 Oct 2023 21:26:31 +0000 (18:26 -0300)] 
detect-ssh-proto-version: use FAIL macros in tests

Task #6337

22 months agodocs: adjust readthedocs config to new options 9575/head
Juliana Fajardini [Thu, 5 Oct 2023 16:13:27 +0000 (13:13 -0300)] 
docs: adjust readthedocs config to new options

Our documentation was failing to build, seems connected to the new way
of indicating build options (cf
https://readthedocs.org/projects/suricata/builds/22112658/,
https://docs.readthedocs.io/en/stable/config-file/v2.html#build,
and https://docs.readthedocs.io/en/stable/config-file/v2.html#build-os).

Added the build.os required new field, and adjusted the way python
version is passed.

For the new configuration style for read the docs, one of the ways to
pass extra configuration for python is having a requirements file.

22 months agorust: update brotli decompressor crate
Philippe Antoine [Tue, 3 Oct 2023 09:19:02 +0000 (11:19 +0200)] 
rust: update brotli decompressor crate

cf https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59687

22 months agooutput/email: use SCCalloc for OutputJsonEmailCtx
Shivani Bhardwaj [Wed, 4 Oct 2023 07:44:41 +0000 (13:14 +0530)] 
output/email: use SCCalloc for OutputJsonEmailCtx

email_ctx->fields only gets populated when smtp.custom setting is on.
The fn EveEmailLogJSONCustom is called when either
1. smtp.extended setting is on or,
2. email_ctx->fields is populated which means smtp.custom setting is on

In case neither of these are set in suricata.yaml, no call should
ideally be made to the fn EveEmailLogJSONCustom.
However, it turns out that email_ctx->fields is unset and then set only
after the smtp config was found. This leads to email_ctx->fields
sometimes contain value even when no config was given to the smtp
section and can lead to unexpected output.

Fix this by using SCCalloc while initializing OutputJsonEmailCtx struct
instead of SCMalloc.

Bug 6380

22 months agodoc/quickstart: add software-properties instruction
Juliana Fajardini [Wed, 4 Oct 2023 17:50:45 +0000 (14:50 -0300)] 
doc/quickstart: add software-properties instruction

This is indicated in the `Installation` section, but not in the
quickstart, and it felt like a valid addition, here, too.

22 months agodoc/install: link to devguide's install from git
Juliana Fajardini [Wed, 4 Oct 2023 17:47:24 +0000 (14:47 -0300)] 
doc/install: link to devguide's install from git

Although we have an updated version of instructions for installation
from git, our install guide was only referring to RedMine, which is less
up-to-date.

Kept that reference, since it might still be useful for non-Ubuntu
cases.

22 months agodoc/code-submission: add commit sign guide
Shivani Bhardwaj [Wed, 27 Sep 2023 06:36:37 +0000 (12:06 +0530)] 
doc/code-submission: add commit sign guide

22 months agoquic: v2 support per rfc 9369 9539/head
Philippe Antoine [Wed, 27 Sep 2023 11:08:33 +0000 (13:08 +0200)] 
quic: v2 support per rfc 9369

Ticket: #4968

22 months agodoc: add tcp flags documentation
Travis Green [Thu, 29 Aug 2019 04:16:28 +0000 (22:16 -0600)] 
doc: add tcp flags documentation

Signed-off-by: jason taylor <jtfas90@gmail.com>
22 months agodetect: check if signature uses too many buffers
Philippe Antoine [Wed, 27 Sep 2023 12:15:18 +0000 (14:15 +0200)] 
detect: check if signature uses too many buffers

Ticket: #6104

The approach in master branch is to change the prototype of
SigMatchAppendSMToList so that it allocates itself the new SigMatch
This approach requires to change all the 100-ish calls to
SigMatchAppendSMToList and is thus quite a big change.

For branch 7, we still wanted to avoid the buffer overflow, but
did not want such an intrusive change, and still wanted to make
the signature invalid. Instead of changing the prototype of the
function, we make it return early, and set a flag in the signature
which can be later checked by SigValidate

22 months agodetect/analyzer: add more details for ipopts
Juliana Fajardini [Thu, 14 Sep 2023 14:44:19 +0000 (11:44 -0300)] 
detect/analyzer: add more details for ipopts

In addition to the ipopts keyword name, also log the ip option that was
matched on.

Task #6348

22 months agoreadme: minor cleanups 9535/head
Jason Ish [Thu, 28 Sep 2023 22:25:41 +0000 (16:25 -0600)] 
readme: minor cleanups

22 months agoreadme: add a resources section
Jason Ish [Thu, 28 Sep 2023 22:19:51 +0000 (16:19 -0600)] 
readme: add a resources section

Consolidate a few items into a resources section, and add few more
items, most importantly the bug tracker as it can't currently be found
from our GitHub presence.

22 months agoreadme: formatting
Jason Ish [Thu, 28 Sep 2023 22:15:14 +0000 (16:15 -0600)] 
readme: formatting

Use consistent header style and wrap at 80 chars for better reading in
a terminal.

22 months agodetect: remove code writing unused values
Philippe Antoine [Thu, 28 Sep 2023 19:17:00 +0000 (21:17 +0200)] 
detect: remove code writing unused values

Coveridy ID 1546822 1546823 and 1546824

22 months agodetect/bytejump: Improve negative post_offset handling.
Jeff Lucovsky [Fri, 8 Sep 2023 14:09:52 +0000 (10:09 -0400)] 
detect/bytejump: Improve negative post_offset handling.

Issue: 4624

Handle negative post_offset values that jump before the buffer as though
they refer to the buffer start.

22 months agodetect/bytejump: Change DoMatch signature to return bool
Jeff Lucovsky [Fri, 8 Sep 2023 14:04:31 +0000 (10:04 -0400)] 
detect/bytejump: Change DoMatch signature to return bool

Issue: 4624

Change the function signature of byte-jump's domatch from an int to a
bool to avoid ambiguity handling return values.

22 months agomime: process chunk as soon as possible 9513/head
Philippe Antoine [Mon, 4 Sep 2023 13:51:16 +0000 (15:51 +0200)] 
mime: process chunk as soon as possible

In the case stream depth gets reached afterwards, it cannot be
processed after that.

Ticket: #6367

22 months agodpdk: reset stats just before the start of packet receive loop 9492/head
Lukas Sismis [Fri, 15 Sep 2023 10:15:23 +0000 (06:15 -0400)] 
dpdk: reset stats just before the start of packet receive loop

While Suricata initializes, the device must be started to e.g.
apply rte_flow rules on some devices. But in the meantime, the
NIC started receiving packets but accounted those as missed.
Stats reset was added to better represent true packet drop.

22 months agodpdk: stop devices immediately after Suricata stop command
Lukas Sismis [Fri, 15 Sep 2023 10:08:38 +0000 (06:08 -0400)] 
dpdk: stop devices immediately after Suricata stop command

To better represent port stats of Suricata stop the device
right after Suricata is deemed to shut down.
While Suricata deinitialization happened, the device kept
receiving packets. But because Suricata was no longer
interested in the packets, the device accounted these packets
as missed and it could have alter true stats of Suricata.

22 months agodetect/gen: Minor cleanup
Jeff Lucovsky [Thu, 14 Sep 2023 14:31:05 +0000 (10:31 -0400)] 
detect/gen: Minor cleanup

Issue: 5211

22 months agodetect/rule: Use de_ctx buffer id
Jeff Lucovsky [Thu, 14 Sep 2023 14:30:13 +0000 (10:30 -0400)] 
detect/rule: Use de_ctx buffer id

This commit uses the detect engine buffer id instead of the global
value.

Issue: 5211

22 months agodetect: Count buffer id once
Jeff Lucovsky [Thu, 14 Sep 2023 14:29:17 +0000 (10:29 -0400)] 
detect: Count buffer id once

This commit removes a second, unnecessary increment of the de_ctx buffer
id.

Issue: 5211

22 months agoaf-packet: fetch mtu info once
Shivani Bhardwaj [Thu, 10 Aug 2023 15:35:45 +0000 (21:05 +0530)] 
af-packet: fetch mtu info once

With the current layout and fn calls, it was seen that once in the
beginning after the MTU was found and displayed to the user, when the
threads spawned, each thread displayed MTU info as a part of
AFPPeersListAdd fn. This happened in AF_PACKET IPS mode and led to
excessive MTU logs.
Save this info in the LiveDevice struct and avoid calling the unneeded
fns later on.

Bug 5831

22 months agoutil/ioctl: use LiveDevice to retrieve name
Shivani Bhardwaj [Thu, 10 Aug 2023 15:34:56 +0000 (21:04 +0530)] 
util/ioctl: use LiveDevice to retrieve name

The fn GetIfaceMaxPacketSize now uses LiveDevice object as a param
instead of a string. This was done to keep the logic of checking for the
device to this function itself instead of having callers first determine
whether the device exists or not.
This also falls in line with the changes made to avoid excessive MTU
logs in the following commit.

Related to redmine ticket 5831.

22 months agoutil/ioctl: rename pcap_dev to dev
Shivani Bhardwaj [Thu, 10 Aug 2023 16:24:39 +0000 (21:54 +0530)] 
util/ioctl: rename pcap_dev to dev

22 months agoutil/ioctl: cut vain check on GetIfaceMaxHWHeaderLength
Shivani Bhardwaj [Wed, 13 Sep 2023 09:50:38 +0000 (15:20 +0530)] 
util/ioctl: cut vain check on GetIfaceMaxHWHeaderLength

22 months agoconf: check if node value is Null
Shivani Bhardwaj [Thu, 3 Aug 2023 09:48:51 +0000 (15:18 +0530)] 
conf: check if node value is Null

Bug: #6303, #6302

22 months agoconf: fix include handling from arrays
Jason Ish [Thu, 7 Sep 2023 17:53:55 +0000 (11:53 -0600)] 
conf: fix include handling from arrays

Includes from an "include" array were being loaded into the wrong
parent as the logic for array handing in include context was not
updated.

If we are descending into an array in include context, pass through
the current parent so the included configuration is included where it
is expected.

Bug: #6300

22 months agostats: Track stream reassembly drops
Jeff Lucovsky [Tue, 22 Aug 2023 14:17:24 +0000 (10:17 -0400)] 
stats: Track stream reassembly drops

Issue: 6235

22 months agoversion: start development towards 7.0.2
Victor Julien [Thu, 14 Sep 2023 12:22:04 +0000 (14:22 +0200)] 
version: start development towards 7.0.2

22 months agorelease: 7.0.1; update changelog suricata-7.0.1
Juliana Fajardini [Wed, 13 Sep 2023 14:47:03 +0000 (11:47 -0300)] 
release: 7.0.1; update changelog

22 months agosmtp: fix null deref with config option body md5
Philippe Antoine [Wed, 30 Aug 2023 19:35:08 +0000 (21:35 +0200)] 
smtp: fix null deref with config option body md5

Ticket: #6279

If we have the smtp body beginning without headers, we need to
create the md5 context and right away and supply data to it.
Otherwise, on the next line being processed, md5_ctx will be
NULL but body_begin will have been reset to 0

22 months agospm/hs: don't exit on bad patterns
Victor Julien [Tue, 5 Sep 2023 12:49:34 +0000 (14:49 +0200)] 
spm/hs: don't exit on bad patterns

A bad pattern in a rule that hyperscan would fail to compile would
exit Suricata. This could happen during a rule reload as well.

In case of a untrusted ruleset, this could potentially be used to
shut down the sensor.

Commit 7d0851b0c2 already blocks the only know case, but this patch
is more defensive.

Ticket: #6195.

23 months agoreadthedocs: pin theme to sphinx_rtd_theme 9449/head
Jason Ish [Wed, 6 Sep 2023 14:51:49 +0000 (08:51 -0600)] 
readthedocs: pin theme to sphinx_rtd_theme

ReadTheDocs changed the default theme.

23 months agoconfigure: more idiomatic autoconf for sphinx-build checks
Jason Ish [Tue, 5 Sep 2023 21:16:43 +0000 (15:16 -0600)] 
configure: more idiomatic autoconf for sphinx-build checks

- Use SPHINX_BUILD instead of HAVE_SPHINX_BUILD, as here we're
  actually using the path of the program.

- Wrap some elements in [] as is done in modern idiomatic autoconf

23 months agoconfigure: check for new enough sphinx-build
Jason Ish [Tue, 5 Sep 2023 21:06:24 +0000 (15:06 -0600)] 
configure: check for new enough sphinx-build

We need a recent version of Sphinx to build the documentation in
7.0. Check for a minimum version of 3.4.3. If older, do not build the
docs which is the same behavior when sphinx-build is not found.

Bug: #6297

23 months agofuzz: enable by default all protocols
Philippe Antoine [Wed, 6 Sep 2023 11:22:42 +0000 (13:22 +0200)] 
fuzz: enable by default all protocols

That means DNP3, ENIP and NFS

Ticket: #6189

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.