]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
12 years agoCuda make distcheck fix for cuda-ptxdump.h 405/head
Anoop Saldanha [Wed, 26 Jun 2013 07:53:08 +0000 (13:23 +0530)] 
Cuda make distcheck fix for cuda-ptxdump.h

12 years agoCoverity 1038522: fix memset inside cuda code. Wrong size specified to memset.
Anoop Saldanha [Wed, 26 Jun 2013 07:51:39 +0000 (13:21 +0530)] 
Coverity 1038522: fix memset inside cuda code.  Wrong size specified to memset.

12 years agoCoverity 1038085: remove 'default' statement in SCErrorToString. This way a warning...
Victor Julien [Tue, 25 Jun 2013 15:16:41 +0000 (17:16 +0200)] 
Coverity 1038085: remove 'default' statement in SCErrorToString. This way a warning will be given if an error is defined w/o updating this function.

12 years agoCoverity 1038092 & 1038093: remove dead code
Victor Julien [Tue, 25 Jun 2013 15:14:02 +0000 (17:14 +0200)] 
Coverity 1038092 & 1038093: remove dead code

12 years agoCoverity 1038518: fix wrong error check
Victor Julien [Tue, 25 Jun 2013 15:00:45 +0000 (17:00 +0200)] 
Coverity 1038518: fix wrong error check

12 years agoCoverity 1038124: memory leak on 'seq' keyword parsing failure
Victor Julien [Tue, 25 Jun 2013 12:14:50 +0000 (14:14 +0200)] 
Coverity 1038124: memory leak on 'seq' keyword parsing failure

12 years agoCoverity 1038123: memory leak on 'flowint' keyword parsing failure
Victor Julien [Tue, 25 Jun 2013 12:13:04 +0000 (14:13 +0200)] 
Coverity 1038123: memory leak on 'flowint' keyword parsing failure

12 years agoCoverity 1038116 & 1038117: memory leaks on 'app-layer-event' keyword parsing failure
Victor Julien [Tue, 25 Jun 2013 12:10:25 +0000 (14:10 +0200)] 
Coverity 1038116 & 1038117: memory leaks on 'app-layer-event' keyword parsing failure

12 years agoCoverity 1038115: memory leak on 'ack' keyword parsing failure
Victor Julien [Tue, 25 Jun 2013 12:07:13 +0000 (14:07 +0200)] 
Coverity 1038115: memory leak on 'ack' keyword parsing failure

12 years agoCoverity 1038113: possibly out of bounds read
Victor Julien [Tue, 25 Jun 2013 12:03:38 +0000 (14:03 +0200)] 
Coverity 1038113: possibly out of bounds read

12 years agoMinor cosmetic changes to the cuda code.
Anoop Saldanha [Thu, 20 Jun 2013 17:56:23 +0000 (23:26 +0530)] 
Minor cosmetic changes to the cuda code.

Moved a couple of functions to more cuda relevant files;
Re-structured some data types.

12 years agoModified CudaBufferCullCompletedSlices.
Anoop Saldanha [Mon, 25 Mar 2013 11:55:33 +0000 (17:25 +0530)] 
Modified CudaBufferCullCompletedSlices.

Allow readers specify max size of data they want to read.

12 years agoAdd a usleep to CudaBuffer culling process. Would lead to a situation where the threa...
Anoop Saldanha [Mon, 25 Mar 2013 09:51:09 +0000 (15:21 +0530)] 
Add a usleep to CudaBuffer culling process. Would lead to a situation where the thread wouldn't care to yield to others."

12 years agoVersion 1 of AC Cuda.
Anoop Saldanha [Mon, 25 Mar 2013 09:38:45 +0000 (15:08 +0530)] 
Version 1 of AC Cuda.

12 years agoVersion 1 of CudaBuffer API. Introduced to buffer data to the gpu.
Anoop Saldanha [Sat, 23 Mar 2013 17:53:47 +0000 (23:23 +0530)] 
Version 1 of CudaBuffer API. Introduced to buffer data to the gpu.

This version allows async writes to a buffer by threads.  Allows only
sequential reads though.

12 years agoWe call packet and stream mpm as late as possible now. Won't affect the working of...
Anoop Saldanha [Thu, 15 Nov 2012 16:44:36 +0000 (22:14 +0530)] 
We call packet and stream mpm as late as possible now. Won't affect the working of the engine.

The rationale behind this is, if we have pkt buffered to the gpu, we'd want
to delay processing the pkt as much as possible.

12 years agopool now uses a queue kinda behaviour when getting/inserting data through poolbuckets.
Anoop Saldanha [Thu, 15 Nov 2012 16:41:34 +0000 (22:11 +0530)] 
pool now uses a queue kinda behaviour when getting/inserting data through poolbuckets.

12 years agocode refactoring. Call mpmprefilter slightly later than where it's called atm
Anoop Saldanha [Sat, 4 Aug 2012 12:44:38 +0000 (18:14 +0530)] 
code refactoring. Call mpmprefilter slightly later than where it's called atm

12 years agoRemove all cuda related code in the engine except for the cuda api wrappers
Anoop Saldanha [Thu, 15 Nov 2012 07:54:29 +0000 (13:24 +0530)] 
Remove all cuda related code in the engine except for the cuda api wrappers

12 years agoupdate cuda API wrappers
Anoop Saldanha [Wed, 1 Aug 2012 08:52:49 +0000 (14:22 +0530)] 
update cuda API wrappers

12 years agoAdd one shot run option to suri-graphite.
Eric Leblond [Fri, 15 Mar 2013 09:24:32 +0000 (10:24 +0100)] 
Add one shot run option to suri-graphite.

12 years agoImport suri-graphite script
Eric Leblond [Wed, 13 Mar 2013 09:50:21 +0000 (10:50 +0100)] 
Import suri-graphite script

This patch import suri-graphite into suricata contrib directory.
This script reads counters from suricata unix socket and send them
to a Graphite graphing server.

12 years agounix-socket: fix OSX build
Eric Leblond [Tue, 18 Jun 2013 08:57:19 +0000 (10:57 +0200)] 
unix-socket: fix OSX build

MSG_NOSIGNAL is not defined on macOSX and SO_NOSIGPIPE is used
instead.

12 years agoaction handling: add test to avoid direct access
Eric Leblond [Tue, 11 Jun 2013 13:41:21 +0000 (15:41 +0200)] 
action handling: add test to avoid direct access

Direct access to the action field of Packet structure is not
allowed.

12 years agoaction handling: use macro for test.
Eric Leblond [Tue, 11 Jun 2013 13:08:01 +0000 (15:08 +0200)] 
action handling: use macro for test.

Use test macro instead of direct access to action field.

This patch has been obtained by using the following
spatch file:

  @@
  Packet *p;
  expression E;
  @@

  - p->action & E
  + TEST_PACKET_ACTION(p, E)

12 years agoaction handling: define and use macros
Eric Leblond [Tue, 11 Jun 2013 12:52:11 +0000 (14:52 +0200)] 
action handling: define and use macros

The action field in Packet structure should not be accessed
directly as the tunneled packet needs to update the root packet
and not the initial packet.

This patch is fixing issue #819 where suricata was not able to
drop fragmented packets in AF_PACKET IPS mode. It also fixes
drop capability for tunneled packets.

12 years agoFix magic unittets.
Anoop Saldanha [Tue, 4 Jun 2013 19:21:55 +0000 (00:51 +0530)] 
Fix magic unittets.

Fix segv, when magic_load() fails due to the non-availability of default
magic files.

12 years agoFix wrong casting of htp pointer. Fixed it back to (HTPState *) inside
Anoop Saldanha [Sun, 16 Jun 2013 17:47:46 +0000 (23:17 +0530)] 
Fix wrong casting of htp pointer.  Fixed it back to (HTPState *) inside
htp utility functions.

12 years agodiscontinue matching on buffer if urilen returns a match failure. 389/head
Anoop Saldanha [Sat, 15 Jun 2013 05:52:16 +0000 (11:22 +0530)] 
discontinue matching on buffer if urilen returns a match failure.

12 years agobytetest: add unittest showing missed detection
Victor Julien [Tue, 11 Jun 2013 10:21:25 +0000 (12:21 +0200)] 
bytetest: add unittest showing missed detection

Tests recursive and relative negative byte_test matching.

12 years agoFix the bug specified in the previous commit. 387/head
Anoop Saldanha [Thu, 13 Jun 2013 14:54:55 +0000 (20:24 +0530)] 
Fix the bug specified in the previous commit.

Bug emanates from byte_test, byte_jump and byte_extract keyword being
unable to handle negative offsets when the inspection pointer is at the
end of the buffer.

12 years agoUnit-tests exposing a bug in byte_test, byte_jump and byte_extract.
Anoop Saldanha [Thu, 13 Jun 2013 14:50:55 +0000 (20:20 +0530)] 
Unit-tests exposing a bug in byte_test, byte_jump and byte_extract.

Bug emanates from all the keywords being unable to handle negative offsets
when the inspection pointer is at the end of the buffer.

12 years agobytetest: fix debug messages not printing negative offset correctly
Victor Julien [Tue, 11 Jun 2013 10:20:37 +0000 (12:20 +0200)] 
bytetest: fix debug messages not printing negative offset correctly

12 years agoAdding an updated doxygen config file, because the old one was created a couple major... 381/head
Phil Schroeder [Tue, 28 May 2013 04:40:54 +0000 (23:40 -0500)] 
Adding an updated doxygen config file, because the old one was created a couple major versions ago.

12 years agoHttp trailer headers unittests added.
Anoop Saldanha [Sun, 26 May 2013 09:29:44 +0000 (14:59 +0530)] 
Http trailer headers unittests added.

12 years agofix for #788. 378/head
Anoop Saldanha [Sat, 25 May 2013 05:08:13 +0000 (10:38 +0530)] 
fix for #788.

Now depth is kept in mind when we inspect chunks in client/server body.
This takes care of FPs originating from inspecting subsequent chunks that
match with depth, but shouldn't.

12 years agoluajit/flowint: add ScFlowintIncr & ScFlowintDecr
Victor Julien [Tue, 23 Apr 2013 09:58:49 +0000 (11:58 +0200)] 
luajit/flowint: add ScFlowintIncr & ScFlowintDecr

Add flowint lua functions for incrementing and decrementing flowints.

First use creates the var and inits to 0. So a call:

    a = ScFlowintIncr(0)

Results in a == 1.

If the var reached UINT_MAX (2^32), it's not further incremented. If the
var reaches 0 it's not decremented further.

Calling ScFlowintDecr on a uninitialized var will init it to 0.

Example script:

    function init (args)
        local needs = {}
        needs["http.request_headers"] = tostring(true)
        needs["flowint"] = {"cnt_incr"}
        return needs
    end

    function match(args)
        a = ScFlowintIncr(0);
        if a == 23 then
            return 1
        end

        return 0
    end
    return 0

This script matches the 23rd time it's invoked on a flow.

12 years agoflowvar/luajit: make 'sets' real time. Needed for cross HTTP-header matching.
Victor Julien [Mon, 22 Apr 2013 15:56:29 +0000 (17:56 +0200)] 
flowvar/luajit: make 'sets' real time. Needed for cross HTTP-header matching.

12 years agoluajit: add flowint support
Victor Julien [Mon, 22 Apr 2013 15:50:43 +0000 (17:50 +0200)] 
luajit: add flowint support

Expose ScFlowintGet and ScFlowintSet functions to luajit. These set
flowints in real time, regardless of rule and/or script match.

Example:

function init (args)
    local needs = {}
    needs["http.request_headers"] = tostring(true)
    needs["flowint"] = {"cnt"}
    return needs
end

function match(args)
    a = ScFlowintGet(0);
    if a then
        ScFlowintSet(0, a + 1)
    else
        ScFlowintSet(0, 1)
    end

    a = ScFlowintGet(0);
    if a == 23 then
        return 1
    end

    return 0
end

return 0

Script's init call first registers "cnt" at id 0, then 0 is used to use
this var.

12 years agoflowvar/flowint: split set functions into normal and NoLock version, where the latter...
Victor Julien [Mon, 22 Apr 2013 15:48:51 +0000 (17:48 +0200)] 
flowvar/flowint: split set functions into normal and NoLock version, where the latter won't lock the flow.

12 years agoflowvar/flowint: make local function static
Victor Julien [Mon, 22 Apr 2013 14:10:50 +0000 (16:10 +0200)] 
flowvar/flowint: make local function static

12 years agoluajit flowvar support
Victor Julien [Mon, 15 Apr 2013 17:59:28 +0000 (19:59 +0200)] 
luajit flowvar support

This patch adds flowvar support to luajit. It does so by exposing two special
C functions to the luajit scripts: ScFlowvarGet and ScFlowvarSet.

12 years agoUpdate configure.ac to detect Tile architecture.
Ken Steele [Mon, 20 May 2013 19:16:47 +0000 (15:16 -0400)] 
Update configure.ac to detect Tile architecture.

Detect if the architecture supports the Tilera mPipe packet processing
hardware. It it does, add the requried libraries and define HAVE_MPIPE.

12 years agoClear the PKT_ALLOC flag when storing Packets into the Packet pool.
Ken Steele [Sat, 18 May 2013 20:01:29 +0000 (16:01 -0400)] 
Clear the PKT_ALLOC flag when storing Packets into the Packet pool.

The PKT_ALLOC flag is set by PacketGetFromAlloc(), which needs to be
cleared for Packets in the Packet Pool, so clear the flag here.

12 years agoMore PacketGetFromMalloc() to allocate packets.
Ken Steele [Fri, 17 May 2013 17:48:32 +0000 (13:48 -0400)] 
More PacketGetFromMalloc() to allocate packets.

12 years agoUse PacketGetfromAlloc() for packet allocation instead of SCMalloc.
Ken Steele [Fri, 17 May 2013 14:05:04 +0000 (10:05 -0400)] 
Use PacketGetfromAlloc() for packet allocation instead of SCMalloc.

Only changed in one file for testing.

12 years agoRemoved Signature->order_id and replaced it with Signature->num.
Anoop Saldanha [Fri, 10 May 2013 16:20:16 +0000 (21:50 +0530)] 
Removed Signature->order_id and replaced it with Signature->num.

12 years ago1. Fix assignment of signums, which affected how we used read
Anoop Saldanha [Thu, 9 May 2013 03:22:05 +0000 (08:52 +0530)] 
1. Fix assignment of signums, which affected how we used read
   sigs(priority wise) inside staging.

   Previously we would assign signums before sig ordering, and hence the
   order didn't actually reflect the order of the sig in the
   sig_list(assuming sig reordering changed the sig_list).  Staging would
   use the old sig_nums to decide the priority of sigs.
2. Fix sig ordering for flowvar, flowbits, flowint, pktvar sigs.   We have
   introduced a new priority to treat sigs with set + read as lower
   priority compared to set only sigs.
3. Previously we treated sigs with a "priority(keyword)" > another sig's
   priority, as a sig with greater priority than the later.  We have
   reversed it.  Now the sig priority ordering is 1,2,.etc.  Updated
   sigordering unittests to reflect the same.

12 years agoAllow protocols to have both app layer keywords, as well as transaction 375/head
Anoop Saldanha [Mon, 20 May 2013 15:46:41 +0000 (21:16 +0530)] 
Allow protocols to have both app layer keywords, as well as transaction
based ones.

Our general logic and assumption is protocols either support one of the
above and not have both.

12 years agoMore lock fixes for the transaction update. Issues reported by Coverity. 374/head
Anoop Saldanha [Sat, 18 May 2013 05:20:51 +0000 (10:50 +0530)] 
More lock fixes for the transaction update.  Issues reported by Coverity.

12 years agoFix luajit compilation failure introduced by the transaction update. 370/head
Anoop Saldanha [Fri, 17 May 2013 10:51:54 +0000 (16:21 +0530)] 
Fix luajit compilation failure introduced by the transaction update.
Fix coverity lock issues reported by transaction update as well.

12 years agoTransaction engine redesigned.
Anoop Saldanha [Fri, 3 May 2013 15:04:58 +0000 (20:34 +0530)] 
Transaction engine redesigned.

Improved accuracy, improved performance.  Performance improvement
noticeable with http heavy traffic and ruleset.

A lot of other cosmetic changes carried out as well.  Wrappers introduced
for a lot of app layer functions.

Failing dce unittests disabled.  Will be reintroduced in the updated dce
engine.

Cross transaction matching taken care of.  FPs emanating from these
matches have now disappeared.  Double inspection of transactions taken
care of as well.

12 years agoTrack transaction progress separately for each direction in libhtp.
Anoop Saldanha [Fri, 3 May 2013 04:33:48 +0000 (10:03 +0530)] 
Track transaction progress separately for each direction in libhtp.

Currently libhtp tracks it using the same var.  This can lead to misleading
states, since a response can come in without a full request.

12 years agohsbd mpm and packet mpm share same mpm ctx id.
Anoop Saldanha [Fri, 12 Apr 2013 07:48:17 +0000 (13:18 +0530)] 
hsbd mpm and packet mpm share same mpm ctx id.

This is a bug emanating from we having a var reference for hsbd mpm,
but failing to initialize it, and we default to using the packet mpm.

12 years agococcinelle: update pkt not set test 361/head
Eric Leblond [Thu, 16 May 2013 08:22:27 +0000 (10:22 +0200)] 
coccinelle: update pkt not set test

This patch updates the test to add the support of initialization
of a Packet via the INITIALIZE macro.

12 years agoPreserve PKT_ALLOC flag inside PACKET_RECYCLE().
Ken Steele [Tue, 14 May 2013 19:38:00 +0000 (15:38 -0400)] 
Preserve PKT_ALLOC flag inside PACKET_RECYCLE().

The PKT_ALLOC flag was being cleared by PACKET_RECYCLE(), which could
then result in a packet being pushed back to the Packet ring buffer
incorrectly.

12 years agoMove memset() out of PACKET_INITIALIZE()
Ken Steele [Tue, 14 May 2013 19:00:21 +0000 (15:00 -0400)] 
Move memset() out of PACKET_INITIALIZE()

The memset() inside PACKET_INITIALIZE() is redundant in some cases and
it is cleaner to do as part of the memory allocation. This simplifies
changes for integrating Tilera mPIPE support because the size of memory
cleared in that case is different from SIZE_OF_PACKET.

For the cases where Packets are directly allocated and then call
PACKET_INITIALIZE() without memset() first, this patch adds memset() calls.

A further change would use GetPacketFromAlloc() directly.

12 years agoMove fallback to CLS detection to configure script.
Victor Julien [Wed, 8 May 2013 12:51:15 +0000 (14:51 +0200)] 
Move fallback to CLS detection to configure script.

12 years agoFix CLS detection on systems that have getconf, but don't support the LEVEL1_DCACHE_L...
Victor Julien [Wed, 8 May 2013 10:41:10 +0000 (12:41 +0200)] 
Fix CLS detection on systems that have getconf, but don't support the LEVEL1_DCACHE_LINESIZE option.

12 years agoDetect L1 cache line size at build time. Fall back to 64 bytes if detection failed.
Victor Julien [Tue, 7 May 2013 12:41:36 +0000 (14:41 +0200)] 
Detect L1 cache line size at build time. Fall back to 64 bytes if detection failed.

12 years agoNFQ: convert batchcount related yaml errors to warnings.
Victor Julien [Mon, 6 May 2013 09:31:24 +0000 (11:31 +0200)] 
NFQ: convert batchcount related yaml errors to warnings.

12 years agoNFQ: fix configure check for finding out signed/unsigned args for nfq_get_payload
Victor Julien [Mon, 6 May 2013 09:10:11 +0000 (11:10 +0200)] 
NFQ: fix configure check for finding out signed/unsigned args for nfq_get_payload

12 years agonfq: add errno display when verdict fail 348/head
Eric Leblond [Thu, 24 Jan 2013 21:37:39 +0000 (22:37 +0100)] 
nfq: add errno display when verdict fail

In case of error, errno is set by sendmsg which is called by
nfnetlink and which is called by libnetfilter_queue. This patch
displays the string expression of errno if verdict has failed.

12 years agonfq: add support for batch verdicts
Florian Westphal [Wed, 16 Jan 2013 12:05:48 +0000 (13:05 +0100)] 
nfq: add support for batch verdicts

Normally, there is one verdict per packet, i.e., we receive a packet,
process it, and then tell the kernel what to do with that packet (eg.
DROP or ACCEPT).

recv(), packet id x
send verdict v, packet id x
recv(), packet id x+1
send verdict v, packet id x+1
[..]
recv(), packet id x+n
send verdict v, packet id x+n

An alternative is to process several packets from the queue, and then send
a batch-verdict.

recv(), packet id x
recv(), packet id x+1
[..]
recv(), packet id x+n
send batch verdict v, packet id x+n

A batch verdict affects all previous packets (packet_id <= x+n),
we thus only need to remember the last packet_id seen.

Caveats:
- can't modify payload
- verdict is applied to all packets
- nfmark (if set) will be set for all packets
- increases latency (packets remain queued by the kernel
  until batch verdict is sent).

To solve this, we only defer verdict for up to 20 packets and
send pending batch-verdict immediately if:
- no packets are currently queue
- current packet should be dropped
- current packet has different nfmark
- payload of packet was modified

This patch adds a configurable batch verdict support for workers runmode.
The batch verdicts are turned off by default.

Problem is that batch verdicts only work with kernels >= 3.1, i.e.
using newer libnetfilter_queue with an old kernel means non-working
suricata. So the functionnality has to be disabled by default.

12 years agonfq: avoid extra copy when running in workers mode
Florian Westphal [Wed, 16 Jan 2013 11:56:44 +0000 (12:56 +0100)] 
nfq: avoid extra copy when running in workers mode

currently, the packet payload recv()d from the nfqueue netlink
socket is copied into a new packet buffer.

This is required because the recv-buffer space used is tied
to the current thread, but a packet may be handed off to other
threads, and the recv-buffer can be re-used while the packet
is handled by another thread.

However, in worker runmode, the packet will always be handled
by the current thread, and the recv-buffer will only be reused
after the entire packet processing stack is done with the packet.

Thus, in worker runmode, we can avoid the copy and assign
the packet data area directly.

12 years agoalert-debuglog: cleanup TCP check
Victor Julien [Tue, 23 Apr 2013 14:09:01 +0000 (16:09 +0200)] 
alert-debuglog: cleanup TCP check

12 years agounified2: more udp fixes
Victor Julien [Tue, 23 Apr 2013 14:08:16 +0000 (16:08 +0200)] 
unified2: more udp fixes

12 years agoprofiling: enabled app layer profiling for UDP app layer modules
Victor Julien [Sat, 20 Apr 2013 09:41:49 +0000 (11:41 +0200)] 
profiling: enabled app layer profiling for UDP app layer modules

12 years agoprelude: only call stream callback for TCP
Victor Julien [Mon, 22 Apr 2013 09:04:24 +0000 (11:04 +0200)] 
prelude: only call stream callback for TCP

12 years agounified2: only call stream callback for TCP
Victor Julien [Mon, 22 Apr 2013 09:04:10 +0000 (11:04 +0200)] 
unified2: only call stream callback for TCP

12 years agoSuppress warnings when StreamSegmentForEach is called for UDP or SCTP, unless debug...
Victor Julien [Mon, 22 Apr 2013 09:03:32 +0000 (11:03 +0200)] 
Suppress warnings when StreamSegmentForEach is called for UDP or SCTP, unless debug is compiled in.

12 years agoUDP: inspection app layer state as soon as we have it.
Victor Julien [Mon, 22 Apr 2013 08:42:50 +0000 (10:42 +0200)] 
UDP: inspection app layer state as soon as we have it.

12 years agoBug 780 unittests, showing no problem.
Victor Julien [Fri, 19 Apr 2013 13:08:43 +0000 (15:08 +0200)] 
Bug 780 unittests, showing no problem.

12 years agoBug 794: stream SACK list needs to respect memcap
Victor Julien [Fri, 19 Apr 2013 13:28:13 +0000 (15:28 +0200)] 
Bug 794: stream SACK list needs to respect memcap

12 years agostream: default 'random' setting when running unittests is disabled, so that test...
Victor Julien [Fri, 19 Apr 2013 10:15:57 +0000 (12:15 +0200)] 
stream: default 'random' setting when running unittests is disabled, so that test results are predictable.

12 years agostreaming: randomize chunk size
Eric Leblond [Wed, 27 Mar 2013 13:08:37 +0000 (14:08 +0100)] 
streaming: randomize chunk size

By randomizing chunk size around the choosen value, it is possible
to escape some evasion technics that are using the fact they know
chunk size to split the attack at the correct place.
This patch activates randomization by default and set the random
interval to chunk size value +- 10%.

12 years agoUpdate DetectContentDataParse to reflect the actual data types content uses.
Victor Julien [Fri, 19 Apr 2013 09:24:20 +0000 (11:24 +0200)] 
Update DetectContentDataParse to reflect the actual data types content uses.

12 years agoRemove filemagic debug statement
Victor Julien [Fri, 19 Apr 2013 09:12:37 +0000 (11:12 +0200)] 
Remove filemagic debug statement

12 years agoRemove obsolete DetectParseContentString function, it has been replaced by DetectCont...
Victor Julien [Fri, 19 Apr 2013 09:07:18 +0000 (11:07 +0200)] 
Remove obsolete DetectParseContentString function, it has been replaced by DetectContentDataParse

12 years agofile: make fileext, filename and filemagic use the same rule parsing function as...
Victor Julien [Fri, 19 Apr 2013 09:04:00 +0000 (11:04 +0200)] 
file: make fileext, filename and filemagic use the same rule parsing function as others. This has as a side effect that we enforce doubly qouted values now.

12 years agoflowvar: cleanup keyword argument parsing. Should also address Coverity 400655.
Victor Julien [Fri, 19 Apr 2013 08:38:51 +0000 (10:38 +0200)] 
flowvar: cleanup keyword argument parsing. Should also address Coverity 400655.

12 years agoCoverity 1005134: fix minor memory leak on flowvar rule setup errors.
Victor Julien [Fri, 19 Apr 2013 08:05:38 +0000 (10:05 +0200)] 
Coverity 1005134: fix minor memory leak on flowvar rule setup errors.

12 years agoCoverity 1005133: fix unlikely case where malformed pcre statement in rule would...
Victor Julien [Fri, 19 Apr 2013 08:02:36 +0000 (10:02 +0200)] 
Coverity 1005133: fix unlikely case where malformed pcre statement in rule would lead to null-deref.

12 years agostream: handle extra different SYN/ACK
Victor Julien [Sat, 6 Apr 2013 18:54:25 +0000 (20:54 +0200)] 
stream: handle extra different SYN/ACK

Until now, when processing the TCP 3 way handshake (3whs), retransmissions
of SYN/ACKs are silently accepted, unless they are different somehow. If
the SEQ or ACK values are different they are considered wrong and events
are set. The stream events rules will match on this.

In some cases, this is wrong. If the client missed the SYN/ACK, the server
may send a different one with a different SEQ. This commit deals with this.

As it is impossible to predict which one the client will accept, each is
added to a list. Then on receiving the final ACK from the 3whs, the list
is checked and the state is updated according to the queued SYN/ACK.

12 years agoflowvar: clean up properly on signature clean up.
Victor Julien [Wed, 17 Apr 2013 09:58:00 +0000 (11:58 +0200)] 
flowvar: clean up properly on signature clean up.

12 years agoflowvar: add unittests for #802.
Victor Julien [Wed, 17 Apr 2013 09:05:08 +0000 (11:05 +0200)] 
flowvar: add unittests for #802.

12 years agoflowvar: fix deadlock with http buffers
Victor Julien [Tue, 16 Apr 2013 19:47:42 +0000 (21:47 +0200)] 
flowvar: fix deadlock with http buffers

Bug #802

Flowvars are set from pcre, and lock the flow when being set. However
when HTTP buffers were inspected, flow was already locked: deadlock.

This patch introduces a post-match list in the detection engine thread
ctx, where store candidates are kept. Then a post-match function is used
to finalize the storing if the rule matches.

Solves the deadlock and brings the handling of flowvars more in line
with flowbits and flowints.

12 years agoflowvars: update funcs to accept u16 id
Victor Julien [Tue, 16 Apr 2013 12:53:23 +0000 (14:53 +0200)] 
flowvars: update funcs to accept u16 id

All id's are u16, but flowvar functions would only accept u8.

Minor cleanups.

12 years agoprofiling: add formatted totals, percents to packet stats
Victor Julien [Thu, 11 Apr 2013 12:59:03 +0000 (14:59 +0200)] 
profiling: add formatted totals, percents to packet stats

12 years agoMinor SigValidate cleanup
Victor Julien [Fri, 12 Apr 2013 08:45:54 +0000 (10:45 +0200)] 
Minor SigValidate cleanup

12 years agoUpdate the way we handle http_host keywords.
Anoop Saldanha [Wed, 27 Mar 2013 09:25:05 +0000 (14:55 +0530)] 
Update the way we handle http_host keywords.

Previously we would have forced all users to use nocase with http_host
keywords(since the hostname buffer is lowercase).

We now error out on sigs that has nocase set with http_host set.  Also if
the http_host pattern or http_host pcre has an uppercase character set, we
invalidate such sigs.  Unittests also updated to reflect the above change.

12 years agoMinor reshuffling of Signature struct.
Victor Julien [Wed, 10 Apr 2013 08:51:00 +0000 (10:51 +0200)] 
Minor reshuffling of Signature struct.

12 years agoUse define instead of magic number for pmq's per detect thread
Victor Julien [Wed, 10 Apr 2013 08:30:48 +0000 (10:30 +0200)] 
Use define instead of magic number for pmq's per detect thread

12 years agodetection engine: consolidate thread setup
Victor Julien [Wed, 10 Apr 2013 08:22:32 +0000 (10:22 +0200)] 
detection engine: consolidate thread setup

DetectEngineThreadCtxInit and DetectEngineThreadCtxInitForLiveRuleSwap did
pretty much the same thing, except for a counters registration. As can be
predicted with code duplication like this, things got out of sync. To make
sure this doesn't happen again, I created a helper function that does the
heavy lifting in this function.

12 years agoFix PmqSetup calls in Liveswap thread init. Func was out of sync with normal thread...
Victor Julien [Wed, 10 Apr 2013 08:06:30 +0000 (10:06 +0200)] 
Fix PmqSetup calls in Liveswap thread init. Func was out of sync with normal thread init.

12 years agoUpdate comment in yaml to indicate size limit for the following vars -
Anoop Saldanha [Tue, 19 Mar 2013 12:49:15 +0000 (18:19 +0530)] 
Update comment in yaml to indicate size limit for the following vars -
stream.reassembly.toserver-chunk-size and stream.reassembly.toclient-chunk-size

12 years agococcinelle: add tcp flag check 341/head
Eric Leblond [Mon, 8 Apr 2013 17:16:31 +0000 (19:16 +0200)] 
coccinelle: add tcp flag check

The different TCP related structures have all a flags field and its
value must match the type of structure. This patch adds a check
alerting on invalid value usage.

12 years agostream: intro function for SYN/ACK state update
Victor Julien [Sat, 6 Apr 2013 15:52:44 +0000 (17:52 +0200)] 
stream: intro function for SYN/ACK state update

As the TCP SSN state can be updated from several points in the state
machine on accepting a SYN/ACK, move the update logic into a separate
function.

12 years agostream: remove unused 'pause' feature
Victor Julien [Sat, 6 Apr 2013 15:40:13 +0000 (17:40 +0200)] 
stream: remove unused 'pause' feature

12 years agostream: zero ts is a per stream flag
Victor Julien [Sat, 6 Apr 2013 15:26:33 +0000 (17:26 +0200)] 
stream: zero ts is a per stream flag

Ssn flag STREAMTCP_FLAG_ZERO_TIMESTAMP was used in stream only. Due to
it's value it did not conflict with a real stream flag. Renamed it to
STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP.