Commit Graph

43 Commits (0d2268ddfcc65462a53fc7f27dcc68ae87c8ecf8)

Author SHA1 Message Date
Victor Julien 6626382089 reputation: spelling 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
Philippe Antoine 62352ad030 src: fix remaining cppclean warnings 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.
4 years ago
Philippe Antoine 5790280c95 utils: fix integer warnings in r files
Ticket: 4516
4 years ago
Victor Julien 172d2b28a5 iprep: unify free handling
Introduce a new util function to free a Hosts iprep code. It also
handles the Host use_cnt decrement.

This change makes sure we also decrement the use_cnt when cleaning
up when shutting down the host table.

Move the BUG_ON check for use_cnt into the HostClearMemory() func
to check it in more cases.
4 years ago
Victor Julien 7b03e6837e detect/iprep: fix loading of mixed ipv4/ipv6 lists
Improper reuse of the address data structure between loading
different lines in the iprep file would lead to the host using
a malformed address.
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.
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
Giuseppe Longo c63fea8d0a reputation: remove dead code
This removes some code commented long time ago.
7 years ago
Giuseppe Longo 6b2a5ef21e reputation: declare max value as constant 7 years ago
Giuseppe Longo d0e2420faf reputation: move unit tests
UTs are moved inside "test/" directory,
and reworked to improve readability and reduce lines of code.
7 years ago
Victor Julien 961610489a iprep: small cleanups 8 years ago
Victor Julien 5740c79b93 iprep: improve error checking of path handling 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
Victor Julien 65d2443ccd reputation: fix -Wshadow warnings 10 years ago
Victor Julien b3bf7a5729 output: introduce config and perf output levels
Goal is to reduce info output
10 years ago
maxtors 9d3fd82849 Removed duplicate include statements. 10 years ago
Jason Ish 796dd5223b tests: no longer necessary to provide successful return code
1 pass, 0 is fail.
10 years ago
Victor Julien 4ee20f2649 asan: fix reputation code include 10 years ago
Tom DeCanio 97a2d1ac26 fix reputation parser so that it accepts ipv6 addresses in configuration file. 11 years ago
Victor Julien 033409a042 iprep: cleanup ctx on shutdown
~~Dr.M~~ Error #1: LEAK 480 direct bytes 0x0aae7fc0-0x0aae81a0 + 0 indirect bytes
~~Dr.M~~ # 0 replace_malloc                    [/work/drmemory_package/common/alloc_replace.c:2373]
~~Dr.M~~ # 1 SRepInit                          [.../Suricata/src/reputation.c:594]
~~Dr.M~~ # 2 DetectEngineCtxInit               [.../src/detect-engine.c:844]
~~Dr.M~~ # 3 main                              [.../Suricata/src/suricata.c:2230]
12 years ago
Giuseppe Longo 395d5b7f61 iprep: add unit tests for cidr
Implements unit tests to test the new API
12 years ago
Giuseppe Longo a1d8439b25 iprep: extends cidr support
Implements new API to expand the IP reputation
to netblocks with CIDR notation

A new object 'srepCIDRTree' is kept in the DetectionEngineCtx,
which contains two tree (one for ipv4 and one for ipv6)
where the reputation values are stored.
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
Victor Julien fd193107de unused reputation: radix update
Update the unused reputation code to compile after radix update.
12 years ago
Victor Julien 64203be3ba iprep: fix reputation loading and reloading
When an IP is listed in multiple categories, each new "load" would clear the
previous loads for that IP.

Bug #976
13 years ago
Duarte Silva 0a5c798729 Now using the common functions
- Removed some non printable ANSI characters
- Removed unecessary include
13 years ago
Victor Julien 98dbf3e62c Coverity 1038113: possibly out of bounds read 13 years ago
Victor Julien 274641abc2 Fix valgrind error/warning in ip reputation parsing code 13 years ago
Victor Julien 8924d7598d Fix potential iprep file parsing issue (2). 13 years ago
Victor Julien 754ae8a1be Fix potential iprep file parsing issue. 13 years ago
Victor Julien 40bbf96f22 reputation: don't give error if config is missing/commented out 14 years ago
Victor Julien 83bfe3810b reputation: report error if host table memcap reached. Work around compilation failure with atomic fallback code. 14 years ago
Victor Julien e30b1bfe64 Simple IP reputation implementation 14 years ago
Victor Julien 426a7de5f2 Fix compiler warning about incomplete prototype (2). 16 years ago
Gerardo Iglesias Galvan 9f4fae5b1a Fix inconsistent use of dynamic memory allocation 16 years ago
William Metcalf ce01927515 Import of GPLv2 Header 050410 16 years ago
Pablo Rincon e7a989e305 IP Only Engine using radix trees 16 years ago
Pablo Rincon 25a3a5c6d8 Adding mem wrapper to debug runtime alloc()/free() functions. Fixing some memory leaks. 16 years ago
Pablo Rincon ad2c136e8f Renaming errors (naming conventions) 16 years ago
Pablo Rincon 260e581929 First version of the reputation API 16 years ago