]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
11 years agoFix pfring so that zero-copy mode can work. 717/head
Ken Steele [Mon, 11 Nov 2013 18:11:39 +0000 (13:11 -0500)] 
Fix pfring so that zero-copy mode can work.

Detect when default_packet_size is zero, which enables zero-copy mode for
pfring and in that case, do what AF Packet does and set pkt_ext pointer to
the data and set PKT_ZERO_COPY flag.

11 years agoRemove pkt variable from Packet structure.
Ken Steele [Mon, 11 Nov 2013 16:58:31 +0000 (11:58 -0500)] 
Remove pkt variable from Packet structure.

The uint8_t *pkt in the Packet structure always points to the memory
immediately following the Packet structure. It is better to simply
calculate that value every time than store the 8 byte pointer.

11 years agoSplit AC-Tile MPM context into Search and Initialization structures. 714/head
Ken Steele [Wed, 13 Nov 2013 19:16:21 +0000 (14:16 -0500)] 
Split AC-Tile MPM context into Search and Initialization structures.

Some of the fields in the SCACTileCtx struct are only used to create the MPM,
but are not needed to search the MPM. Create a new structure to contain just
the data needed by AC Search. After creating the MPM, copy the data into the
new structure and then free the memory only needed during initialization.

This reduces the size of the AC-Tile MPM context from 1360 bytes down to 296
bytes.

11 years agompipe code cleanup: indent fixes
Victor Julien [Wed, 11 Dec 2013 10:53:08 +0000 (11:53 +0100)] 
mpipe code cleanup: indent fixes

11 years agoAdd more suricata.yaml configuration options for mPIPE.
Ken Steele [Fri, 22 Nov 2013 20:53:12 +0000 (15:53 -0500)] 
Add more suricata.yaml configuration options for mPIPE.

Add two new mPIPE load-balancing configuration options in suricata.yaml.
1) "sticky" which keep sending flows to one CPU, but if that queue is full,
don't drop the packet, move the flow to the least loaded queue.
2) Round-robin, which always picks the least full input queue for each
packet.

Allow configuring the number of packets in the input queue (iqueue) in
suricata.yaml.

For the mPipe.buckets configuration, which must be a power of 2, round
up to the next power of two, rather than report an error.

Added mpipe.min-buckets, which defaults to 256, so if the requested number
of buckets can't be allocated, Suricata will keep dividing by 2 until either
it succeeds in allocating buckets, or reaches the minimum number of buckets
and fails.

11 years agoFix configuring Prelude with -Werror
Ken Steele [Tue, 19 Nov 2013 15:22:40 +0000 (10:22 -0500)] 
Fix configuring Prelude with -Werror

Running with:

CFLAGS="-Werror" ./configure

would fail when configuring libprelude because of an unused-result
warning. Ignore that one warning.

11 years agoMark pflow as a constant pointer.
Ken Steele [Tue, 10 Dec 2013 20:14:49 +0000 (15:14 -0500)] 
Mark pflow as a constant pointer.

Address review comment from Victor that the pflow pointer is constant, so
it can be marked as such.

11 years agoUse pflow variable in place of p->flow to prevent reloading.
Ken Steele [Sun, 17 Nov 2013 14:43:00 +0000 (09:43 -0500)] 
Use pflow variable in place of p->flow to prevent reloading.

In SigMatchSignatures, the value p->flow doens't change, but GCC can't
figure that out, so it reloads p->flow many times during the function.
When p->flow is loaded into the variable pflow once at the start of the
function, the compile then doesn't need to reload it.

11 years agopfring: workaround potential librt deps
Eric Leblond [Wed, 11 Dec 2013 09:25:39 +0000 (09:25 +0000)] 
pfring: workaround potential librt deps

It seems some version of pfring needs to be link with librt.

11 years agosuricata: ignore SIGHUP signal 711/head
Eric Leblond [Wed, 11 Dec 2013 08:26:18 +0000 (09:26 +0100)] 
suricata: ignore SIGHUP signal

This patch ignores the SIGHUP signal instead of having the default
behavior.

11 years agoCheck for compiler for -march=native support 653/head 703/head
Ken Steele [Fri, 22 Nov 2013 17:54:32 +0000 (12:54 -0500)] 
Check for compiler for -march=native support

Check all compilers to see if they support the -march=native flags, rather
than assuming gcc 4.2 or later does. Tile GCC doesn't currently support it,
so not checking break Tile compiles.

11 years agoFix compilation on systems that use the fallback SC_ATOMIC_ API.
Victor Julien [Tue, 10 Dec 2013 11:05:17 +0000 (12:05 +0100)] 
Fix compilation on systems that use the fallback SC_ATOMIC_ API.

11 years agoAdd DrMemory suppression for Bug #980. Suppress useless (likely) buggy leak message too
Victor Julien [Tue, 10 Dec 2013 10:45:24 +0000 (11:45 +0100)] 
Add DrMemory suppression for Bug #980. Suppress useless (likely) buggy leak message too

11 years agoRemove DrMemory suppressions for Bug #979, it is fixed.
Victor Julien [Tue, 10 Dec 2013 10:43:32 +0000 (11:43 +0100)] 
Remove DrMemory suppressions for Bug #979, it is fixed.

11 years agoqa: prscript now output pastable line for PR.
Eric Leblond [Tue, 10 Dec 2013 09:36:50 +0000 (10:36 +0100)] 
qa: prscript now output pastable line for PR.

11 years agococcinelle: fix malloc test
Eric Leblond [Mon, 9 Dec 2013 16:02:55 +0000 (17:02 +0100)] 
coccinelle: fix malloc test

We can have more than an identifier to be assigned the result of
a malloc function.

11 years agococcinelle: add option to continue on errors
Eric Leblond [Mon, 9 Dec 2013 17:18:30 +0000 (18:18 +0100)] 
coccinelle: add option to continue on errors

When a script has been updated or introduced, it is interesting to
detect all errors at once. With this patch it is now possible to
do so by using:
   NOT_TERMINAL=1 CONCURRENCY_LEVEL=12  qa/coccinelle/run_check.sh

11 years agoerror checking: add missing alloc error treatment
Eric Leblond [Mon, 9 Dec 2013 17:58:32 +0000 (18:58 +0100)] 
error checking: add missing alloc error treatment

The return of some malloc like functions was not treated in some
places of the code.

11 years agoBug 1061: fix multiple vars per sig in ordering 702/head
Victor Julien [Tue, 10 Dec 2013 08:30:48 +0000 (09:30 +0100)] 
Bug 1061: fix multiple vars per sig in ordering

In sigordering rules that had multiple vars doing the same operation,
like setting multiple flowbits, would not be considered correctly.

Bug 1061.

11 years agohttp header: improve realloc failure checking. Bug #1062. 699/head
Victor Julien [Mon, 9 Dec 2013 22:21:20 +0000 (23:21 +0100)] 
http header: improve realloc failure checking. Bug #1062.

11 years agoport parsing: improve memory handling
Victor Julien [Mon, 9 Dec 2013 22:07:16 +0000 (23:07 +0100)] 
port parsing: improve memory handling

11 years agocppcheck: add special BUG_ON so cppcheck understands we exit
Victor Julien [Mon, 9 Dec 2013 22:06:40 +0000 (23:06 +0100)] 
cppcheck: add special BUG_ON so cppcheck understands we exit

11 years agoport: don't lead memory on port parsing failure
Victor Julien [Mon, 9 Dec 2013 20:19:11 +0000 (21:19 +0100)] 
port: don't lead memory on port parsing failure

[src/detect-engine-port.c:1354]: (error) Memory leak: gh

11 years agoFix small memleak in runmode setup
Victor Julien [Mon, 9 Dec 2013 20:15:22 +0000 (21:15 +0100)] 
Fix small memleak in runmode setup

[src/runmodes.c:338]: (error) Memory leak: custom_mode

11 years agothreading setup: fix small mem leak on failure
Victor Julien [Mon, 9 Dec 2013 20:09:36 +0000 (21:09 +0100)] 
threading setup: fix small mem leak on failure

[src/tm-threads.c:1058]: (error) Memory leak: slot

11 years agoFix realloc error handling in threshold.config file parsing. Bug #1062.
Victor Julien [Mon, 9 Dec 2013 20:03:44 +0000 (21:03 +0100)] 
Fix realloc error handling in threshold.config file parsing. Bug #1062.

11 years agoUse %u for unsigned int in (console) output
Victor Julien [Mon, 9 Dec 2013 19:57:02 +0000 (20:57 +0100)] 
Use %u for unsigned int in (console) output

11 years agoUse %u for unsigned ints in checksum warning
Victor Julien [Mon, 9 Dec 2013 19:55:41 +0000 (20:55 +0100)] 
Use %u for unsigned ints in checksum warning

11 years agohtp: minor cleanup to silence cppcheck warning
Victor Julien [Mon, 9 Dec 2013 18:02:42 +0000 (19:02 +0100)] 
htp: minor cleanup to silence cppcheck warning

[src/app-layer-htp.c:1967] -> [src/app-layer-htp.c:1978]: (warning) \
    Possible null pointer dereference: tx - otherwise it is redundant \
    to check it against null.

11 years agocppcheck: don't use likely/unlikely when -DCPPCHECK is passed to the checker
Victor Julien [Mon, 9 Dec 2013 18:02:32 +0000 (19:02 +0100)] 
cppcheck: don't use likely/unlikely when -DCPPCHECK is passed to the checker

11 years agoFix small memory leak in classtype parsing
Victor Julien [Mon, 9 Dec 2013 17:48:42 +0000 (18:48 +0100)] 
Fix small memory leak in classtype parsing

11 years agocppcheck: improve reporting cppcheck when passing -DCPPCHECK to the checker.
Victor Julien [Mon, 9 Dec 2013 17:48:22 +0000 (18:48 +0100)] 
cppcheck: improve reporting cppcheck when passing -DCPPCHECK to the checker.

11 years agolog-http: fix error check leading to null-deref on malloc failure during setup 694/head
Victor Julien [Mon, 9 Dec 2013 15:42:33 +0000 (16:42 +0100)] 
log-http: fix error check leading to null-deref on malloc failure during setup

11 years agolog-http: enforce hostname print limit
Victor Julien [Mon, 9 Dec 2013 15:33:07 +0000 (16:33 +0100)] 
log-http: enforce hostname print limit

11 years agoConvert Flow macros to inline functions
Victor Julien [Mon, 9 Dec 2013 15:20:30 +0000 (16:20 +0100)] 
Convert Flow macros to inline functions

Convert FlowReference and FlowDeReference to inline functions for
better readability and to aid static code analyzers.

11 years agoflowvar: initialize new memory to prevent issues on error handling
Victor Julien [Mon, 9 Dec 2013 12:29:02 +0000 (13:29 +0100)] 
flowvar: initialize new memory to prevent issues on error handling

11 years agopcap: fix stats dump logic
Victor Julien [Mon, 9 Dec 2013 11:12:01 +0000 (12:12 +0100)] 
pcap: fix stats dump logic

pcap has a callback function that is called for each packet. Once a
second, it's meant to 'dump stats'. However, the timing logic was
broken, so it would actually dump stats for each packet.

By moving the stats second timer into the thread vars, next calls of
the callback will be able to use the stored time.

11 years agoflow timeout: remove now unused code 692/head
Victor Julien [Tue, 3 Dec 2013 14:14:46 +0000 (15:14 +0100)] 
flow timeout: remove now unused code

11 years agoflow: fix typo in function name
Victor Julien [Tue, 3 Dec 2013 13:36:25 +0000 (14:36 +0100)] 
flow: fix typo in function name

FlowForceReassemblyNeedReassmbly -> FlowForceReassemblyNeedReassembly

11 years agoflow timeout cleanup and fix
Victor Julien [Tue, 3 Dec 2013 13:28:09 +0000 (14:28 +0100)] 
flow timeout cleanup and fix

Flow timeout code worked by luck when checking if a flow still needed
reassembly for app layer inspection or logging. It would check for a
part of raw reassembly (smsg list) to determine if detection was
needed. In this case it would also process app layer cleanup,
including logging.

Introduced AppLayerTransactionGetActive which returns the lowest tx_id
in a direction that still needs some work.

FlowForceReassemblyNeedReassmbly now uses it to determine if the
applayer still needs work.

Converted FlowForceReassemblyForHash to use the checking function
FlowForceReassemblyNeedReassmbly as well, so that checking if a flow
needs work is now unified.

11 years agoflow/stream: use named values in flow timeout code
Victor Julien [Tue, 3 Dec 2013 08:55:01 +0000 (09:55 +0100)] 
flow/stream: use named values in flow timeout code

11 years agostream: add option to disable raw reassembly
Victor Julien [Thu, 28 Nov 2013 18:02:14 +0000 (19:02 +0100)] 
stream: add option to disable raw reassembly

Raw reassembly is used only by the detection engine. For users only
caring about logging it's a significant overhead, both in cpu and
memory usage.

The option is called 'raw' and lives under the stream.reassembly
options.

stream:
  memcap: 32mb
  checksum-validation: yes      # reject wrong csums
  inline: auto                  # auto will use inline mode in IPS mode, yes or no set it statically
  reassembly:
    memcap: 64mb
    depth: 1mb                  # reassemble 1mb into a stream
    toserver-chunk-size: 2560
    toclient-chunk-size: 2560
    randomize-chunk-size: yes
    #randomize-chunk-range: 10
    raw: false # <- new option

11 years agoerf-dag: fix typo in header guard
Eric Leblond [Thu, 5 Dec 2013 23:35:36 +0000 (00:35 +0100)] 
erf-dag: fix typo in header guard

Spotted out by clang:
 source-erf-dag.h|25 col 9| warning: '__SOURCE_ERR_DAG_H__'
 is used as a header guard here, followed by #define of a different macro
 [-Wheader-guard]

11 years agoyaml: remove no more present files
Eric Leblond [Thu, 5 Dec 2013 13:34:22 +0000 (14:34 +0100)] 
yaml: remove no more present files

emerging-virus.rules is not present anymore in ET ruleset downloaded
by 'make install-rules'. This patch removes it from the list to avoid
an error message.

11 years agodns: rules files was not installed
Eric Leblond [Thu, 5 Dec 2013 13:31:33 +0000 (14:31 +0100)] 
dns: rules files was not installed

Installed dns-events.rules files in rules directory with install-rules.

11 years agoprscript: add support for pcap build 689/head
Eric Leblond [Fri, 6 Dec 2013 15:41:07 +0000 (16:41 +0100)] 
prscript: add support for pcap build

Now also start a pcap test build.

11 years agoUse the stack for temporary memory buffers. 683/head
Jason Ish [Wed, 4 Dec 2013 16:01:54 +0000 (10:01 -0600)] 
Use the stack for temporary memory buffers.

11 years agoWhen setting final configuration nodes, set the whole tree as final.
Jason Ish [Wed, 4 Dec 2013 15:10:44 +0000 (09:10 -0600)] 
When setting final configuration nodes, set the whole tree as final.

Prevents benign log message of parent nodes of final values being
redefined (which ends up having no affect as the final nodes
are protected from being removed).

11 years agohtp: display info about randomization
Eric Leblond [Mon, 2 Dec 2013 14:31:00 +0000 (15:31 +0100)] 
htp: display info about randomization

When randomizatin is used display a message about actual values.

11 years agohtp: randomization of htp inspection sizes
Eric Leblond [Mon, 2 Dec 2013 13:26:08 +0000 (14:26 +0100)] 
htp: randomization of htp inspection sizes

This is an implementation of #940. It randomize libhtp request
and response size if the same way this has been done for stream
inspection.

11 years agolua: push correct length back through ScFlowvarGet, work around valgrind warning
Victor Julien [Tue, 26 Nov 2013 17:30:04 +0000 (18:30 +0100)] 
lua: push correct length back through ScFlowvarGet, work around valgrind warning

11 years agolua: clear stack after each script run
Victor Julien [Wed, 4 Dec 2013 12:15:30 +0000 (13:15 +0100)] 
lua: clear stack after each script run

11 years agoluajit: pass calling rule's sid,gid,rev to script as SCRuleSid, SCRuleGid, SCRuleRev.
Victor Julien [Tue, 5 Nov 2013 20:45:08 +0000 (21:45 +0100)] 
luajit: pass calling rule's sid,gid,rev to script as SCRuleSid, SCRuleGid, SCRuleRev.

11 years agodecode: fix failure in layered tunnel 681/head
Eric Leblond [Wed, 4 Dec 2013 09:43:17 +0000 (10:43 +0100)] 
decode: fix failure in layered tunnel

If we have multiple layer of tunnel, the decoding of initial
Packet will recurse in DecodeTunnel function called in
PacketTunnelPktSetup. If we are not setting the pseudo
packet root before calling DecodeTunnel (as done in previous
code), then the tunnel root will no be correct for the lower
layer packets. This result in an counter problem and a suricata
failure after some time.

11 years agoFix alignment in usage.
Jason Ish [Tue, 3 Dec 2013 22:22:51 +0000 (16:22 -0600)] 
Fix alignment in usage.

11 years agoAdds a defrag configuration example in suricata.yaml
Giuseppe Longo [Sun, 1 Dec 2013 16:46:31 +0000 (17:46 +0100)] 
Adds a defrag configuration example in suricata.yaml

11 years agoFix Conf api usage after rebase
Victor Julien [Wed, 4 Dec 2013 10:47:54 +0000 (11:47 +0100)] 
Fix Conf api usage after rebase

11 years agoInstead of exiting on memory failure, log a warning then return NULL
Jason Ish [Thu, 28 Nov 2013 16:04:16 +0000 (10:04 -0600)] 
Instead of exiting on memory failure, log a warning then return NULL
to signify an error to the caller.

11 years agoBetter document ConfSet and ConfSetFinal.
Jason Ish [Thu, 28 Nov 2013 15:46:14 +0000 (09:46 -0600)] 
Better document ConfSet and ConfSetFinal.

11 years agoSubsequent configuration keys now override previous ones
Jason Ish [Thu, 21 Nov 2013 20:52:06 +0000 (14:52 -0600)] 
Subsequent configuration keys now override previous ones
instead of merging.

The exception is final values, for example, values like
default-log-dir that may be set on the command line.

11 years agoFunction to prune all non-final nodes from a configuration node.
Jason Ish [Thu, 21 Nov 2013 19:55:03 +0000 (13:55 -0600)] 
Function to prune all non-final nodes from a configuration node.

11 years agoMore concise API for setting config values that
Jason Ish [Thu, 21 Nov 2013 19:36:45 +0000 (13:36 -0600)] 
More concise API for setting config values that
can be overrided or not (final values).

11 years agoCleanup ConfSet, ConfGet, make more concise.
Jason Ish [Thu, 21 Nov 2013 15:20:10 +0000 (09:20 -0600)] 
Cleanup ConfSet, ConfGet, make more concise.

Removes ifdef's for readability by using strchr instead
of strtok.

11 years agotls: allow matching for @ symbol in tls.subject 680/head
Victor Julien [Wed, 4 Dec 2013 09:46:02 +0000 (10:46 +0100)] 
tls: allow matching for @ symbol in tls.subject

Also in tls.issuerdn keyword.

Original patch by Chris Wakelin.

Fixes #1042.

11 years agoFTP parser updated to not use the archaic App layer feature of AppLayerParserResultElmt.
Anoop Saldanha [Mon, 21 Oct 2013 15:03:09 +0000 (20:33 +0530)] 
FTP parser updated to not use the archaic App layer feature of AppLayerParserResultElmt.

The parser otherwise remains pretty much the same.

11 years agoUpdated the ftp response handler to return without doing anything.
Anoop Saldanha [Mon, 21 Oct 2013 10:05:53 +0000 (15:35 +0530)] 
Updated the ftp response handler to return without doing anything.

Currently the processing happening inside the handler is not being used
anywhere else in the engine.

11 years agoRestructured flow_proto mapping enums.
Anoop Saldanha [Tue, 5 Nov 2013 07:50:07 +0000 (13:20 +0530)] 
Restructured flow_proto mapping enums.

Moved FLOW_PROTO_DEFAULT down the enum list.

11 years agoCode cleanup.
Anoop Saldanha [Fri, 1 Nov 2013 08:29:55 +0000 (13:59 +0530)] 
Code cleanup.

Use the MpmAddPattern[CS|CI] wrapper to add patterns to the mpm context.

Also use MpmInitCtx() to init the mpm context.

11 years agoRemoved unused function MpmMatcherGetMaxPatternLength.
Anoop Saldanha [Fri, 1 Nov 2013 05:36:14 +0000 (11:06 +0530)] 
Removed unused function MpmMatcherGetMaxPatternLength.

11 years agoReduce allocs in boyer moore prepare phase
Victor Julien [Mon, 2 Dec 2013 20:28:44 +0000 (21:28 +0100)] 
Reduce allocs in boyer moore prepare phase

11 years agoDon't alloc for hash lookup in SCClassConfGetClasstype
Victor Julien [Mon, 2 Dec 2013 20:11:02 +0000 (21:11 +0100)] 
Don't alloc for hash lookup in SCClassConfGetClasstype

11 years agoDon't malloc temp var in SCRuleVarsGetConfVar
Victor Julien [Mon, 2 Dec 2013 19:52:33 +0000 (20:52 +0100)] 
Don't malloc temp var in SCRuleVarsGetConfVar

11 years agoDon't use strdup in ip-only address parsing
Victor Julien [Mon, 2 Dec 2013 19:34:39 +0000 (20:34 +0100)] 
Don't use strdup in ip-only address parsing

11 years agoConvert classtype keyword to pcre_copy_substring
Victor Julien [Mon, 2 Dec 2013 16:35:58 +0000 (17:35 +0100)] 
Convert classtype keyword to pcre_copy_substring

11 years agoConvert reference keyword to pcre_copy_substring
Victor Julien [Mon, 2 Dec 2013 16:20:55 +0000 (17:20 +0100)] 
Convert reference keyword to pcre_copy_substring

11 years agoapp layer: set event if proto detect disabled for a stream, but we see data anyway.
Victor Julien [Mon, 2 Dec 2013 14:04:08 +0000 (15:04 +0100)] 
app layer: set event if proto detect disabled for a stream, but we see data anyway.

11 years agoproto detection: add limit for one sided sessions
Victor Julien [Tue, 5 Nov 2013 13:41:45 +0000 (14:41 +0100)] 
proto detection: add limit for one sided sessions

If a session only has data in one direction, like ftp data sessions,
protocol detection will only run in one direction. This led to a
situation where reassembly would hold all the segments as proto
detection was never flagged as complete.

This patch introduces a limit for protocol detection in this case.
If the limit is reached, detection will give up.

11 years agostream: add size debug code
Victor Julien [Tue, 5 Nov 2013 13:41:31 +0000 (14:41 +0100)] 
stream: add size debug code

11 years agostream: wait for protocol detection to complete
Victor Julien [Tue, 24 Sep 2013 17:36:51 +0000 (19:36 +0200)] 
stream: wait for protocol detection to complete

Wait for protocol detection to complete before removing segments
from the list.

11 years agodecode: clean DecodeThreadVars counter 671/head
Eric Leblond [Mon, 2 Dec 2013 10:08:01 +0000 (11:08 +0100)] 
decode: clean DecodeThreadVars counter

Speed counters are not compute anymore and can be removed from the
structure definition.

11 years agocmdline: add -k to specify checksum validation
Eric Leblond [Wed, 27 Nov 2013 12:22:42 +0000 (13:22 +0100)] 
cmdline: add -k to specify checksum validation

This patch adds a '-k' option to suricata to be able to specify
the checksum validation to use. If '-k all' is used, checksum
validation is forced. If '-k none' is used, no checksum validation
is made.

Message output in case of detection of a pcap file with a probable
cheksum issue has been updated to indicate that '-k' is a solution.

11 years agopcap-file: add checksum-checks configuration variable
Eric Leblond [Thu, 20 Jun 2013 07:29:10 +0000 (09:29 +0200)] 
pcap-file: add checksum-checks configuration variable

This patch adds support for checksum-checks in the pcap-file running
mode. This is the same functionnality as the one already existing for
live interface.

It can be setup in the YAML:
  pcap-file:
    checksum-checks: auto

A message is displayed for small pcap to warn that invalid checksum
rate is big on the pcap file and that checksum-check could
be set to no.

11 years agoSet packet invalid flag during decoding.
Eric Leblond [Tue, 19 Feb 2013 13:53:52 +0000 (14:53 +0100)] 
Set packet invalid flag during decoding.

This patch set a new value in pkt->flag to signal that a packet is
invalid during decoding. The patch has been obtained via a coccinelle
transformation.

11 years agoAdd invalid pkt counter.
Eric Leblond [Tue, 19 Feb 2013 13:45:05 +0000 (14:45 +0100)] 
Add invalid pkt counter.

This patch adds and increments a invalid packet counter. It
does this by introducing PacketDecodeFinalize function

This function is incrementing the invalid counter and is also
signalling the packet to CUDA.

11 years agoFix parsing of 'custom' detect grouping values 669/head
Victor Julien [Sun, 1 Dec 2013 10:37:52 +0000 (11:37 +0100)] 
Fix parsing of 'custom' detect grouping values

Also, add error checking

Bug 892

11 years agovars: optimize layout to reduce size requirements of flowbits and other vars
Victor Julien [Sat, 30 Nov 2013 12:06:44 +0000 (13:06 +0100)] 
vars: optimize layout to reduce size requirements of flowbits and other vars

11 years agopcre: parsing cleanup
Victor Julien [Sat, 30 Nov 2013 12:00:17 +0000 (13:00 +0100)] 
pcre: parsing cleanup

Remove all flags indicating the buffer type. They were only used
at parse time.

Because of this the DetectPcreData_ structure could shrink to 32
bytes.

11 years agostream: minor clean up of TcpSession structure
Victor Julien [Sat, 30 Nov 2013 11:58:37 +0000 (12:58 +0100)] 
stream: minor clean up of TcpSession structure

11 years agocontent: reorder DetectContentData member, shrinking the struct from 64 to 48 bytes.
Victor Julien [Sat, 30 Nov 2013 11:57:34 +0000 (12:57 +0100)] 
content: reorder DetectContentData member, shrinking the struct from 64 to 48 bytes.

11 years agodefrag: clean up
Victor Julien [Thu, 28 Nov 2013 18:20:34 +0000 (19:20 +0100)] 
defrag: clean up

Rename PacketDefragPktFinishSetup to PacketDefragPktSetupParent to
better refect it's function.

11 years agodefrag: don't modify packet if defrag fails 666/head
Eric Leblond [Thu, 28 Nov 2013 16:36:03 +0000 (17:36 +0100)] 
defrag: don't modify packet if defrag fails

If defrag fails dur to an invalid decoding, we are not modifying
the origin packet anymore.

11 years agodecode: PacketTunnelPktSetup replaces PacketPseudoPktSetup
Eric Leblond [Thu, 28 Nov 2013 14:23:21 +0000 (15:23 +0100)] 
decode: PacketTunnelPktSetup replaces PacketPseudoPktSetup

This patch replaces PacketPseudoPktSetup by a better named
PacketTunnelPktSetup function which is also in charge of doing
the decoding of the tunneled packet.
This allow to clean the code. But it also fixes an issue.
Previously, if the DecodeTunnel function was failling (cause of
an invalid packet mainly), the result was that the original packet
to be considered as a tunnel packet (and not inspected by payload
detection).

11 years agodecode: update API to return error
Eric Leblond [Wed, 27 Nov 2013 17:53:52 +0000 (18:53 +0100)] 
decode: update API to return error

In some cases, the decoding is not possible and some really invalid
packet can be created. This is in particular the case of tunnel. In
that case, it is more interesting to forget about the tunneled
packet and only consider the original packet.

DecodeTunnel function is maked as warn_unused_result because it is
meaningful for the decoder to know if the underlying data were not
correct. And in this case, only focus detection on the content.

11 years agorule setup: cleanup
Victor Julien [Thu, 28 Nov 2013 14:07:33 +0000 (15:07 +0100)] 
rule setup: cleanup

Remove rule preparation logic that ran, but it's results were not
used.

11 years agoConvert dsize keyword parsing to use pcre_copy_substring
Victor Julien [Thu, 28 Nov 2013 12:30:04 +0000 (13:30 +0100)] 
Convert dsize keyword parsing to use pcre_copy_substring

11 years agoConvert pcre keyword parsing to use pcre_copy_substring
Victor Julien [Thu, 28 Nov 2013 11:59:10 +0000 (12:59 +0100)] 
Convert pcre keyword parsing to use pcre_copy_substring

11 years agorule parser: convert to use pcre_copy_string
Victor Julien [Thu, 28 Nov 2013 08:44:10 +0000 (09:44 +0100)] 
rule parser: convert to use pcre_copy_string

11 years agodetect: use macro for max rule size
Victor Julien [Thu, 28 Nov 2013 08:20:55 +0000 (09:20 +0100)] 
detect: use macro for max rule size

11 years agoConvert flowbits keyword parsing to use pcre_copy_substring
Victor Julien [Wed, 27 Nov 2013 22:56:32 +0000 (23:56 +0100)] 
Convert flowbits keyword parsing to use pcre_copy_substring

11 years agoConvert flow keyword parsing to use pcre_copy_substring
Victor Julien [Wed, 27 Nov 2013 20:23:25 +0000 (21:23 +0100)] 
Convert flow keyword parsing to use pcre_copy_substring