]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
11 years agopfring: fix live device counter usage 757/head
Eric Leblond [Tue, 31 Dec 2013 15:09:43 +0000 (16:09 +0100)] 
pfring: fix live device counter usage

Live device counter was in fact the number of packets seen by suricata
and not the total number of packet reported by pfring. This patch fixes
this by using counter provided by kernel instead.

Pfring kernel counter is per socket and is not cleared after read.
So to get the number of packet on the interface we can add the new
value for this thread and add it to the interface counter.

11 years agoaf-packet: fix live device counter usage
Eric Leblond [Tue, 31 Dec 2013 15:13:50 +0000 (16:13 +0100)] 
af-packet: fix live device counter usage

Live device counter was in fact the number of packets seen by suricata
and not the total number of packet reported by kernel. This patch fixes
this by using counter provided by kernel instead.
The counter is Clear On Read, so by adding the value fetch at each call
and earch sockets we get the number of packets and drops for the
interface.

11 years agocapture: display exit stats at default verbosity
Eric Leblond [Tue, 31 Dec 2013 14:09:10 +0000 (15:09 +0100)] 
capture: display exit stats at default verbosity

This patch updates capture modes not using LiveDecice counters
to display per-thread exit statistics with default verbosity.

11 years agodevice list: clean and display stat at exit
Eric Leblond [Tue, 31 Dec 2013 14:04:33 +0000 (15:04 +0100)] 
device list: clean and display stat at exit

This patch adds a cleaning function to device list. This also
permits to display per-interface statistics during the exit.

11 years agoFix the segmentation fault while logging the host on the custom HTTP logger.
Duarte Silva [Thu, 19 Dec 2013 14:07:30 +0000 (14:07 +0000)] 
Fix the segmentation fault while logging the host on the custom HTTP logger.
- Seems to be a regression introduced in the commit
  796bfab2317699779bb0d7dca257bb97083399d8 (fix was already done in commit
  ee0b21652b00f9398869b097c3ddceb9f86600a9)
- Doesn't happen with htplib v0.5.6, but it does in the latest, v0.5.9

11 years agococcinelle: protecting regexp operator is not needed
Eric Leblond [Fri, 20 Dec 2013 09:23:39 +0000 (10:23 +0100)] 
coccinelle: protecting regexp operator is not needed

It seems there was an evolution of coccinelle and the protection
of regexp is not necessary anymore. And doing it causing the
expression not to match.

11 years agofix size_t printing
Eric Leblond [Fri, 20 Dec 2013 09:22:25 +0000 (10:22 +0100)] 
fix size_t printing

This two problem were found by the new version of the size_t cocci
test.

11 years agoapp-layer: only typedef opaque pointers once 753/head
Victor Julien [Fri, 10 Jan 2014 09:15:48 +0000 (10:15 +0100)] 
app-layer: only typedef opaque pointers once

11 years agoapp layer: void -> AppLayerProtoDetectThreadCtx
Victor Julien [Thu, 9 Jan 2014 15:40:59 +0000 (16:40 +0100)] 
app layer: void -> AppLayerProtoDetectThreadCtx

User AppLayerProtoDetectThreadCtx ptr instead of void.

11 years agoUpdate tests to use AppLayerParserThreadCtx ptr instead of void. Fix a few bugs uncov...
Victor Julien [Thu, 9 Jan 2014 15:20:21 +0000 (16:20 +0100)] 
Update tests to use AppLayerParserThreadCtx ptr instead of void. Fix a few bugs uncovered by this.

11 years agoapp-layer: Use opaque pointers instead of void
Victor Julien [Thu, 9 Jan 2014 14:10:37 +0000 (15:10 +0100)] 
app-layer: Use opaque pointers instead of void

For AppLayerThreadCtx, AppLayerParserState, AppLayerParserThreadCtx
and AppLayerProtoDetectThreadCtx, use opaque pointers instead of
void pointers.

AppLayerParserState is declared in flow.h as it's part of the Flow
structure.

AppLayerThreadCtx is declared in decode.h, as it's part of the
DecodeThreadVars structure.

11 years agoFix HTPBodyReassemblyTest01 Asan error
Victor Julien [Thu, 9 Jan 2014 11:40:08 +0000 (12:40 +0100)] 
Fix HTPBodyReassemblyTest01 Asan error

Fix improper pointer assignment in HTPBodyReassemblyTest01, causing
ASAN to error out.

11 years agoapp-layer: rename AppLayerThreadCtx funcs
Victor Julien [Thu, 9 Jan 2014 11:13:03 +0000 (12:13 +0100)] 
app-layer: rename AppLayerThreadCtx funcs

AppLayerParserGetCtxThread -> AppLayerParserThreadCtxAlloc
AppLayerParserDestroyCtxThread -> AppLayerParserThreadCtxFree

11 years agoapp layer: fix memory leak
Victor Julien [Thu, 9 Jan 2014 10:52:46 +0000 (11:52 +0100)] 
app layer: fix memory leak

Actually free the ctx in AppLayerParserDestroyCtxThread

11 years agoapp layer: uint16_t alproto -> AppProto alproto
Victor Julien [Thu, 9 Jan 2014 10:32:40 +0000 (11:32 +0100)] 
app layer: uint16_t alproto -> AppProto alproto

This conversion was missing in a couple of places.

11 years agoUse u8 for ipproto
Victor Julien [Thu, 9 Jan 2014 10:19:58 +0000 (11:19 +0100)] 
Use u8 for ipproto

In a few places in app layer and unittests u16 was used.

11 years agoApp Layer: cleanup state func naming
Victor Julien [Thu, 9 Jan 2014 10:06:59 +0000 (11:06 +0100)] 
App Layer: cleanup state func naming

Rename functions related to AppLayerState to be more consistent.

11 years agoRename AppLayerProtoDetectCtxThread -> AppLayerProtoDetectThreadCtx
Victor Julien [Thu, 9 Jan 2014 09:41:22 +0000 (10:41 +0100)] 
Rename AppLayerProtoDetectCtxThread -> AppLayerProtoDetectThreadCtx

11 years agoRename AppLayerParserParserState -> AppLayerParserState
Victor Julien [Thu, 9 Jan 2014 09:38:12 +0000 (10:38 +0100)] 
Rename AppLayerParserParserState -> AppLayerParserState

11 years agoRename AppLayerParserpCtx -> AppLayerParserProtoCtx
Victor Julien [Thu, 9 Jan 2014 09:33:54 +0000 (10:33 +0100)] 
Rename AppLayerParserpCtx -> AppLayerParserProtoCtx

11 years agoRename AppLayerParserCtxThread -> AppLayerParserThreadCtx
Victor Julien [Thu, 9 Jan 2014 09:28:34 +0000 (10:28 +0100)] 
Rename AppLayerParserCtxThread -> AppLayerParserThreadCtx

11 years agoRename AppLayerCtxThread -> AppLayerThreadCtx
Victor Julien [Thu, 9 Jan 2014 09:25:33 +0000 (10:25 +0100)] 
Rename AppLayerCtxThread -> AppLayerThreadCtx

11 years agodetect unittests: clang build fix and cleanups
Victor Julien [Thu, 9 Jan 2014 09:10:19 +0000 (10:10 +0100)] 
detect unittests: clang build fix and cleanups

A number of unittests would lead to clang build errors because
of unsafe det_ctx ptr usage. This patch fixes these and inits
det_ctx to NULL in the other detect tests.

11 years agoApp Layer: fix memory leaks
Victor Julien [Wed, 8 Jan 2014 17:43:48 +0000 (18:43 +0100)] 
App Layer: fix memory leaks

Call FlowCleanupAppLayer before setting f->proto to 0, as the former
bails out without doing anything if proto is 0.

11 years agoFix AppLayerProtoDetectPMFreeSignature related valgrind errors
Victor Julien [Wed, 8 Jan 2014 17:10:16 +0000 (18:10 +0100)] 
Fix AppLayerProtoDetectPMFreeSignature related valgrind errors

11 years agoapp proto detect: fix valgrind test warnings
Victor Julien [Wed, 8 Jan 2014 16:20:58 +0000 (17:20 +0100)] 
app proto detect: fix valgrind test warnings

Only in unittests when debug is enabled would valgrind warn about
a print statement.

11 years agoCleanup and fix scan-build warning
Victor Julien [Wed, 8 Jan 2014 16:05:04 +0000 (17:05 +0100)] 
Cleanup and fix scan-build warning

Add comments and slightly refactor to make function more understandable
and fix a scan-build warning too.

11 years agoscan-build fixes
Victor Julien [Wed, 8 Jan 2014 16:04:49 +0000 (17:04 +0100)] 
scan-build fixes

11 years agoprofiling: fix compilation
Victor Julien [Wed, 8 Jan 2014 15:11:43 +0000 (16:11 +0100)] 
profiling: fix compilation

Stream engine can't access app layer proto detection datatypes
anymore, so moved some of the logic into app-layer.c

11 years agocompile fixes
Victor Julien [Wed, 8 Jan 2014 15:11:21 +0000 (16:11 +0100)] 
compile fixes

11 years agoVarious style fixes
Victor Julien [Wed, 8 Jan 2014 15:10:26 +0000 (16:10 +0100)] 
Various style fixes

11 years agoApp layer API rewritten. The main files in question are: 745/head
Anoop Saldanha [Tue, 24 Dec 2013 10:00:57 +0000 (15:30 +0530)] 
App layer API rewritten.  The main files in question are:
app-layer.[ch], app-layer-detect-proto.[ch] and app-layer-parser.[ch].

Things addressed in this commit:
- Brings out a proper separation between protocol detection phase and the
  parser phase.
- The dns app layer now is registered such that we don't use "dnstcp" and
  "dnsudp" in the rules.  A user who previously wrote a rule like this -

  "alert dnstcp....." or
  "alert dnsudp....."

  would now have to use,

  alert dns (ipproto:tcp;) or
  alert udp (app-layer-protocol:dns;) or
  alert ip (ipproto:udp; app-layer-protocol:dns;)

  The same rules extend to other another such protocol, dcerpc.
- The app layer parser api now takes in the ipproto while registering
  callbacks.
- The app inspection/detection engine also takes an ipproto.
- All app layer parser functions now take direction as STREAM_TOSERVER or
  STREAM_TOCLIENT, as opposed to 0 or 1, which was taken by some of the
  functions.
- FlowInitialize() and FlowRecycle() now resets proto to 0.  This is
  needed by unittests, which would try to clean the flow, and that would
  call the api, AppLayerParserCleanupParserState(), which would try to
  clean the app state, but the app layer now needs an ipproto to figure
  out which api to internally call to clean the state, and if the ipproto
  is 0, it would return without trying to clean the state.
- A lot of unittests are now updated where if they are using a flow and
  they need to use the app layer, we would set a flow ipproto.
- The "app-layer" section in the yaml conf has also been updated as well.

11 years agoUse a typdef AppProto <-> uint16_t for representing app layer protocol.
Anoop Saldanha [Fri, 6 Dec 2013 11:51:57 +0000 (17:21 +0530)] 
Use a typdef AppProto <-> uint16_t for representing app layer protocol.

Some minor refactoring/cleanup, including renaming functions.

11 years agoDisabling the ssh parser temporarily, since we are moving away from some
Anoop Saldanha [Wed, 23 Oct 2013 05:55:46 +0000 (11:25 +0530)] 
Disabling the ssh parser temporarily, since we are moving away from some
of the archaic features we use in the app layer. We will reintroduce this
parser shortly. Also do note that keywords that rely on the ssh parser
would now be disabled.

11 years agoUpdate Changelog for 2.0beta2 suricata-2.0beta2
Victor Julien [Wed, 18 Dec 2013 13:01:28 +0000 (14:01 +0100)] 
Update Changelog for 2.0beta2

11 years agoconf: fix potential use-after-free on error 730/head
Victor Julien [Wed, 18 Dec 2013 11:23:50 +0000 (12:23 +0100)] 
conf: fix potential use-after-free on error

Coverity 1139544

If strdup would fail, 'node' was freed but it wasn't set to NULL. The
code then returned node. The caller would not detect there was an error
and use the freed pointer.

11 years agostream: fix potential memory loss on error
Victor Julien [Wed, 18 Dec 2013 11:17:56 +0000 (12:17 +0100)] 
stream: fix potential memory loss on error

Coverity 1139543.

If StreamTcpPseudoPacket would be called with len == 0, the packet
it acquired before checking the len value would be lost.

11 years agoRevert TmqhFlowMode alignment as it breaks on CLANG
Victor Julien [Fri, 13 Dec 2013 11:50:43 +0000 (12:50 +0100)] 
Revert TmqhFlowMode alignment as it breaks on CLANG

11 years agorealloc error handling: remove unnecessary else branch
Victor Julien [Fri, 13 Dec 2013 11:20:00 +0000 (12:20 +0100)] 
realloc error handling: remove unnecessary else branch

11 years agococcinelle: add test on realloc
Eric Leblond [Thu, 12 Dec 2013 12:34:54 +0000 (13:34 +0100)] 
coccinelle: add test on realloc

If we use SCRealloc like:
 x = SCRealloc(x, ...)
then in case of failure we are loosing the original pointer value
and the memory is lost and can not be free.

This test just check for this construction and output an error if
it finds it.

11 years agoFix realloc error handling
Eric Leblond [Thu, 12 Dec 2013 12:10:01 +0000 (13:10 +0100)] 
Fix realloc error handling

This patch is fixing realloc error handling. In case of a realloc
failure, it free the initial memory and continue existing error
handling.

The patch has been obtained via the following semantic patch and
a bit oh hand editing:

@@
expression x, E;
identifier f;
@@

f(...)
{
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (x == NULL)
+ if (ptmp == NULL)
{
+ SCFree(x);
+ x = NULL;
...
- }
+ } else {
+     x = ptmp;
+ }
...+>
}

@@
expression x, E;
identifier f;
statement ES;
@@

f(...) {
+ void *ptmp;

<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (x == NULL) ES
+ if (ptmp == NULL) {
+ SCFree(x);
+ x = NULL;
+ ES
+ } else {
+     x = ptmp;
+ }
...+>

}

@@
expression x, E;
identifier f;
@@

f(...)
{
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (unlikely(x == NULL))
+ if (unlikely(ptmp == NULL))
{
+ SCFree(x);
+ x = NULL;
...
- }
+ } else {
+     x = ptmp;
+ }
...+>
}

@@
expression x, E;
identifier f;
statement ES;
@@

f(...) {
+ void *ptmp;

<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (unlikely(x == NULL)) ES
+ if (unlikely(ptmp == NULL)) {
+ SCFree(x);
+ x = NULL;
+ ES
+ } else {
+     x = ptmp;
+ }
...+>

}

11 years agoFix filemagic unittests on OS_DARWIN
Victor Julien [Thu, 12 Dec 2013 16:01:49 +0000 (17:01 +0100)] 
Fix filemagic unittests on OS_DARWIN

11 years agoAdd const for Packet * in flow functions.
Ken Steele [Sat, 16 Nov 2013 16:13:42 +0000 (11:13 -0500)] 
Add const for Packet * in flow functions.

By moving FlowReference() out of FlowGetFlowFromHash() and into the one
function that calls it, all the flow functions take const Packet * instead
of Packet *.

11 years agodefrag-config: fix a bug
Giuseppe Longo [Thu, 12 Dec 2013 22:03:42 +0000 (23:03 +0100)] 
defrag-config: fix a bug

A ptr to local var is stored in the radix tree currently,
this patch permits to alloc space to store host timeout
and thus also free it when data is removed.

11 years agodefrag: fix compiler warning
Victor Julien [Thu, 12 Dec 2013 18:28:22 +0000 (19:28 +0100)] 
defrag: fix compiler warning

defrag-config.c: In function 'DefragParseParameters':
defrag-config.c:105: warning: passing argument 2 of 'DefragPolicyAddHostInfo' from incompatible pointer type
make[3]: *** [defrag-config.o] Error 1

11 years agodebug: fix realloc error checking on flowbit print 720/head
Victor Julien [Wed, 11 Dec 2013 12:26:55 +0000 (13:26 +0100)] 
debug: fix realloc error checking on flowbit print

detect.c:1074:17: warning: Potential leak of memory pointed to by \
                                field 'debuglog_flowbits_names'
                return;

Bug #1062.

11 years agoDER decoding: fix potential memory leak
Victor Julien [Wed, 11 Dec 2013 10:00:41 +0000 (11:00 +0100)] 
DER decoding: fix potential memory leak

This would only happen in memory failure conditions.

util-decode-der.c:634:27: warning: Potential leak of memory pointed to by 'child'
    return (Asn1Generic *)node;

11 years agodetect-ssl: suppress harmless scan-build warning
Victor Julien [Wed, 11 Dec 2013 09:35:41 +0000 (10:35 +0100)] 
detect-ssl: suppress harmless scan-build warning

detect-ssl-version.c:271:17: warning: Value stored to 'neg' is never read
                neg = 0;

11 years agostream: suppress minor scan-build warnings
Victor Julien [Wed, 11 Dec 2013 09:33:15 +0000 (10:33 +0100)] 
stream: suppress minor scan-build warnings

stream-tcp-reassemble.c:2569:17: warning: Value stored to 'seg' is never read
                seg = seg->next;
                ^     ~~~~~~~~~
stream-tcp-reassemble.c:2587:17: warning: Value stored to 'seg' is never read
                seg = seg->next;

11 years agodns: suppress minor scan-build warnings
Victor Julien [Wed, 11 Dec 2013 09:31:27 +0000 (10:31 +0100)] 
dns: suppress minor scan-build warnings

These were only used if debug is enabled.

app-layer-dns-tcp.c:407:13: warning: Value stored to 'length' is never read
            length = *data;
app-layer-dns-udp.c:236:13: warning: Value stored to 'length' is never read
            length = *data;

11 years agodns: suppress harmless cppcheck warning
Victor Julien [Wed, 11 Dec 2013 09:29:19 +0000 (10:29 +0100)] 
dns: suppress harmless cppcheck warning

[src/app-layer-dns-common.c:273]: (warning) Assignment of function \
                        parameter has no effect outside the function.

11 years agohttp: clear header pointer on realloc failure
Victor Julien [Wed, 11 Dec 2013 09:13:02 +0000 (10:13 +0100)] 
http: clear header pointer on realloc failure

Fixes:

detect-engine-hhd.c:188:5: warning: Use of memory after it is freed
    return headers_buffer;

11 years agodns: fix passing NULL to memcpy
Victor Julien [Wed, 11 Dec 2013 09:11:13 +0000 (10:11 +0100)] 
dns: fix passing NULL to memcpy

app-layer-dns-common.c:401:5: warning: Null pointer passed as \
                              an argument to a 'nonnull' parameter
    memcpy(ptr, fqdn, fqdn_len);

11 years agolog-http: fix compiler warning
Victor Julien [Wed, 11 Dec 2013 08:44:42 +0000 (09:44 +0100)] 
log-http: fix compiler warning

log-httplog.c:180: warning: 'cvalue' may be used uninitialized in \
this function

11 years agodefrag: pass u64 to ParseU64
Victor Julien [Wed, 11 Dec 2013 08:35:41 +0000 (09:35 +0100)] 
defrag: pass u64 to ParseU64

Fixes: defrag-config.c:97: warning: passing argument 2 \
       of 'ParseSizeStringU64' from incompatible pointer type

11 years agoFix uninitialized variable warning.
Ken Steele [Wed, 11 Dec 2013 14:48:50 +0000 (09:48 -0500)] 
Fix uninitialized variable warning.

These two lines reported warnings with -Werror -O3 on Tile.

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.