]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
9 years agoAdded parsing and utilization of yaml defined payload buffer value. 2021/head
maxtors [Fri, 22 Apr 2016 18:15:21 +0000 (20:15 +0200)] 
Added parsing and utilization of yaml defined payload buffer value.

9 years agoAdded payload-buffer-size option to yaml configuration
maxtors [Fri, 22 Apr 2016 17:18:40 +0000 (19:18 +0200)] 
Added payload-buffer-size option to yaml configuration

9 years agolua: print lua script func/line/file in SCLog* funcs 2020/head
Victor Julien [Thu, 11 Feb 2016 17:10:00 +0000 (18:10 +0100)] 
lua: print lua script func/line/file in SCLog* funcs

Instead of printing the func/line/file of the C code SCLog* wrappers,
print them from inside the lua script. They are not always available.

9 years agoQA: --afl-rules for faster rule fuzzing
Victor Julien [Fri, 15 Apr 2016 05:47:55 +0000 (07:47 +0200)] 
QA: --afl-rules for faster rule fuzzing

9 years agopcap: small cleanups
Victor Julien [Fri, 15 Apr 2016 10:26:40 +0000 (12:26 +0200)] 
pcap: small cleanups

9 years agodns: don't read uninitialized memory in name parsing 2007/head
Victor Julien [Thu, 14 Apr 2016 07:46:56 +0000 (09:46 +0200)] 
dns: don't read uninitialized memory in name parsing

AFL+ASAN found that with certain input we used an uninitialized byte
in the length calculation. Probably harmless as the length was still
validated afterwards.

9 years agostream-tcp: improve test function cleanup
Victor Julien [Wed, 13 Apr 2016 08:14:35 +0000 (10:14 +0200)] 
stream-tcp: improve test function cleanup

9 years agostream-tcp: introduce stream cleanup function
Victor Julien [Wed, 13 Apr 2016 08:13:50 +0000 (10:13 +0200)] 
stream-tcp: introduce stream cleanup function

9 years agostream-tcp: unify ssn clean up functions
Victor Julien [Wed, 13 Apr 2016 07:46:18 +0000 (09:46 +0200)] 
stream-tcp: unify ssn clean up functions

There were 2 separate function doing ssn cleanup. To prevent issues
common with code duplication, unify them.

9 years agocapture: only check for faster methods on -i 2006/head
Victor Julien [Tue, 12 Apr 2016 10:30:20 +0000 (12:30 +0200)] 
capture: only check for faster methods on -i

Also, since we now default to AF_PACKET for -i if available, only check
for PF_RING and NETMAP.

9 years agocommandline: add -i arg check
Victor Julien [Sat, 7 Nov 2015 22:50:17 +0000 (23:50 +0100)] 
commandline: add -i arg check

9 years agocommandline: use afpacket for -i if available
Victor Julien [Sun, 8 Nov 2015 09:02:31 +0000 (10:02 +0100)] 
commandline: use afpacket for -i if available

9 years agopcap: unify -i and --pcap parsing
Victor Julien [Sun, 8 Nov 2015 09:02:11 +0000 (10:02 +0100)] 
pcap: unify -i and --pcap parsing

9 years agocommandline: move afpacket parsing into util func
Victor Julien [Sat, 7 Nov 2015 18:28:49 +0000 (19:28 +0100)] 
commandline: move afpacket parsing into util func

9 years agocommandline: move pcap parsing into util func
Victor Julien [Sat, 7 Nov 2015 18:03:48 +0000 (19:03 +0100)] 
commandline: move pcap parsing into util func

9 years agoinstance: add progname as ptr to argv[0]
Victor Julien [Sat, 7 Nov 2015 18:07:40 +0000 (19:07 +0100)] 
instance: add progname as ptr to argv[0]

9 years agoreadme: initial readme for github
Victor Julien [Tue, 12 Apr 2016 16:54:06 +0000 (18:54 +0200)] 
readme: initial readme for github

9 years agoconfigure: don't use AC_DISABLE_SHARED as it breaks OSX
Victor Julien [Wed, 13 Apr 2016 07:08:59 +0000 (09:08 +0200)] 
configure: don't use AC_DISABLE_SHARED as it breaks OSX

9 years agoafl: add support for AFL PERSISTANT_MODE
Mats Klepsland [Tue, 12 Apr 2016 10:07:43 +0000 (12:07 +0200)] 
afl: add support for AFL PERSISTANT_MODE

Add support for AFL PERSISTANT_MODE when Suricata is compiled with
a supported compiler (only afl-clang-fast for now).

This gives a ~10x performance boost when fuzzing.

9 years agoQA: add --afl-der=<file>
Mats Klepsland [Sun, 10 Apr 2016 11:41:02 +0000 (13:41 +0200)] 
QA: add --afl-der=<file>

Expose SSL/TLS certificate decoding (DER) to commandline
using --afl-der=<file>.

9 years agoQA: add --afl-decoder-ppp=<file>
Victor Julien [Tue, 29 Mar 2016 16:18:20 +0000 (18:18 +0200)] 
QA: add --afl-decoder-ppp=<file>

9 years agoQA: expose Mime decoding API to commandline using --afl-mime=<file>
Victor Julien [Fri, 25 Mar 2016 13:25:22 +0000 (14:25 +0100)] 
QA: expose Mime decoding API to commandline using --afl-mime=<file>

9 years agoQA: direct access from commandline to AppLayer API
Victor Julien [Fri, 11 Mar 2016 11:00:22 +0000 (12:00 +0100)] 
QA: direct access from commandline to AppLayer API

This patch introduces a new set of commandline options meant for
assisting in fuzz testing the app layer implementations.

Per protocol, 2 commandline options are added:

--afl-http-request=<filename>
--afl-http=<filename>

In the former case, the contents of the file are passed directly to
the HTTP parser as request data.

In the latter case, the data is devided between request and responses.
First 64 bytes are request, then next 64 are response, next 64 are
request, etc, etc.

9 years agoafl: add --enable-afl configure option
Victor Julien [Mon, 8 Feb 2016 15:32:47 +0000 (16:32 +0100)] 
afl: add --enable-afl configure option

9 years agoafl: optionally exit right after afl single runmode
Victor Julien [Tue, 8 Dec 2015 18:55:40 +0000 (19:55 +0100)] 
afl: optionally exit right after afl single runmode

Exit right away if afl.exit_after_pcap is set to true. Safes time
as fuzzing the shutdown code may not be as interesting.

9 years agoafl: add --afl-parse-rules to return 0 on any rule
Victor Julien [Tue, 8 Dec 2015 09:42:03 +0000 (10:42 +0100)] 
afl: add --afl-parse-rules to return 0 on any rule

When fuzzing, AFL will create lots of malformed rules. We don't want
to error out on those. As we're fuzzing the parser any non-crash
should return 0. Crashes (ASAN or not) will return a non-0 code.

9 years agoafl: special 'single' runmode
Victor Julien [Sat, 5 Dec 2015 13:48:05 +0000 (14:48 +0100)] 
afl: special 'single' runmode

To avoid threading, this 'single' mode doesn't run in it's own thread
but instead runs in the main thread.

9 years agoafl: add define to disable mgt threads
Victor Julien [Sat, 5 Dec 2015 13:29:14 +0000 (14:29 +0100)] 
afl: add define to disable mgt threads

The inherent non-deterministic nature of the management threads
creates variable test cases.

9 years agoafl: add define to disable rand_r use
Victor Julien [Sat, 5 Dec 2015 13:14:58 +0000 (14:14 +0100)] 
afl: add define to disable rand_r use

The randomness affects AFL. It creates variable test cases, which
we need to avoid.

9 years agodetect reload: improve signal logic 2001/head
Victor Julien [Tue, 12 Apr 2016 06:21:13 +0000 (08:21 +0200)] 
detect reload: improve signal logic

9 years agostartup: move more into PostConfLoadedSetup
Victor Julien [Fri, 29 May 2015 12:41:44 +0000 (14:41 +0200)] 
startup: move more into PostConfLoadedSetup

9 years agostartup: move RunUnittests to StartInternalRunMode
Victor Julien [Fri, 29 May 2015 12:00:40 +0000 (14:00 +0200)] 
startup: move RunUnittests to StartInternalRunMode

9 years agodetect keywords: use parse regex util func
Victor Julien [Mon, 29 Feb 2016 11:49:19 +0000 (12:49 +0100)] 
detect keywords: use parse regex util func

9 years agodetect parser: add parse regex util function
Victor Julien [Mon, 29 Feb 2016 11:46:22 +0000 (12:46 +0100)] 
detect parser: add parse regex util function

Add regex setup and free util functions. Keywords often use a regex
to parse rule input. Introduce a common function to do this setup.

Also create a list of registered regexes to free at engine shutdown.

9 years agodns: improve handling of tx pick up on response
Victor Julien [Fri, 25 Mar 2016 23:43:40 +0000 (00:43 +0100)] 
dns: improve handling of tx pick up on response

9 years agoutil-decode-der: fix hang detected by AFL 1997/head
Mats Klepsland [Sun, 10 Apr 2016 12:57:19 +0000 (14:57 +0200)] 
util-decode-der: fix hang detected by AFL

Fix hang that occurs when child->length is zero, resulting in an
endless loop.

9 years agoutil-decode-der-get: code cleanup
Mats Klepsland [Sat, 2 Apr 2016 11:44:43 +0000 (13:44 +0200)] 
util-decode-der-get: code cleanup

9 years agoutil-decode-der: code cleanup
Mats Klepsland [Sat, 2 Apr 2016 10:09:55 +0000 (12:09 +0200)] 
util-decode-der: code cleanup

9 years agoapp-layer-ssl: code cleanup
Mats Klepsland [Fri, 1 Apr 2016 17:27:37 +0000 (19:27 +0200)] 
app-layer-ssl: code cleanup

9 years agoapp-layer-tls-handshake: code cleanup
Mats Klepsland [Fri, 1 Apr 2016 09:48:44 +0000 (11:48 +0200)] 
app-layer-tls-handshake: code cleanup

9 years agoapp-layer-tls-handshake: remove duplicate include
Mats Klepsland [Fri, 1 Apr 2016 07:40:56 +0000 (09:40 +0200)] 
app-layer-tls-handshake: remove duplicate include

9 years agoSupport sending rejects via libnet when running under non-root.
Alexander Gozman [Thu, 7 Apr 2016 07:31:25 +0000 (10:31 +0300)] 
Support sending rejects via libnet when running under non-root.

Since version 1.1.6 libnet handles capabilities correctly.
So changing libnet's version checking a little bit should do the trick.

9 years agoautotools: add AS_VERSION_COMPARE stub for CentOS 5
Victor Julien [Mon, 11 Apr 2016 12:08:39 +0000 (14:08 +0200)] 
autotools: add AS_VERSION_COMPARE stub for CentOS 5

9 years agodoxygen: define UNITTESTS to generate test framework docs
Jason Ish [Thu, 7 Apr 2016 16:57:54 +0000 (10:57 -0600)] 
doxygen: define UNITTESTS to generate test framework docs

9 years agoflowbits: use some of the new test macros
Jason Ish [Thu, 7 Apr 2016 16:57:45 +0000 (10:57 -0600)] 
flowbits: use some of the new test macros

9 years agocounters: use some of the new macros in tests
Jason Ish [Thu, 7 Apr 2016 16:57:27 +0000 (10:57 -0600)] 
counters: use some of the new macros in tests

9 years agoconf: use new testing macros
Jason Ish [Wed, 6 Apr 2016 22:51:43 +0000 (16:51 -0600)] 
conf: use new testing macros

Also don't bother with cleanup on failure.

9 years agotesting: new test macros, new testing documentation group.
Jason Ish [Wed, 6 Apr 2016 22:50:08 +0000 (16:50 -0600)] 
testing: new test macros, new testing documentation group.

Unit testing support macros for failing on expressions,
as well as passing tests on expressions.

If fatal unittests are enabled BUG_ON will be triggered for
an assertion providing the line number of the failure, otherwise
the test will simply fail.

Moved the fatal flag to a global var instead of a configuration
parameter for ease of access from a macro.

9 years agotests: no longer necessary to provide successful return code
Jason Ish [Wed, 6 Apr 2016 21:58:40 +0000 (15:58 -0600)] 
tests: no longer necessary to provide successful return code

1 pass, 0 is fail.

9 years agotests: convert all test to return 0 on failure, 1 on success
Jason Ish [Wed, 6 Apr 2016 21:35:13 +0000 (15:35 -0600)] 
tests: convert all test to return 0 on failure, 1 on success

9 years agoprscript: update logic of sync with master test 1989/head
Eric Leblond [Thu, 31 Mar 2016 08:22:11 +0000 (10:22 +0200)] 
prscript: update logic of sync with master test

Code now get master sha on github and check if it is in current
branch with a git command. It also sync first that the current
local branch is in sync with github corresponding branch.

Signed-off-by: Eric Leblond <eric@regit.org>
9 years agotcp: reduce TCP options storage in packets
Victor Julien [Wed, 16 Dec 2015 12:10:05 +0000 (13:10 +0100)] 
tcp: reduce TCP options storage in packets

Until now, the TCP options would all be stored in the Packet structure.
The commonly used ones (wscale, ts, sack, sackok and mss*) then had a
pointer to the position in the option array. Overall this option array
was large. About 360 bytes on 64bit systems. Since no part of the engine
would every access this array other than through the common short cuts,
this was actually just wasteful.

This patch changes the approach. It stores just the common ones in the
packet. The rest is gone. This shrinks the packet structure with almost
300 bytes.

* even though mss wasn't actually used

9 years agolua_close() segfaults on null pointers
Torgeir Natvig [Wed, 6 Apr 2016 14:08:39 +0000 (16:08 +0200)] 
lua_close() segfaults on null pointers

9 years agodetect: fix error handling in mpm setup
Victor Julien [Tue, 5 Apr 2016 11:14:03 +0000 (13:14 +0200)] 
detect: fix error handling in mpm setup

*** CID 1358124:  Null pointer dereferences  (REVERSE_INULL)
/src/detect-engine-mpm.c: 940 in MpmStoreSetup()
934                     PopulateMpmHelperAddPatternToPktCtx(ms->mpm_ctx,
935                             cd, s, 0, (cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP));
936                 }
937             }
938         }
939
>>>     CID 1358124:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "ms->mpm_ctx" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
940         if (ms->mpm_ctx != NULL) {
941             if (ms->mpm_ctx->pattern_cnt == 0) {
942                 MpmFactoryReClaimMpmCtx(de_ctx, ms->mpm_ctx);
943                 ms->mpm_ctx = NULL;
944             } else {
945                 if (ms->sgh_mpm_context == MPM_CTX_FACTORY_UNIQUE_CONTEXT) {

9 years agodetect: fix scan-build warning
Victor Julien [Tue, 5 Apr 2016 11:05:08 +0000 (13:05 +0200)] 
detect: fix scan-build warning

detect-engine-siggroup.c:700:38: warning: Call to 'malloc' has an allocation size of 0 bytes
    sgh->non_mpm_other_store_array = SCMalloc(non_mpm * sizeof(SignatureNonMpmStore));
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./util-mem.h:177:14: note: expanded from macro 'SCMalloc'
    ptrmem = malloc((a)); \
             ^~~~~~~~~~~
1 warning generated.

9 years agodetect: don't set unused variable
Victor Julien [Tue, 5 Apr 2016 10:59:54 +0000 (12:59 +0200)] 
detect: don't set unused variable

detect.c:3801:13: warning: Value stored to 'tmplist2_tail' is never read
            tmplist2_tail = joingr;
            ^               ~~~~~~
detect.c:3804:13: warning: Value stored to 'tmplist2_tail' is never read
            tmplist2_tail = joingr;
            ^               ~~~~~~
2 warnings generated.

9 years agompm: remove unused max pattern len field 1980/head
Victor Julien [Fri, 25 Mar 2016 12:11:04 +0000 (13:11 +0100)] 
mpm: remove unused max pattern len field

9 years agodetect-flowvar: shrink mem structure by 8 bytes
Victor Julien [Fri, 25 Mar 2016 11:58:55 +0000 (12:58 +0100)] 
detect-flowvar: shrink mem structure by 8 bytes

9 years agodetect: shrink IPOnlyCIDRItem with 8 bytes
Victor Julien [Fri, 25 Mar 2016 11:55:23 +0000 (12:55 +0100)] 
detect: shrink IPOnlyCIDRItem with 8 bytes

9 years agodetect-port: improve comment about sgh pointer
Victor Julien [Fri, 25 Mar 2016 11:48:08 +0000 (12:48 +0100)] 
detect-port: improve comment about sgh pointer

9 years agodetect-address: remove sgh pointer as it's unused
Victor Julien [Fri, 25 Mar 2016 11:32:49 +0000 (12:32 +0100)] 
detect-address: remove sgh pointer as it's unused

9 years agodetect-port: remove debug mem counters
Victor Julien [Fri, 25 Mar 2016 11:28:33 +0000 (12:28 +0100)] 
detect-port: remove debug mem counters

9 years agodetect-address: remove debug mem counters
Victor Julien [Fri, 25 Mar 2016 11:27:11 +0000 (12:27 +0100)] 
detect-address: remove debug mem counters

9 years agodetect grouping: remove debug mem counters
Victor Julien [Fri, 25 Mar 2016 11:00:52 +0000 (12:00 +0100)] 
detect grouping: remove debug mem counters

9 years agodetect grouping: make json dump configurable
Victor Julien [Wed, 2 Mar 2016 15:38:02 +0000 (16:38 +0100)] 
detect grouping: make json dump configurable

Make the rule grouping dump to rule_group.json configurable.

detect:
  profiling:
    grouping:
      dump-to-disk: false
      include-rules: false      # very verbose
      include-mpm-stats: false

9 years agodetect: make port whitelisting configurable
Victor Julien [Wed, 2 Mar 2016 12:37:14 +0000 (13:37 +0100)] 
detect: make port whitelisting configurable

Make the port grouping whitelisting configurable. A whitelisted port
ends up in it's own port group.

detect:
  grouping:
    tcp-whitelist: 80, 443
    udp-whitelist: 53, 5060

No portranges are allowed at this point.

9 years agodetect: suppress output
Victor Julien [Wed, 25 Nov 2015 16:27:56 +0000 (17:27 +0100)] 
detect: suppress output

9 years agoyaml: convert detect-engine to just detect
Victor Julien [Mon, 23 Nov 2015 18:03:47 +0000 (19:03 +0100)] 
yaml: convert detect-engine to just detect

Instead of detect-engine which used a list for no good reason, use a
simple map now.

detect:
  profile: medium
  custom-values:
    toclient-groups: 3
    toserver-groups: 25
  sgh-mpm-context: auto
  inspection-recursion-limit: 3000
  # If set to yes, the loading of signatures will be made after the capture
  # is started. This will limit the downtime in IPS mode.
  #delayed-detect: yes

9 years agompm: clean up builtin mpm setup, enable single/full
Victor Julien [Wed, 28 Oct 2015 20:47:37 +0000 (21:47 +0100)] 
mpm: clean up builtin mpm setup, enable single/full

9 years agompm: always cleanup factory
Victor Julien [Wed, 28 Oct 2015 19:52:00 +0000 (20:52 +0100)] 
mpm: always cleanup factory

9 years agompm: allow app buffer shared/unique
Victor Julien [Wed, 28 Oct 2015 16:02:40 +0000 (17:02 +0100)] 
mpm: allow app buffer shared/unique

Allow setting of shared or unique setting per app buffer type:
e.g. detect.mpm.http_uri.shared=true

9 years agompm: refactor 'single' setup handling
Victor Julien [Wed, 28 Oct 2015 08:17:45 +0000 (09:17 +0100)] 
mpm: refactor 'single' setup handling

9 years agompm: remove useless flag from factory
Victor Julien [Wed, 28 Oct 2015 07:37:28 +0000 (08:37 +0100)] 
mpm: remove useless flag from factory

9 years agompm: remove unused app proto factory
Victor Julien [Wed, 28 Oct 2015 07:32:29 +0000 (08:32 +0100)] 
mpm: remove unused app proto factory

9 years agompm: in factory register, consider name const
Victor Julien [Wed, 28 Oct 2015 07:07:28 +0000 (08:07 +0100)] 
mpm: in factory register, consider name const

9 years agodetect: work around cocci limitation
Victor Julien [Tue, 27 Oct 2015 20:49:00 +0000 (21:49 +0100)] 
detect: work around cocci limitation

9 years agorule grouping: speed up port based grouping
Victor Julien [Mon, 26 Oct 2015 16:26:49 +0000 (17:26 +0100)] 
rule grouping: speed up port based grouping

Create a hash table of unique DetectPort objects before trying to
create a unique list of these objects. This safes a lot of cycles
in the creation of the list.

9 years agompm: consify packet/stream search
Victor Julien [Mon, 26 Oct 2015 16:04:47 +0000 (17:04 +0100)] 
mpm: consify packet/stream search

9 years agodetect/mpm: unify packet/stream mpm_ctx pointers
Victor Julien [Mon, 26 Oct 2015 13:18:37 +0000 (14:18 +0100)] 
detect/mpm: unify packet/stream mpm_ctx pointers

SGH's for tcp and udp are now always only per proto and per direction.
This means we can simply reuse the packet and stream mpm pointers.

The SGH's for the other protocols already used a directionless catch
all mpm pointer.

9 years agohttp_raw_header: improve mpm progress handling
Victor Julien [Wed, 21 Oct 2015 06:59:04 +0000 (08:59 +0200)] 
http_raw_header: improve mpm progress handling

9 years agodetect: optimize sgh layout
Victor Julien [Wed, 21 Oct 2015 06:35:24 +0000 (08:35 +0200)] 
detect: optimize sgh layout

9 years agodetect: remove unused content minlen tracking
Victor Julien [Wed, 21 Oct 2015 06:32:00 +0000 (08:32 +0200)] 
detect: remove unused content minlen tracking

9 years agompm: optimize calls
Victor Julien [Wed, 21 Oct 2015 06:19:21 +0000 (08:19 +0200)] 
mpm: optimize calls

For all mpm wrapper functions, check minlen vs the input buffer to see
if we can bypass the mpm search.

Next to this, make all the function inline. Also constify the input and
do other minor cleanups.

9 years agohttp_uri: mpm cleanup. Use mpm_ctx's minlen
Victor Julien [Wed, 21 Oct 2015 05:36:48 +0000 (07:36 +0200)] 
http_uri: mpm cleanup. Use mpm_ctx's minlen

9 years agompm: cleanup: move mpm funcs into buffer specific files
Victor Julien [Tue, 20 Oct 2015 15:49:32 +0000 (17:49 +0200)] 
mpm: cleanup: move mpm funcs into buffer specific files

9 years agompm: cleanup, remove unused structs and prototypes
Victor Julien [Tue, 20 Oct 2015 08:55:41 +0000 (10:55 +0200)] 
mpm: cleanup, remove unused structs and prototypes

9 years agompm: remove unused structure
Victor Julien [Tue, 20 Oct 2015 08:49:10 +0000 (10:49 +0200)] 
mpm: remove unused structure

9 years agoprofiling: output post-prefilter matches
Victor Julien [Mon, 19 Oct 2015 15:39:57 +0000 (17:39 +0200)] 
profiling: output post-prefilter matches

Dump a json record containing all sigs that need to be inspected after
prefilter. Part of profiling. Only dump if threshold is met, which is
currently set by:

 --set detect.profiling.inspect-logging-threshold=200

A file called packet_inspected_rules.json is created in the default
log dir.

9 years agodetect: move sm_list to string funcs to parser code
Victor Julien [Tue, 1 Mar 2016 16:42:40 +0000 (17:42 +0100)] 
detect: move sm_list to string funcs to parser code

9 years agoprofiling: initial rulegroup tracking
Victor Julien [Fri, 16 Oct 2015 22:21:00 +0000 (00:21 +0200)] 
profiling: initial rulegroup tracking

Per rule group tracking of checks, use of lists, mpm matches,
post filter counts.

Logs SGH id so it can be compared with the rule_group.json output.

Implemented both in a human readable text format and a JSON format.

9 years agodetect: assign id to sgh
Victor Julien [Tue, 27 Oct 2015 12:34:55 +0000 (13:34 +0100)] 
detect: assign id to sgh

9 years agodetect: shrink sgh
Victor Julien [Thu, 15 Oct 2015 13:22:44 +0000 (15:22 +0200)] 
detect: shrink sgh

Turn list of mpm_ctx pointers into a union so that we don't waste
space. The sgh's for tcp and udp are in one direction only, so the
ts and tc ones are now in the union.

9 years agodetect: move app_mpms array to init data
Victor Julien [Thu, 15 Oct 2015 12:52:01 +0000 (14:52 +0200)] 
detect: move app_mpms array to init data

9 years agompm: unify & localize mpm pattern (id) handling
Victor Julien [Thu, 15 Oct 2015 08:31:05 +0000 (10:31 +0200)] 
mpm: unify & localize mpm pattern (id) handling

So far, the patterns as passed to the mpm's would use global id's that
were shared among all buffers, directions. This would lead to a fairly
large pattern id space. As the mpm algo's use the pattern id's to
prevent duplicate matching through a pattern id based bitarray,
shrinking this space will optimize performance.

This patch implements this. It sets a flag before adding the pattern
to the mpm ctx, instructing the mpm to ignore the provided pid and
handle pids management itself. This leads to a shrinking of the
bitarray size.

This is made possible by the previous work that removes the pid logic
from the code.

Next to this, this patch moves the pattern setup stage to common util
functions. This avoids code duplication.

Update ac, ac-bs and ac-ks to use this.

9 years agompm: improve negated mpm
Victor Julien [Thu, 1 Oct 2015 11:11:44 +0000 (13:11 +0200)] 
mpm: improve negated mpm

The idea is: if mpm is negated, it's both on mpm and nonmpm sid lists
and we can kick it out in that case during the merge sort.

It only works for patterns that are 'independent'. This means that the
rule doesn't need to only match if the negated mpm pattern is limited
to the first 10 bytes for example.

Or more generally, an negated mpm pattern that has depth, offset,
distance or within settings can't be handled this way. These patterns
are not added to the mpm at all, but just to to non-mpm list. This
makes sense as they will *always* need manual inspection.

Similarly, a pattern that is 'chopped' always needs validation. This
is because in this case we only inspect a part of the final pattern.

9 years agodetect: remove signature pattern id reference
Victor Julien [Tue, 13 Oct 2015 12:56:01 +0000 (14:56 +0200)] 
detect: remove signature pattern id reference

9 years agompm: remove unused pmq merge function
Victor Julien [Tue, 13 Oct 2015 08:39:54 +0000 (10:39 +0200)] 
mpm: remove unused pmq merge function

9 years agodetect: remove stream pmq array
Victor Julien [Tue, 13 Oct 2015 08:27:26 +0000 (10:27 +0200)] 
detect: remove stream pmq array

9 years agodetect mpm: mpm store cleanup
Victor Julien [Tue, 13 Oct 2015 06:49:23 +0000 (08:49 +0200)] 
detect mpm: mpm store cleanup

Move all rule modification to the fast_pattern assigment.

9 years agodetect mpm: fast_pattern assignment cleanup
Victor Julien [Tue, 13 Oct 2015 06:33:27 +0000 (08:33 +0200)] 
detect mpm: fast_pattern assignment cleanup