Commit Graph

199 Commits (b591813b8690753ee4a678f8b10ff1928de1fe15)

Author SHA1 Message Date
Victor Julien b591813b86 profiling/rules: reduce sync logic scope
Use a simple once a second scheme.
3 years ago
Eric Leblond 75b46edd79 profiling: add 'ruleset-profile' unix command
This patch adds a new unix command that allows the user to trigger
a dump of the ruleset profile to the file without having to stop
Suricata.

This will be really useful to debug performance issue related to
signatures in production environment.
3 years ago
Victor Julien 61b90ca4d5 stats: spelling 3 years ago
Victor Julien ebd8728219 src: fix strict-prototype warnings
Tested on Fedora 37 with clang 15.

app-layer.c:1055:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerSetupCounters()
                          ^
                           void
app-layer.c:1176:29: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
void AppLayerDeSetupCounters()
                            ^
                             void
2 errors generated.
3 years ago
Victor Julien b31ffde6f4 output: remove error codes from output 3 years ago
Victor Julien 39f5c7f56a error: use SC_EINVAL for invalid input 3 years ago
Victor Julien e042cd785e error: use SC_ENOMEM for alloc errors 3 years ago
Richard McConnell 13beba141c source: add THV_RUNNING flag to notify of running state
Each module (thread) updates its status to indicate running.
Main thread awaits for all threads to be in a running state
before continuing the initialisation process

Implements feature 5384
(https://redmine.openinfosecfoundation.org/issues/5384)
3 years ago
Victor Julien 39cf5b151a src: includes cleanup
Work towards making `suricata-common.h` only introduce system headers
and other things that are independent of complex internal Suricata
data structures.

Update files to compile after this.

Remove special DPDK handling for strlcpy and strlcat, as this caused
many compilation failures w/o including DPDK headers for all files.

Remove packet macros from decode.h and move them into their own file,
turn them into functions and rename them to match our function naming
policy.
3 years ago
Victor Julien aa31d2193f counters: add StatsDecr 3 years ago
Victor Julien ce4e543719 threading: simplify thread name logic 4 years ago
Philippe Antoine eb189e805a src: use u8_tolower everywhere
Ticket: 4516

Instead of basic to_lower to get the cast to avoid warning
about integer

Sames goes for u8_toupper
4 years ago
Juliana Fajardini b3743cf5c0 unittests (assorted): remove PASS_IF macro
Also small documentation clean up and test adjusments where that
was needed.

affected: counters, decode-vntag, detect-mark

Related to #4795
4 years ago
Shivani Bhardwaj a17da8374a counters: only print alerts if stats are enabled 4 years ago
Jeff Lucovsky 1eeb96696b general: Cleanup bool usage 5 years ago
Shivani Bhardwaj 6c19e7d0d4 counters: convert to FAIL/PASS API 5 years ago
Shivani Bhardwaj 6f7d8e50c8 src: use FatalError whenever possible
Replaces all patterns of SCLogError() followed by exit() with
FatalError(). Cocci script to do this:

@@
constant C;
constant char[] msg;
@@

- SCLogError(C,
+ FatalError(SC_ERR_FATAL,
  msg);
- exit(EXIT_FAILURE);

Closes redmine ticket 3188.
5 years ago
Victor Julien 26bcc97515 detect/keywords: dynamic version part of doc URL 6 years ago
Shivani Bhardwaj e7c0f0ad91 src: remove multiple uses of atoi
atoi() and related functions lack a mechanism for reporting errors for
invalid values. Replace them with calls to the appropriate
ByteExtractString* functions.

Partially closes redmine ticket #3053.
6 years ago
Victor Julien 27186778b8 fuzz: allow uninitialized stats api 6 years ago
Philippe Antoine 293eebd999 fuzz: remove obsolete AFL code 6 years ago
Victor Julien 550cfdd98d threading: hide 'trans_q' from queue handlers 6 years ago
Victor Julien 76e1836aed counters: improve handling missing global config
Improve warnings when eve.stats can't work because of the global config
missing or disabled.

Issue warning if global config is missing but stats are still enabled due
to the legacy stats.log.

Issue clearer warning when stats are disabled and unix socket dump-counters
command is issued.

Warnings include links to docs.

Bug #2465.
6 years ago
Victor Julien 2d381f93f3 stats: add global way to check if API is enabled 6 years ago
Shivani Bhardwaj 59da7ae302 counters: Add new default for decoder events
Set the new default for decoder events to `decoder.event` instead of the
previously used `decoder`. Remove the corresponding warning for 5.0.
6 years ago
Victor Julien e6b633cf95 stats: walk tv_root under lock 7 years ago
Victor Julien 9474b84683 stats: more accurate time handling for wakeup thread 7 years ago
Victor Julien ab1268cfea stats: minor code cleanups 7 years ago
Victor Julien fb18a1655c eve.stats: warn that output might miss decoder-events 7 years ago
Victor Julien 0d86263efd eve.stats: make decoder event prefix configurable 7 years ago
Victor Julien 31f81429c2 stats: more accurate interval handling
In the stats loop sleep for a time period more closely matching
the stats.interval setting. Fix an off by one that would make
the loop wake up ~1 second early.

Bug #2716
7 years ago
Victor Julien 4f84672d7c stats: decoder/stream events as stats 7 years ago
Maurizio Abba 1bdf325a9a signal: use centralized pthread_sigmask for signals
according to its man page, sigprocmask has undefined behavior in
multithreaded environments. Instead of explictly blocking the handling
of SIGUSR2 in every thread, direct block handling SIGUSR2 before
creating the threads and enable again the handling of this signal
afterwards. In this way, only the main thread will be able to manage
this signal properly.
8 years ago
Victor Julien 895df9a6f6 mingw: fix use of undefined USR2 signal 8 years ago
Sascha Steinbiss d9c7f9bb17 stats: use unshortened interface names in counters 8 years ago
Victor Julien 52b39a41e0 stats: print alert count at shutdown
Bug #1855.
8 years ago
Victor Julien ab1200fbd7 compiler: more strict compiler warnings
Set flags by default:

    -Wmissing-prototypes
    -Wmissing-declarations
    -Wstrict-prototypes
    -Wwrite-strings
    -Wcast-align
    -Wbad-function-cast
    -Wformat-security
    -Wno-format-nonliteral
    -Wmissing-format-attribute
    -funsigned-char

Fix minor compiler warnings for these new flags on gcc and clang.
9 years ago
Eric Leblond f2d1e93e65 unix-socket: add auto mode
When running in live mode, the new default 'auto' value of
unix-command.enabled causes unix-command to be activated. This
will allow users of live capture to benefit from the feature and
result in no side effect for user running in offline capture.
9 years ago
Zachary Rasmor 68cfa009a0 Update thread creation and threads to use global thread names.
Thread name is now stored as a static string buffer,
string duplication and alloc/de-alloc is no longer required.
10 years ago
Victor Julien a42251d459 afl: add define to disable mgt threads
The inherent non-deterministic nature of the management threads
creates variable test cases.
10 years ago
Jason Ish da1dec6d65 counters: use some of the new macros in tests 10 years ago
Jason Ish 796dd5223b tests: no longer necessary to provide successful return code
1 pass, 0 is fail.
10 years ago
Jason Ish 52983bf314 tests: convert all test to return 0 on failure, 1 on success 10 years ago
Victor Julien a70ff19911 stats: fix unix socket crash
Reset counters_global_id at ctx destruction. In the unix socket
runmode the lack of this reset would cause the id's to increase with
each pcap, leading to an ever larger stats array.
10 years ago
Victor Julien acaf8a84e8 stats: fix dump-counters when no loggers are active 10 years ago
Victor Julien 14030239f8 unix-socket: restore dump-counters functionality
Create a eve.stats like output for dump-counters.
10 years ago
Victor Julien 6c30f7bdbb counters: fix thread stats delta logging
Just like with the global stats, store prev values. Fixes delta logging.
10 years ago
Victor Julien 21db5ee691 counters: reduce global usage 11 years ago
Victor Julien 07efec550d counters: use ptr to name instead of copy
All counters have hardcoded names, so copies are not needed.
11 years ago
Victor Julien 7e66c70507 counters: don't run if no counters have been registered 11 years ago