]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
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

11 years agoConvert ParseSizeString to use pcre_copy_substring
Victor Julien [Wed, 27 Nov 2013 20:15:48 +0000 (21:15 +0100)] 
Convert ParseSizeString to use pcre_copy_substring

11 years agorule parser: don't use uninitialized value
Victor Julien [Wed, 27 Nov 2013 19:28:28 +0000 (20:28 +0100)] 
rule parser: don't use uninitialized value

11 years agofeature #417: add support for configuration per host timeout value
Giuseppe Longo [Sat, 12 Oct 2013 10:02:49 +0000 (12:02 +0200)] 
feature #417: add support for configuration per host timeout value

11 years agorule parsing cleanups
Victor Julien [Wed, 27 Nov 2013 17:42:29 +0000 (18:42 +0100)] 
rule parsing cleanups

Clean up usage of array of pointers to the various parts of a rule.

11 years agorule parsing: reduce mallocs and clean up
Victor Julien [Wed, 27 Nov 2013 17:19:52 +0000 (18:19 +0100)] 
rule parsing: reduce mallocs and clean up

Reduce mallocs during rule parsing. Also, no longer recursively
call the option parse function.

11 years agoaddress and port: reduce memory allocs
Victor Julien [Wed, 27 Nov 2013 15:28:37 +0000 (16:28 +0100)] 
address and port: reduce memory allocs

11 years agoRemove the single line if statements.
Jason Ish [Tue, 26 Nov 2013 16:16:04 +0000 (10:16 -0600)] 
Remove the single line if statements.

11 years agoSupport for configuration include files.
Jason Ish [Mon, 28 Oct 2013 19:32:05 +0000 (13:32 -0600)] 
Support for configuration include files.

11 years agosignature address parsing improvements and tests 660/head
Victor Julien [Wed, 27 Nov 2013 10:43:52 +0000 (11:43 +0100)] 
signature address parsing improvements and tests

Fix sigatures not supporting [10.0.0.0/24, !10.1.1.1] notation when
used directly in a rule instead of through a variable.

Add tests for Bugs #815 and #920.

11 years agovalgrind: add suppression file
Victor Julien [Tue, 26 Nov 2013 16:15:41 +0000 (17:15 +0100)] 
valgrind: add suppression file

11 years agohttp: use body limit in inspection
Victor Julien [Tue, 26 Nov 2013 13:05:53 +0000 (14:05 +0100)] 
http: use body limit in inspection

When inspecting HTTP bodies there are several limits involved.
In this patch the reaching of the body limit will trigger body
inspection.

Without this, the body would only be inspected when inspection
limits "request-body-minimal-inspect-size" or
"response-body-minimal-inspect-size" were reached. If the body
limit was smaller than this value, the body would only be
inspected at the end of the tx or stream.

11 years agoFix using uninitialized memory (Bug #994)
Victor Julien [Mon, 25 Nov 2013 18:38:14 +0000 (19:38 +0100)] 
Fix using uninitialized memory (Bug #994)

11 years agoutil-ioctl: ioctl error should be a warning 657/head
Eric Leblond [Thu, 21 Nov 2013 10:19:17 +0000 (11:19 +0100)] 
util-ioctl: ioctl error should be a warning

11 years agopcap: add warning about GRO and LRO usage
Eric Leblond [Wed, 20 Nov 2013 10:47:28 +0000 (11:47 +0100)] 
pcap: add warning about GRO and LRO usage

Use the new GetIfaceOffloading function to display a warning message
if pcap capture is used on Linux with GRO or LRO activated. This is
helpful for kernel after 2.6.31 were pcap will use mmaped capture.
TPACKET_V2 is used and this limit the size of the packet resulting
in truncated packets when merged packets are received.

11 years agoaf-packet: add warning message if LRO or GRO are set
Eric Leblond [Tue, 19 Nov 2013 15:10:38 +0000 (16:10 +0100)] 
af-packet: add warning message if LRO or GRO are set

This patch query the network interface to detect if LRO or GRO are
used in mmap TPACKET_V2 mode.

11 years agoutil-ioctl: add GRO/LRO detection capabilities
Eric Leblond [Tue, 19 Nov 2013 14:59:17 +0000 (15:59 +0100)] 
util-ioctl: add GRO/LRO detection capabilities

This patch adds a new function GetIfaceOffloading which return 0
if LRO and GRO are not set on a interface and 1 if not the case.

11 years agoutil-ioctl: minor code cleaning.
Eric Leblond [Tue, 19 Nov 2013 10:26:54 +0000 (11:26 +0100)] 
util-ioctl: minor code cleaning.

Fix author e-mail and simplify an indentation.

11 years agopfring: improve error reporting at device opening
Eric Leblond [Tue, 19 Nov 2013 10:06:50 +0000 (11:06 +0100)] 
pfring: improve error reporting at device opening

This patch improves the error message displayed if pfring_open fails.

11 years agodetect: don't consider smsgs for no inspect flag
Victor Julien [Fri, 22 Nov 2013 17:11:10 +0000 (18:11 +0100)] 
detect: don't consider smsgs for no inspect flag

When the PKT_NOPAYLOAD_INSPECTION flag is set, don't apply it to smsgs.
This way we can still inspect the outstanding smsgs.

The PKT_NOPAYLOAD_INSPECTION is set for encrypted traffic, and is combined
with disabling stream reassembly. So we only inspect the smsgs up to the
point of the disable detection point.

11 years agostream: improve raw reassembly
Victor Julien [Fri, 22 Nov 2013 17:00:54 +0000 (18:00 +0100)] 
stream: improve raw reassembly

When checking the reassembly limit for raw reassembly, consider the
STREAMTCP_STREAM_FLAG_NOREASSEMBLY a trigger immediately. We won't
process any more segments in the reassembly engine anyway.

11 years agoFix autofp flow queue handler optimization
Victor Julien [Thu, 21 Nov 2013 14:14:30 +0000 (15:14 +0100)] 
Fix autofp flow queue handler optimization

11 years agobuild-info: add a nicer way of printing atomics support 650/head
Victor Julien [Wed, 20 Nov 2013 16:22:32 +0000 (17:22 +0100)] 
build-info: add a nicer way of printing atomics support

11 years agoflow: aligned flow balance structures (used by autofp) to CLS to reduce false sharing
Victor Julien [Thu, 21 Nov 2013 10:34:40 +0000 (11:34 +0100)] 
flow: aligned flow balance structures (used by autofp) to CLS to reduce false sharing

11 years agohttp: add meta-field-limit option 649/head
Victor Julien [Thu, 21 Nov 2013 12:22:52 +0000 (13:22 +0100)] 
http: add meta-field-limit option

The meta-field-option allows for setting the hard limit of request
and response fields in HTTP. In requests this applies to the request
line and headers, not the body. In responses, this applies to the
response line and headers, not the body.

Libhtp uses a default limit of 18k. If this is reached an event is
raised.

Ticket 986.

11 years agoSSE 4.2 memcmp: don't read beyond var boundary 644/head
Victor Julien [Wed, 20 Nov 2013 10:57:26 +0000 (11:57 +0100)] 
SSE 4.2 memcmp: don't read beyond var boundary

In the SSE 4.2 SCMemcmpLowercase implementation, there would be a
_mm_load_si128 of a 2 byte array. However, _mm_load_si128 loads
16 bytes, causing it to read beyond the var. I don't think this lead
to crashes, as it was a static var, but clangs ASAN complained about
it.

11 years agoReduce the size of Packet structure
Ken Steele [Tue, 19 Nov 2013 14:53:21 +0000 (09:53 -0500)] 
Reduce the size of Packet structure

Share memory space for IPV4Vars and (IPV6Vars, IPV6ExtHdrs), since a
packet can only be either IPv4 or IPv6, but not both.

Share memory for TCPVars, UDPVars, ICMPV4Vars and ICMPV6Vars, since a
packet can only be only of these.

Then move other structure members around to remove holes reported by pahole.

This reduces the size of the Packet structure from 2944 bytes (46 cachelines)
down to 1976 (31 cachelines), a 33% reduction.

11 years agohttp: strip 'proxy' part of http_uri 640/head
Victor Julien [Tue, 19 Nov 2013 14:26:36 +0000 (15:26 +0100)] 
http: strip 'proxy' part of http_uri

Strip the 'proxy' parts from the normalized uri as inspected by http_uri,
urilen, pcre /U and others.

  In a request line like:
    GET http://suricata-ids.org/blah/ HTTP/1.1
  the normalized URI will now be:
    /blah/

This doesn't affect http_raw_uri. So matching the hostname, etc is still
possible through this keyword.

Additionally, a new per HTTP 'personality' option was added to change
this behavior: "uri-include-all":

  uri-include-all: <true|false>
    Include all parts of the URI. By default the
    'scheme', username/password, hostname and port
    are excluded. Setting this option to true adds
    all of them to the normalized uri as inspected
    by http_uri, urilen, pcre with /U and the other
    keywords that inspect the normalized uri.
    Note that this does not affect http_raw_uri.

So adding uri-include-all:true to all personalities in the yaml will
restore the old default behavior.

Ticket 1008.

11 years agoAllocate mPIPE packet ingress queue in each worker thread.
Ken Steele [Tue, 12 Nov 2013 20:47:56 +0000 (15:47 -0500)] 
Allocate mPIPE packet ingress queue in each worker thread.

Move the allocation of the mPipe ingress queue from a loop over
the number of workers in the main init function to being done inside
each worker thread. This allows allocating the memory locally on the
worker's CPU without needing to figure out ahead of time where that thread
will be running. This fixes one case of static mapping of workers to CPUs.

Use __thread to hold the queue rather than a global tables of queues.

11 years agoCleanup Tile build for -Werror
Ken Steele [Mon, 18 Nov 2013 18:28:17 +0000 (13:28 -0500)] 
Cleanup Tile build for -Werror

Just the changes needed for the Tile architecture to compile cleanly with
-Werror.

11 years agoRename checksums to level3_comp_csum and level4_comp_csum.
Ken Steele [Mon, 18 Nov 2013 22:02:50 +0000 (17:02 -0500)] 
Rename checksums to level3_comp_csum and level4_comp_csum.

This will also sharing even more memory in the Packet_ structure.

11 years agosuricata: move some code into PostConfLoadedSetup
Eric Leblond [Mon, 18 Nov 2013 17:12:36 +0000 (18:12 +0100)] 
suricata: move some code into PostConfLoadedSetup

All functions before daemonization are initialisation functions and thus the
call can be moved in PostConfLoadedSetup.

11 years agoRemove mkinstalldirs (bug #1041) 639/head
Victor Julien [Tue, 19 Nov 2013 10:21:47 +0000 (11:21 +0100)] 
Remove mkinstalldirs (bug #1041)

11 years agoAdd SSE support to --build-info 638/head
Victor Julien [Thu, 14 Nov 2013 12:17:18 +0000 (13:17 +0100)] 
Add SSE support to --build-info

11 years agomemcmp: don't use SSE intrinsics if less that 16 bytes are available in SSE_4_2 version.
Victor Julien [Thu, 14 Nov 2013 11:51:06 +0000 (12:51 +0100)] 
memcmp: don't use SSE intrinsics if less that 16 bytes are available in SSE_4_2 version.

11 years agoprofiling: don't init rule profiling ctx if rule profiling is disabled
Victor Julien [Tue, 19 Nov 2013 09:09:44 +0000 (10:09 +0100)] 
profiling: don't init rule profiling ctx if rule profiling is disabled

11 years agoprofiling: when config is missing, keyword profiling is disabled
Victor Julien [Tue, 19 Nov 2013 09:05:02 +0000 (10:05 +0100)] 
profiling: when config is missing, keyword profiling is disabled

11 years agopcap: register counters for old pcap versions as well
Victor Julien [Tue, 19 Nov 2013 08:56:32 +0000 (09:56 +0100)] 
pcap: register counters for old pcap versions as well

11 years agoFix pcre_study error check
Victor Julien [Tue, 19 Nov 2013 08:37:16 +0000 (09:37 +0100)] 
Fix pcre_study error check

pcre_study returning NULL is not necessarily an error, from the man page
pcre_study(3):

  "If the function returns NULL, either it could not find any additional
   information, or there was an error. You can tell the difference by
   looking at the error value. It is NULL in first case."

Older libpcre versions would return NULL, causing errors.

11 years agoShare Packet checksum values for TCP, UDP, IPv6. ICMPv4 and ICMPv6
Ken Steele [Thu, 14 Nov 2013 18:20:10 +0000 (13:20 -0500)] 
Share Packet checksum values for TCP, UDP, IPv6. ICMPv4 and ICMPv6

Keep a separate checksum for IPV4, since a packet can have both an IPV4
checksum and a TCPV4 checksum, or IPV4 and UDPV4 checksum.

This will allow future sharing of more values.

Use PACKET_RESET_CHECKSUMS() in Unit Tests in place of setting the
individual checksum values.

11 years agoAdd missing case for DNS_CONFIG 630/head
Ken Steele [Sat, 16 Nov 2013 02:17:34 +0000 (21:17 -0500)] 
Add missing case for DNS_CONFIG

Found compiling with -Werror

11 years agohttp & tls: fix transaction handling
Victor Julien [Thu, 14 Nov 2013 14:57:04 +0000 (15:57 +0100)] 
http & tls: fix transaction handling

When http and/or tls logging is disabled, the app layer would still
be flagged as logging. This caused transactions not to be freed until
the end of the flow as the logged tx id would never increment.

This fix postpones the setting of the app layer parser "logger"
flag to the point where we know the logger is enabled.

11 years agodns: fix transaction handling
Victor Julien [Thu, 14 Nov 2013 14:44:35 +0000 (15:44 +0100)] 
dns: fix transaction handling

When logging is disabled, the app layer would still be flagged
as logging. This caused transactions not to be freed until the
end of the flow as the logged tx id would never increment.

This fix postpones the setting of the app layer parser "logger"
flag to the point where we know the logger is enabled.

11 years agoDNS: trigger logging for toserver dir when previous reply is lost.
Victor Julien [Mon, 11 Nov 2013 16:27:56 +0000 (17:27 +0100)] 
DNS: trigger logging for toserver dir when previous reply is lost.

11 years agodns: detect case of request flooding
Victor Julien [Thu, 7 Nov 2013 21:55:15 +0000 (22:55 +0100)] 
dns: detect case of request flooding

In the case where DNS requests are sent over the same flow w/o a
reply being received, we now set an event in the flow and refuse
to add more transactions to the state. This protects the DNS
handling from getting overloaded slowing down everything.

A new option to configure this behaviour was added:

app-layer:
  protocols:
    dnsudp:
       enabled: yes
       detection-ports:
         udp:
           toserver: 53
       request-flood: 750

The request-flood parameter can be 0 (disabling this feature) or a
positive integer. It defaults to 500.

This means that if 500 unreplied requests are seen in a row an event
is set. Rule 2240007 was added to dns-events.rules to match on this.

11 years agoFormatting and comment updates in flow files 628/head
Ken Steele [Fri, 15 Nov 2013 13:55:39 +0000 (08:55 -0500)] 
Formatting and comment updates in flow files

Some reformatting to meet coding standards.

Added a few comments to make it more clear where p->flow gets set.