Commit Graph

15387 Commits (edfda9f69fb2f095a195860b382eed94655238be)
 

Author SHA1 Message Date
Victor Julien c1b920d056 storage: use proper type instead of void ptr 1 year ago
Victor Julien 69f61c0028 storage: remove unused code
Only used in a unittest; removed that as well.
1 year ago
Philippe Antoine 9c3ab36afc source: fix resource leak
CID: 1426081
1 year ago
Philippe Antoine 5954a91457 detect/filestore: fix memory leak on sig parsing
Ticket: 6574

Introduced by commit c272a646c5
1 year ago
Victor Julien d005fff7b9 stats: improve sync signalling
Make syncs more reliable by using a atomic "sync now" variable and
signalling the conditions under lock.

Ticket: #6569.
1 year ago
Victor Julien 74bc27ecd5 stats: turn sync macros into functions 1 year ago
Victor Julien 3107a4953d flow: fix condition signalling
Signal threads while holding lock. This should make the signalling
more reliable.

From PTHREAD_COND(3):

"Unlocking the mutex and suspending on the condition variable is done
 atomically. Thus, if all threads always acquire the mutex before
 signaling the condition, this guarantees that the condition cannot be
 signaled (and thus ignored) between the time a thread locks the
 mutex and the time it waits on the condition variable."

Ticket: #6569.
1 year ago
Victor Julien 487b78fb3d ippair: fix minor coverity warning
CID 1554232:  Data race undermines locking  (LOCK_EVASION)

Ticket #6565.
1 year ago
Victor Julien 1f7e61ef61 host: fix minor coverity warning
CID 1554240:  Data race undermines locking  (LOCK_EVASION)
1 year ago
Philippe Antoine 3a79984e5e detect/xbits: fix coverity warning
CID 1554237 and CID 1554233

Basically make the code easier to reason with for coverity
without changing the behavior which was fine.
1 year ago
Victor Julien 41c0526fdc packetpool: signal condition within lock
Completes: dc40a139ac ("packetpool: signal waiter within lock")
1 year ago
Victor Julien edc89ce791 packetpool: dynamic return threshold
Problem:

In pcap autofp mode, there is one threads reading packets (RX). These packets
are then passed on to worker threads. When these workers are done with a
packet, they return packets to the pcap reader threads packet pool, which is
the owner of the packets. Since this requires expensive synchronization between
threads, there is logic in place to batch this operation.

When the reader thread depletes its pool, it notifies the other threads that
it is starving and that a sync needs to happen asap. Then the reader enters
a wait state. During this time no new packets are read.

However, there is a problem with this approach. When the reader encountered
an empty pool, it would set an atomic flag that it needed a sync. The first
worker to return a packet to the pool would then set this flag, sync, and
unset the flag. This forced sync could result in just a single packet being
synchronized, or several. So if unlucky, the reader would just get a single
packet before hitting the same condition again.

Solution:

This patch updates the logic to use a new approach. Instead of using a
binary flag approach where the behavior only changes when the reader is
already starved, it uses a dynamic sync threshold that is controlled by
the reader. The reader keeps a running count of packets it its pool,
and calculates the percentage of available packets. This percentage is
then used to set the sync threshold.

When the pool is starved, it sets the threshold to 1 (sync for each packet).
After each successful get/sync the threshold is adjusted.
1 year ago
Jeff Lucovsky ec1482cf48 calloc: Use nmemb with SCCalloc
This commit modifies calls to SCCalloc that had a member count of 1 and
a size count calculated as: element_count * sizeof(element).
1 year ago
Jeff Lucovsky 193e0ea1a9 memory/alloc: Use SCCalloc instead of malloc/memset 1 year ago
Philippe Antoine c272a646c5 detect: SigMatchAppendSMToList can fail
Ticket: #6104

And failures should be handled to say that the rule failed to load

Reverts the fix by 299ee6ed55
that was simple, but not complete (memory leak),
to have this bigger API change which simplifies code.
1 year ago
Philippe Antoine e38b9de6a2 output/krb5: have krb5 properties in alerts
Ticket: 5977
1 year ago
Philippe Antoine 8a09bff0aa output/tftp: have tftp properties in alerts
Ticket: 6501
1 year ago
Philippe Antoine 3b1b163ee6 output/ftp: have ftp properties in alerts
Ticket: 6500
1 year ago
Philippe Antoine 0b6b015e26 output/alert: rewrite code for app-layer properties
Especially fix setup-app-layer script to not forget this part

This allows, for simple loggers, to have a unique definition
of the actual logging function with the jsonbuilder.
This way, alerts, files, and app-layer event can share the code
to output the same data.

Ticket: #3827
1 year ago
Philippe Antoine 90c17652a3 rust: remove unused
Ticket: #4083
1 year ago
Philippe Antoine 32cce122e1 detect: header_lowercase transform
Ticket: 6290
1 year ago
Joseph Reilly 55a4e12884 af-xdp: detach XDP program early
To mitigate a bug with AF_XDP sockets in high traffic scenarios, the XDP program must be detatched before
the sockets are closed. This issue happens when large ammounts of traffic are sent to suricata and
the XDP program is not removed before AF_XDP sockets are closed. I believe this is a race
condition bug as detailed here: https://bugzilla.kernel.org/show_bug.cgi?id=217712

Further investigation shows this may be a bug exclusive to the driver/AMD processor combination.

This commit addresses the bug by ensuring the first thread to run the deinit function
removes the XDP program, which fixes the bug as detailed in the bugzilla link.

Bug #6238
1 year ago
Eric Leblond 180459eeb6 detect/stream_size: fix prefiltering registration
Ticket: #6551
1 year ago
jason taylor c50002978d doc: update file.data keyword documentation
Signed-off-by: jason taylor <jtfas90@gmail.com>
1 year ago
Thomas Winter 7d40a9f178 rule-reload: Release excess memory freed during engine reload
The hot reload results in large chunks of memory being freed as the
as the old signature tables are discarded. Help the memory management
system along by telling to release as much memory as it can at this
point.

Bug: #6454.
1 year ago
Jason Ish d2b25af3f4 examples: add an example plugin of an eve filetype
This is an example of what adding plugin examples to the Suricata repo
could look like.

This plugin is an example plugin for an EVE filetype. It could be
extended to support outputs like Redis, syslog, etc.

There is one issue with adding plugins like this to an autotools
project, the project can't be built with --disable-shared, which is
more of an autotools limitation, and not really a Suricata issue.
Suricata built with --disable-shared will load plugins just fine.

Note that the examples directory was added as DIST_SUBDIRS as we don't
want normal builds to recurse into it and attempt to build the plugin,
its just an example, but we still need to keep distcheck happy.
1 year ago
Juliana Fajardini a649a92afd userguide: update tls not_after/not_before mentions
Our tls fields not_after and not_before are actually logged as
`notafter` and `notbefore`, but were documented with the underscore.

Update the documentation, since updating the log format itself would be
a breaking change.

Task #5494
1 year ago
Juliana Fajardini 58fb559594 userguide: document flow_id, with examples
Flow_id explanation expanded from version shared by Peter Manev.

Task #6445
1 year ago
Jason Ish bec1d8ca9f github-ci: don't add author names/emails to new author comment
The new author details will still be available in the artifact, we're
just not calling them out in a nighly visible pull request comment.
1 year ago
Jason Ish 2b9603d94d github-ci: cancel previous builds workflow for branch
On a push of the same branch, cancel the previous running builds.yml
workflow.
1 year ago
Jeff Lucovsky 924c59448f bool: Remove TRUE/FALSE 1 year ago
Jeff Lucovsky 36e5792501 debug/bool: Switch use_color to a bool 1 year ago
Jeff Lucovsky 0a716afadc run/bool: Use bool for threading value 1 year ago
Jeff Lucovsky 28c950cef5 htp/bool: Use bool instead of int 1 year ago
Jeff Lucovsky 84b2d665d6 detect/bool: Use bool type for unittests 1 year ago
Jeff Lucovsky 8f2a3ea7be prefilter/bool: Use bool values for is_last 1 year ago
Jeff Lucovsky d2c46110d6 pcap/bool: Use bool type for is_private 1 year ago
Jeff Lucovsky 2016d68f41 stream/bool: Use bool for StreamTcpInlineMode 1 year ago
Jeff Lucovsky 9bd2b7425d general/bool: Change Suricata int to bool
Change Suricata operational values from int to bool.
1 year ago
Jeff Lucovsky 051a14acd3 general/bool: Use bool for file support 1 year ago
Jeff Lucovsky 310dcd1dc4 general: Use bool instead of int for condition fns
This commit changes the conditional logging functions to use bool rather
than int values.
1 year ago
Comfort Amaechi 491f5dcc31 util-memcmp: Convert unittests to new FAIL/PASS API
Ticket: #6107
1 year ago
Sascha Steinbiss d07e7f6862 detect: fix typo 1 year ago
Sascha Steinbiss 0c55fe3515 detect: add mqtt.connect.protocolstring
Ticket:  OISF#6396
1 year ago
Victor Julien 68a2fcaad3 mpm: thread ctx cleanups
Remove unused thread ctx' from AC variants

Use single thread store in detection.

Minor cleanups.
1 year ago
Victor Julien 3b826fff68 detect/tag: reuse result of previous host lookup
Minor optimization that could lead to a reduction in host table
lookups if more than one host feature is in use.
1 year ago
Victor Julien 6b2c33990f doc/userguide: add tag keyword page
Ticket: #3015.
1 year ago
Victor Julien 4a02a14df1 doc/userguide: document host table yaml settings 1 year ago
Victor Julien 3cad7cfa56 unittests: free packet using PacketFree
Update SigTest17 which left a dangling pointer.
1 year ago
Victor Julien 4a079541b2 detect: fix inspect engine return codes
Use proper inspect engine codes instead of bool.
1 year ago