Commit Graph

48 Commits (06b70817b268e7a0104f0cfa5038376d9b07cffb)

Author SHA1 Message Date
Philippe Antoine de335ba98a src: do not include "util-time.h" directly
It is included in suricata-common.h

Ticket: 945
3 weeks ago
Jason Ish b3d45e5507 profiling: log rule profiling as json by default
We've been forcing JSON logging in our default configuration for some
time now, just make it the actual default.
10 months ago
Jason Ish 22b77b0c56 conf: prefix conf API with SC 2 years ago
Victor Julien 855cc89636 profiling: allow absolute paths
Ticket #6490.
2 years 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).
3 years ago
Jeff Lucovsky 193e0ea1a9 memory/alloc: Use SCCalloc instead of malloc/memset 3 years ago
Philippe Antoine 805b07fa42 src: checks to avoid divisions by zero
Ticket: #5920
3 years ago
Victor Julien 835eaf7ccd profiling/rules: minor code cleanup 4 years ago
Eric Leblond df88ef0249 profiling: let 'ruleset-profile' send message
Let's send the profile output as an answer on the Unix socket.
4 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.
4 years ago
Eric Leblond 020cfbcd61 profiling: introduce rules profiling
Performance measurement of rules is important on live Suricata
as bad rules can cause severe performance regression. This patch
introduces the --enable-profiling-rules that activate profiling
for the rules. This reduces the performance impact of full
profiling  and provide visiblity on the rules performance at
the same time.
4 years ago
Jeff Lucovsky 31793aface time: Replace struct timeval with scalar value
Issue: 5718

This commit switches the majority of time handling to a new type --
SCTime_t -- which is a 64 bit container for time:
- 44 bits -- seconds
- 20 bits -- useconds
4 years ago
Victor Julien b31ffde6f4 output: remove error codes from output 4 years ago
Victor Julien e042cd785e error: use SC_ENOMEM for alloc errors 4 years ago
Simeon Miteff 6673846481 profiling: Make rule_perf.log JSON output newline-delimited
Adding a newline makes the output valid JSON when multiple sortings of
the rules profile object are written to the log.
4 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.
4 years ago
Philippe Antoine 36b1344680 util: fix integer warnings in profiling 4 years ago
Philippe Antoine 02f2602dde src: rework includes as per cppclean 4 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.
6 years ago
Shivani Bhardwaj 0e4f261224 Use StringParse* for all parsers and configurations 7 years ago
Victor Julien edd2cd626f jansson: remove HAVE_LIBJANSSON guards 7 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.
10 years ago
Victor Julien 75907fce06 profiling: output all sort options for rules
Limit the default number of sids to 10.
10 years ago
Victor Julien 7d8a5a75ef profiling: honor limit in json rule output 10 years ago
Victor Julien addf64f1f7 profiling: fix memory leaks 10 years ago
Victor Julien b3bf7a5729 output: introduce config and perf output levels
Goal is to reduce info output
11 years ago
Victor Julien e11753e3f2 profiling: fix minor compiler warning 11 years ago
Eric Leblond 606ac17c57 util: get rid of json_array_append
This function is causing a memleak because it is necessary to clean
up after usage.

This fixes at least:

37 (32 direct, 5 indirect) bytes in 1 blocks are definitely lost in loss record 104 of 394
   at 0x4C29C0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x66D0C7B: ??? (in /usr/lib/x86_64-linux-gnu/libjansson.so.4.7.0)
   by 0x943584: LiveDeviceIfaceList (util-device.c:264)
   by 0x910889: UnixCommandExecute (unix-manager.c:486)
   by 0x910D7E: UnixCommandRun (unix-manager.c:545)
   by 0x911193: UnixMain (unix-manager.c:593)
   by 0x913CC7: UnixManager (unix-manager.c:961)
   by 0x907753: TmThreadsManagement (tm-threads.c:600)
   by 0x68DE283: start_thread (pthread_create.c:333)
   by 0x80A6A4C: clone (in /lib/x86_64-linux-gnu/libc-2.21.so)
11 years ago
Victor Julien 3f3ed71fe7 jansson: cleanup JSON_ESCAPE_SLASH use 11 years ago
Victor Julien c1bf0e1b07 rule profiling: json output 11 years ago
Victor Julien b03c288d9a profiling: cleanup, remove MIN declaration 11 years ago
Victor Julien 91ddf85323 profiling: fix sorting on very long runs
Fix poor int handling breaking sorts of profiling on long runs
where the numbers could get really big.
12 years ago
Ken Steele 8f1d75039a Enforce function coding standard
Functions should be defined as:

int foo(void)
{
}

Rather than:
int food(void) {
}

All functions where changed by a script to match this standard.
12 years ago
Eric Leblond d6932f90db doxygen: document some functions 13 years ago
Victor Julien 8ffa30dd88 profiling: don't init rule profiling ctx if rule profiling is disabled 13 years ago
Victor Julien 6f450785fc profiling: properly clean up thread local memory. 13 years ago
Victor Julien eca1a8d73a profiling: don't alloc 0 bytes block if no rules are used 13 years ago
Ken Steele d4dd18eb85 Clean up SCLocalTime() usage
Remove cast of return type from SCLocalTime() as it is not needed.
Replace last use of localtime_r() with SCLocalTime().
13 years ago
Eric Leblond 34abd818dd Prefix util-conf function with Config 13 years ago
Eric Leblond 54006de40c Use new function GetLogDirectory() 13 years ago
Victor Julien 72782e5a6a profiling: fix rule profiling output sometimes missing sid,rev,gid. Bug #576. 14 years ago
Victor Julien ee5d6fdb6f profiling: fix some profiling info missing from output 14 years ago
Eric Leblond e176be6fcc Use unlikely for error treatment.
When handling error case on SCMallog, SCCalloc or SCStrdup
we are in an unlikely case. This patch adds the unlikely()
expression to indicate this to gcc.

This patch has been obtained via coccinelle. The transformation
is the following:

@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc)";
@@

x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1
14 years ago
Eric Leblond 655577cbbc Add some missing checks of SCMalloc return. 14 years ago
Victor Julien 1f92307517 profiling: minor cleanup 14 years ago
Victor Julien 3da3e3264c profiling: make sure counters are reset after a reload. 14 years ago
Victor Julien 2343ff8950 profiling: fix memory error in case of rule reload. 14 years ago
Victor Julien ec7e79c748 Rule profiling update
- Remove usage of counters api.
- Store stats in detect engine thread ctx to remove locking
- Support rule reloads
14 years ago