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

11 years agodetect: only inspect smsg for valid tcp packets
Victor Julien [Wed, 13 Nov 2013 17:18:19 +0000 (18:18 +0100)] 
detect: only inspect smsg for valid tcp packets

Packets that are rejected by the stream engine are not considered
part of an established tcp session. By allowing them to inspect
an smsg, some smsgs would not be properly inspected.

11 years agoAdd Unit test to check TCPv4 and IPV4 checksums together. 626/head
Ken Steele [Thu, 14 Nov 2013 17:11:09 +0000 (12:11 -0500)] 
Add Unit test to check TCPv4 and IPV4 checksums together.

Copied SigTest26TCPV4Keyword and added check for invalid IPV4 checksums.
Created new SigTest26TCPV4AndIPV4Keyword test with a new packet with valid
IPV4 checksums.

11 years agostream: fix sequence number on smsg
Victor Julien [Tue, 12 Nov 2013 15:37:09 +0000 (16:37 +0100)] 
stream: fix sequence number on smsg

When multiple segments were put into a smsg, the seq would be updated
each time a segment was added. Because of this, the seq wasn't pointing
to the start of the data.

This caused some false negatives when the fast_pattern was in the raw
stream, but another part of the inspection was in the state. Because of
the wrong seq, the inspection of the smsg could be delayed. This in turn,
could make the inspection engine consider a TX inspected, even if it wasn't
fully yet.

11 years agoGive Suricata priority to receive packets over Linux with mPIPE.
Ken Steele [Mon, 11 Nov 2013 20:54:47 +0000 (15:54 -0500)] 
Give Suricata priority to receive packets over Linux with mPIPE.

When installing the rules to tell mPIPE to send packet to Suricata,
give it a higher priority than the default used by Linux. This way if
Linux also tells mPIPE to send it packets, Suricata will get them
instead, as long as Suricata is running.

11 years agohttp: don't decode + to space by default 620/head
Victor Julien [Tue, 12 Nov 2013 09:25:19 +0000 (10:25 +0100)] 
http: don't decode + to space by default

Libhtp decodes the + character in the query string to a space by default.
Suricata rules (e.g. etpro sid 2806767) are expecting to see the space in
the http_uri buffer.

Added an option per htp config to reenable this default behavior:

    query-plusspace-decode: yes

Bug #1035.

11 years agoFix live rule reload confusing delayed detect 616/head
Victor Julien [Mon, 11 Nov 2013 15:11:19 +0000 (16:11 +0100)] 
Fix live rule reload confusing delayed detect

Fixes bug 1023 and the previous attempt to fix it.

11 years agodetect: don't do rule reload during delayed detect 615/head
Victor Julien [Wed, 6 Nov 2013 16:25:06 +0000 (17:25 +0100)] 
detect: don't do rule reload during delayed detect

When both rule reloads and delayed detect are enabled, make sure we don't
trigger a reload during delayed detect initialization.

Bug #1023.

11 years agoprofiling: add tracking of missing keywords
Victor Julien [Thu, 7 Nov 2013 13:40:25 +0000 (14:40 +0100)] 
profiling: add tracking of missing keywords

11 years agoprofiling: per buffer profiling
Victor Julien [Thu, 7 Nov 2013 10:30:17 +0000 (11:30 +0100)] 
profiling: per buffer profiling

11 years agodetect: add tostring function for DETECT_SM_LIST_ enum.
Victor Julien [Thu, 7 Nov 2013 10:53:39 +0000 (11:53 +0100)] 
detect: add tostring function for DETECT_SM_LIST_ enum.

11 years agoprofiling: introduce per keyword profiling 613/head
Victor Julien [Thu, 4 Apr 2013 15:08:59 +0000 (17:08 +0200)] 
profiling: introduce per keyword profiling

Initial version of per keyword profiling. Prints stats about
how ofter a keyword was checked and what the costs were.

11 years agocontent inspection: introduce no_match label
Victor Julien [Mon, 4 Nov 2013 15:46:04 +0000 (16:46 +0100)] 
content inspection: introduce no_match label

11 years agostream: fix IPv6 pseudo packet setup 610/head
Victor Julien [Tue, 5 Nov 2013 15:55:57 +0000 (16:55 +0100)] 
stream: fix IPv6 pseudo packet setup

Bug #1022: IPv6 pseudo packet setup using reverse logic of IPv4.

11 years agostream: reduce scope of StreamTcpPseudoPacketSetupHeader
Victor Julien [Tue, 5 Nov 2013 14:48:05 +0000 (15:48 +0100)] 
stream: reduce scope of StreamTcpPseudoPacketSetupHeader

11 years agoIPv4 decoder compile warning fix
Victor Julien [Tue, 5 Nov 2013 12:25:39 +0000 (13:25 +0100)] 
IPv4 decoder compile warning fix

11 years agoDNS: fix response name length logic 609/head
Victor Julien [Mon, 4 Nov 2013 18:37:32 +0000 (19:37 +0100)] 
DNS: fix response name length logic

In some cases where the length would be calculated as 0 we'd loop until
we'd hit our loop limit.

Update name logic everywhere.

11 years agoFix for #1003.
Anoop Saldanha [Fri, 18 Oct 2013 10:33:16 +0000 (16:03 +0530)] 
Fix for #1003.

Now that we call stream reassembly directly from proto detection, we will
need to check if reassembly has been disabled inside the stream reassembly
callback.

This prevents any calls to bypass and re-enter proto detection, despite
having reassembly disabled.

11 years agoCounters: fix delayed-detect counter registration
Victor Julien [Thu, 31 Oct 2013 10:39:59 +0000 (11:39 +0100)] 
Counters: fix delayed-detect counter registration

Make sure we register the detect.alerts counter before packet runtime starts
even in delayed detect mode. The registration of new counters at packet
runtime is not supported by the counters api and might lead to crashes as there
is no proper locking to allow for this operation.

This changes how delayed detect works a bit. Now we call the ThreadInit
callback twice. The first call will only register the counter. The 2nd call
will do all the other setup. This way the counter is registered before the
counters api starts operating in the packet runtime.

Fixes the segv reported in ticket #1018.

11 years agoCounters: move perf critical var to the top of the SCPerfContext struct
Victor Julien [Thu, 31 Oct 2013 08:31:08 +0000 (09:31 +0100)] 
Counters: move perf critical var to the top of the SCPerfContext struct

11 years agoCounter: fix accidental logic change
Victor Julien [Wed, 30 Oct 2013 18:51:14 +0000 (19:51 +0100)] 
Counter: fix accidental logic change

11 years agoCounters: remove unused updated field
Victor Julien [Wed, 30 Oct 2013 18:42:09 +0000 (19:42 +0100)] 
Counters: remove unused updated field

11 years agoOptimizations to reduce branch misses 607/head
Victor Julien [Wed, 30 Oct 2013 11:22:14 +0000 (12:22 +0100)] 
Optimizations to reduce branch misses

11 years agoCounters: remove unused tm_name comparison loops
Victor Julien [Tue, 29 Oct 2013 08:04:07 +0000 (09:04 +0100)] 
Counters: remove unused tm_name comparison loops

11 years agoCounters: fix unix socket
Victor Julien [Tue, 29 Oct 2013 07:29:11 +0000 (08:29 +0100)] 
Counters: fix unix socket

11 years agoCounters: merge SCPerfCounterName into SCPerfCounter as there was a 1 on 1 mapping
Victor Julien [Tue, 29 Oct 2013 07:19:16 +0000 (08:19 +0100)] 
Counters: merge SCPerfCounterName into SCPerfCounter as there was a 1 on 1 mapping

11 years agoCounters: remove SCPerfCounterValue struct as we no longer support multiple data...
Victor Julien [Tue, 29 Oct 2013 07:00:06 +0000 (08:00 +0100)] 
Counters: remove SCPerfCounterValue struct as we no longer support multiple data types

11 years agoCounters: more unused code removal
Victor Julien [Mon, 28 Oct 2013 23:34:13 +0000 (00:34 +0100)] 
Counters: more unused code removal

11 years agoCounters: remove unused code
Victor Julien [Mon, 28 Oct 2013 23:10:38 +0000 (00:10 +0100)] 
Counters: remove unused code

11 years agoCounters: remove all unused parts of the API
Victor Julien [Mon, 28 Oct 2013 18:00:06 +0000 (19:00 +0100)] 
Counters: remove all unused parts of the API

11 years agoUse unlikely in malloc failure test. 604/head
Eric Leblond [Mon, 28 Oct 2013 10:49:23 +0000 (11:49 +0100)] 
Use unlikely in malloc failure test.

This patch is a result of applying the following coccinelle
transformation to suricata sources:

  @istested@
  identifier x;
  statement S1;
  identifier func =~ "(SCMalloc|SCStrdup|SCCalloc|SCMallocAligned|SCRealloc)";
  @@

  x = func(...)
  ... when != x
  - if (x == NULL) S1
  + if (unlikely(x == NULL)) S1

11 years agoaf-packet: init correctly the config structure 603/head
Eric Leblond [Fri, 25 Oct 2013 21:44:12 +0000 (23:44 +0200)] 
af-packet: init correctly the config structure

This fix a crash when interface is not defined in YAML.

11 years agodecode: fix typo in comment
Eric Leblond [Thu, 24 Oct 2013 07:42:35 +0000 (09:42 +0200)] 
decode: fix typo in comment

11 years agoUpdate ftp parser protocol detection to use lowercase patterns. 600/head
Anoop Saldanha [Mon, 21 Oct 2013 04:22:55 +0000 (09:52 +0530)] 
Update ftp parser protocol detection to use lowercase patterns.

11 years agoIntroduce new API to allow case insensitive protocol detection patterns.
Anoop Saldanha [Sun, 20 Oct 2013 18:00:43 +0000 (23:30 +0530)] 
Introduce new API to allow case insensitive protocol detection patterns.

11 years agoRemove the obsolete DetectFtpBounceMatch() function.
Anoop Saldanha [Sat, 19 Oct 2013 13:00:05 +0000 (18:30 +0530)] 
Remove the obsolete DetectFtpBounceMatch() function.

11 years agoSpell fixes in threads-arch-tile.h
Ken Steele [Fri, 18 Oct 2013 18:21:50 +0000 (14:21 -0400)] 
Spell fixes in threads-arch-tile.h

11 years agoSupport for feature #983.
Anoop Saldanha [Thu, 17 Oct 2013 06:52:43 +0000 (12:22 +0530)] 
Support for feature #983.

Provide support for icmvp4 and icmpv6 as well.  You can now use

alert icmpv4 and
alert icmpv6 as well, apart from the existing

alert icmp, which created a rule that applied to both icmpv4 and icmpv6.

11 years agoBuild cuda kernel for capability 3.5 devices.
Nelson Escobar [Thu, 17 Oct 2013 21:32:47 +0000 (14:32 -0700)] 
Build cuda kernel for capability 3.5 devices.

11 years agoDead code removal
Victor Julien [Fri, 18 Oct 2013 18:12:17 +0000 (20:12 +0200)] 
Dead code removal

11 years agostorage: fix and small optimization
Victor Julien [Fri, 18 Oct 2013 18:09:09 +0000 (20:09 +0200)] 
storage: fix and small optimization

11 years agoflow: set correct family in FLOW_COPY_IPV6_ADDR_TO_PACKET
Victor Julien [Thu, 17 Oct 2013 20:36:29 +0000 (22:36 +0200)] 
flow: set correct family in FLOW_COPY_IPV6_ADDR_TO_PACKET

11 years agoFix 2 unittests
Victor Julien [Thu, 17 Oct 2013 17:07:46 +0000 (19:07 +0200)] 
Fix 2 unittests

11 years agoMinor code cleanup/fixes to fast pattern unittests
Victor Julien [Thu, 17 Oct 2013 15:52:43 +0000 (17:52 +0200)] 
Minor code cleanup/fixes to fast pattern unittests

cppcheck:
[detect-fast-pattern.c:1183] -> [detect-fast-pattern.c:1183]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1217] -> [detect-fast-pattern.c:1217]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1449] -> [detect-fast-pattern.c:1449]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1479] -> [detect-fast-pattern.c:1479]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1509] -> [detect-fast-pattern.c:1509]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1539] -> [detect-fast-pattern.c:1539]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1570] -> [detect-fast-pattern.c:1570]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1686] -> [detect-fast-pattern.c:1686]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1716] -> [detect-fast-pattern.c:1716]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1746] -> [detect-fast-pattern.c:1746]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1776] -> [detect-fast-pattern.c:1776]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1806] -> [detect-fast-pattern.c:1806]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1836] -> [detect-fast-pattern.c:1836]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1866] -> [detect-fast-pattern.c:1866]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1896] -> [detect-fast-pattern.c:1896]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:1926] -> [detect-fast-pattern.c:1926]: (style) Same expression on both sides of '&'.
[detect-fast-pattern.c:2022] -> [detect-fast-pattern.c:2022]: (style) Same expression on both sides of '&'.

11 years agoMinor fix for detection engine setup error check
Victor Julien [Thu, 17 Oct 2013 15:41:52 +0000 (17:41 +0200)] 
Minor fix for detection engine setup error check

cppcheck said:
[detect-engine-mpm.c:2075] -> [detect-engine-mpm.c:2075]: (style) Same expression on both sides of '||'.

11 years agoMinor pppoe cleanup
Victor Julien [Thu, 17 Oct 2013 15:41:03 +0000 (17:41 +0200)] 
Minor pppoe cleanup

cppcheck said:
[decode-pppoe.c:58] -> [decode-pppoe.c:60]: (performance, inconclusive) Variable 'pppoedh' is reassigned a value before the old one has been used if variable is no semaphore variable.

11 years agoFix broken check in stream.max-synack-queued parsing (coverity 1038103)
Victor Julien [Thu, 17 Oct 2013 15:36:27 +0000 (17:36 +0200)] 
Fix broken check in stream.max-synack-queued parsing (coverity 1038103)

11 years agoFix sanity check in AppInspectionEngine registration code
Victor Julien [Thu, 17 Oct 2013 14:30:18 +0000 (16:30 +0200)] 
Fix sanity check in AppInspectionEngine registration code

11 years agoFeature #901 - VLAN defrag support. 593/head
Jason Ish [Wed, 16 Oct 2013 17:59:26 +0000 (11:59 -0600)] 
Feature #901 - VLAN defrag support.

Take VLAN IDs into account when re-assembling fragments.

Prevents fragments that would otherwise match, but on different
VLANs from being reassembled with each other.

11 years agoCorrect indentation and wording of comments.
Ken Steele [Thu, 10 Oct 2013 14:23:23 +0000 (10:23 -0400)] 
Correct indentation and wording of comments.

11 years agoClean up function syntax
Ken Steele [Fri, 4 Oct 2013 18:10:41 +0000 (14:10 -0400)] 
Clean up function syntax

Remove space before ( in function names. Put { on new line.
Make tests static.

11 years agoAdd a /* fall through */ comment for all switch case fall throughs.
Anoop Saldanha [Mon, 7 Oct 2013 09:48:52 +0000 (15:18 +0530)] 
Add a /* fall through */ comment for all switch case fall throughs.

This should server as a message to coverity that the fall through is
intentional.

11 years agostorage: fix freeing storage 592/head
Victor Julien [Tue, 15 Oct 2013 09:32:37 +0000 (11:32 +0200)] 
storage: fix freeing storage

Fix freeing storage. Also add workaround for unittests that don't
(fully) setup storage.

Bug #991.

11 years agothreshold: register threshold host storage. Related to bug #991
Victor Julien [Tue, 15 Oct 2013 09:18:10 +0000 (11:18 +0200)] 
threshold: register threshold host storage. Related to bug #991

11 years agoReset both sides of the de_state on rule reload. Bug #998. 591/head
Victor Julien [Mon, 14 Oct 2013 14:33:23 +0000 (16:33 +0200)] 
Reset both sides of the de_state on rule reload. Bug #998.

11 years agoDon't initialize threshold before rules on delayed detect. Bug #999.
Victor Julien [Mon, 14 Oct 2013 14:29:32 +0000 (16:29 +0200)] 
Don't initialize threshold before rules on delayed detect. Bug #999.

11 years agoiprep: fix reputation loading and reloading 588/head
Victor Julien [Thu, 10 Oct 2013 16:24:40 +0000 (18:24 +0200)] 
iprep: fix reputation loading and reloading

When an IP is listed in multiple categories, each new "load" would clear the
previous loads for that IP.

Bug #976

11 years agotag: fix session seconds tracking 586/head
Victor Julien [Thu, 10 Oct 2013 10:51:07 +0000 (12:51 +0200)] 
tag: fix session seconds tracking

Fix bug #995. Tag time setting was initialized using "usec" field
instead of "sec" field. This led to immediate timing out of tag.

Added proper matching unittests for all tagging types.

Bug #995.

11 years agotag: add some debug statements
Victor Julien [Thu, 10 Oct 2013 08:05:20 +0000 (10:05 +0200)] 
tag: add some debug statements

11 years agoClean up rule reload logging
Victor Julien [Wed, 9 Oct 2013 11:45:55 +0000 (13:45 +0200)] 
Clean up rule reload logging

11 years agofix for bug #987. 584/head
Anoop Saldanha [Fri, 4 Oct 2013 16:21:33 +0000 (21:51 +0530)] 
fix for bug #987.

We don't support jabber protocol detection atm.  Disable the code check
inside suricata to check if jabber protocol detection is enabled in the
yaml file.

Also updated an error log message for app layer.

11 years agoAPI renaming/beautification.
Anoop Saldanha [Tue, 8 Oct 2013 16:11:17 +0000 (21:41 +0530)] 
API renaming/beautification.

11 years agoFix for bug #989.
Anoop Saldanha [Thu, 3 Oct 2013 04:42:54 +0000 (10:12 +0530)] 
Fix for bug #989.

In case of recursive call to protocol detection from within protocol
detection, and the recursively invoked stream still hasn't been ack'ed
yet, protocol detection doesn't take place.  In such cases we will end up
still calling the app layer with the wrong direction data.  Introduce a
check to not call app layer with wrong direction data.

When sockets are re-used reset all relevant vars correctly.

This commit fixes a bug where we were not reseting app proto detection
vars.

While fixing #989, we discovered some other bugs which have also been
fixed, or rather some features which are now updated.  One of the feature
update being if we recieve wrong direction data first, we don't reset the
protocol values for the flow.  We let the flow retain the detected
values.

Unittests have been modified to accomodate the above change.

11 years agoReset app layer processed flag for segments that have been sent for proto
Anoop Saldanha [Thu, 3 Oct 2013 04:40:11 +0000 (10:10 +0530)] 
Reset app layer processed flag for segments that have been sent for proto
detection, but we failed to figure out the proto.

Updated a unittest to reflect the above change.

11 years agoInside PP parser, we were using the return value from DetectPortParse as
Anoop Saldanha [Tue, 8 Oct 2013 15:22:06 +0000 (20:52 +0530)] 
Inside PP parser, we were using the return value from DetectPortParse as
the ip_proto value,  which is wrong.  We have fixed this now.

11 years agoUpdate ssl parser protocol detection pattern strings.
Anoop Saldanha [Tue, 1 Oct 2013 15:43:07 +0000 (21:13 +0530)] 
Update ssl parser protocol detection pattern strings.

11 years agoXFF: use per alert tx id
Victor Julien [Wed, 18 Sep 2013 13:09:38 +0000 (15:09 +0200)] 
XFF: use per alert tx id

Use the tx id stored for each alert to find the correct XFF address
to add to the extra-data field.

In overwrite mode we still only grab the first available XFF addr,
as this address is set in the header preceeding the individual alerts.

Issue #904.

11 years agoDisplay TX id in alert debuglog.
Victor Julien [Wed, 18 Sep 2013 10:33:00 +0000 (12:33 +0200)] 
Display TX id in alert debuglog.

11 years agoStore TX id with alerts
Victor Julien [Wed, 18 Sep 2013 08:18:09 +0000 (10:18 +0200)] 
Store TX id with alerts

When generating an alert and storing it in the packet, store the tx_id
as well. This way the output modules can log the tx_id and access the
proper tx for logging.

Issue #904.

11 years agohtp: for apache and apache_2_2 personalities, that are no longer supported by libhtp...
Victor Julien [Mon, 7 Oct 2013 13:08:58 +0000 (15:08 +0200)] 
htp: for apache and apache_2_2 personalities, that are no longer supported by libhtp, fall back to apache_2 with a warning.

11 years agoBug 640: add more tests to validate that issue is fixed
Victor Julien [Mon, 7 Oct 2013 13:03:43 +0000 (15:03 +0200)] 
Bug 640: add more tests to validate that issue is fixed

11 years agosuricata: add -v[v] option to increase verbosity 576/head
Eric Leblond [Thu, 3 Oct 2013 12:55:35 +0000 (14:55 +0200)] 
suricata: add -v[v] option to increase verbosity

This patch adds a -v option to suricata. It increases the log level
defined in the YAML.

11 years agosuricata: info message after log init
Eric Leblond [Thu, 3 Oct 2013 11:50:09 +0000 (13:50 +0200)] 
suricata: info message after log init

This patch moves version display after log init so we can have an
homogeneous display.

11 years agosuricata: reorder start
Eric Leblond [Thu, 3 Oct 2013 11:43:58 +0000 (13:43 +0200)] 
suricata: reorder start

Initalizing output just after configuration file parsing allow to
log almost all messages accordingly to configuration.

11 years agolog: change default log level to notice
Eric Leblond [Thu, 3 Oct 2013 08:55:10 +0000 (10:55 +0200)] 
log: change default log level to notice

This patch updates the log level of meaningful start messages to
notice. It also sets the default log level to notice.

11 years agoRevert change in queue handler wait logic. Bug #988.
Victor Julien [Thu, 3 Oct 2013 08:33:56 +0000 (10:33 +0200)] 
Revert change in queue handler wait logic. Bug #988.

11 years agoImprove 'host-mode' info message
Victor Julien [Thu, 3 Oct 2013 07:58:06 +0000 (09:58 +0200)] 
Improve 'host-mode' info message

11 years agoCoverity 1100842: add missing return statement
Victor Julien [Thu, 3 Oct 2013 07:48:32 +0000 (09:48 +0200)] 
Coverity 1100842: add missing return statement

11 years agoCoverity 1100843: remove unnecessary check
Victor Julien [Thu, 3 Oct 2013 07:12:34 +0000 (09:12 +0200)] 
Coverity 1100843: remove unnecessary check

11 years agohttp: add new events for invalid host header and host part of uri
Victor Julien [Tue, 1 Oct 2013 12:08:36 +0000 (14:08 +0200)] 
http: add new events for invalid host header and host part of uri

11 years agohttp: fix some decoder events
Victor Julien [Tue, 1 Oct 2013 11:49:39 +0000 (13:49 +0200)] 
http: fix some decoder events

Some events we retrieved from error messages are flag now, so check
those. Not all can be converted though. These are no longer set:

HTTP_DECODER_EVENT_INVALID_TRANSFER_ENCODING_VALUE_IN_RESPONSE
HTTP_DECODER_EVENT_INVALID_AUTHORITY_PORT

Part of Bug #982.

11 years agohttp: update http rules
Victor Julien [Tue, 1 Oct 2013 10:20:07 +0000 (12:20 +0200)] 
http: update http rules

11 years agohttp: fix field too long events
Victor Julien [Tue, 1 Oct 2013 10:15:41 +0000 (12:15 +0200)] 
http: fix field too long events

11 years agohttp: don't call HTPHandleWarning before HTPHandleError as the latter handles warning...
Victor Julien [Tue, 1 Oct 2013 10:13:38 +0000 (12:13 +0200)] 
http: don't call HTPHandleWarning before HTPHandleError as the latter handles warnings and errors.

11 years agohttp: add test for HTTP_DECODER_EVENT_UNKNOWN_ERROR event as a result of a too long...
Victor Julien [Tue, 1 Oct 2013 09:59:42 +0000 (11:59 +0200)] 
http: add test for HTTP_DECODER_EVENT_UNKNOWN_ERROR event as a result of a too long request

11 years agoreject: try to fail more gracefully
Eric Leblond [Tue, 1 Oct 2013 14:23:47 +0000 (16:23 +0200)] 
reject: try to fail more gracefully

In the case of reject both, a failure in sending one way do not lead to
abort the reset procedure.

11 years agoreject: clean respond-reject code.
Eric Leblond [Tue, 1 Oct 2013 14:05:34 +0000 (16:05 +0200)] 
reject: clean respond-reject code.

11 years agoreject: delete debug line
Eric Leblond [Thu, 26 Sep 2013 17:57:19 +0000 (19:57 +0200)] 
reject: delete debug line

11 years agoAdd reject for IPv6
Eric Leblond [Wed, 18 Sep 2013 11:27:49 +0000 (13:27 +0200)] 
Add reject for IPv6

With this patch reject is now available in IPv6.

11 years agoconfigure: accept libnet 1.1 and 1.2.
Eric Leblond [Fri, 13 Sep 2013 11:46:19 +0000 (13:46 +0200)] 
configure: accept libnet 1.1 and 1.2.

11 years agoreject: update computation of seq and ack
Eric Leblond [Wed, 11 Sep 2013 15:52:09 +0000 (17:52 +0200)] 
reject: update computation of seq and ack

We have follow TCP RFC (http://tools.ietf.org/html/rfc793#section-3.4).
There is two cases depending on wether the original packet contains a
ACK.
If packet has no ACK, the RST seq number is 0 and the ACK is built the
standard way.
If packet has a ACK, the seq of the RST packet is equal to the ACK of
incoming packet and the ACK is build using packet sequence number and
size of the data.

Regarding standard Ack number, it is computed using seq number of captured
packet added to packet length. Finally 1 is added so we respect the
RFC:
    If the ACK control bit is set this field contains the value of the
    next sequence number the sender of the segment is expecting to
    receive.  Once a connection is established this is always sent.

With this patch we have some correct results. With the following rule:
    reject ssh any any -> 192.168.56.3 any (msg:"no SSH  way"; sid:3; rev:1;)
ssh connection to 192.168.56.3 is correctly resetted on client side.

But this is not perfect. If we have the following rule:
    reject tcp any any -> 192.168.56.3 22 (msg:"no way"; sid:2; rev:1;)
then the connection is not resetted on a standard ethernet network. But
if we introduce 20ms delay on packets, then it is correctly resetted.
This is explained when looking at the network trace. The reset is sent
as answer to the SYN packet and it is emitted after the SYN ACK from
server because the exchange is really fast. So this is discarded by the
client OS which has already seen a ACK for the same sequence number.

This should fix #895.

11 years agoreject: fix typo
Eric Leblond [Thu, 12 Sep 2013 13:17:38 +0000 (15:17 +0200)] 
reject: fix typo

11 years agoreject: use host-mode to set interface
Eric Leblond [Wed, 11 Sep 2013 15:58:28 +0000 (17:58 +0200)] 
reject: use host-mode to set interface

This patch update reject code to send the packet on the interface
it comes from when 'host-mode' is set to 'sniffer-only'. When
'host-mode' is set to 'router', the reject packet is sent via
the routing interface.

This should fix #957.

11 years agoreject: reindent and code cleaning
Eric Leblond [Wed, 11 Sep 2013 15:45:20 +0000 (17:45 +0200)] 
reject: reindent and code cleaning

Reindent file and use some switch instead of if else if.

11 years agoIntroduce host-mode.
Eric Leblond [Fri, 13 Sep 2013 10:21:04 +0000 (12:21 +0200)] 
Introduce host-mode.

This variable can be used to indicate to suricata that the host
running is running as a router or is in sniffing only mode.
This will used at least to determine which interfaces are used to
send reject message.

11 years agolocks: clean up locks declarations
Victor Julien [Wed, 2 Oct 2013 10:12:01 +0000 (12:12 +0200)] 
locks: clean up locks declarations

Split threads.h into several files, where each of these files defines
all lock types and macro's.

threads.h defines the normal case
threads-debug.h defines the debug variants
threads-profile.h defines the lock profiling variants

Finally, threads-arch-tile.h moves the Tilera specifics out

11 years agococcinelle: implement parallel check 574/head
Eric Leblond [Wed, 2 Oct 2013 10:12:29 +0000 (12:12 +0200)] 
coccinelle: implement parallel check

This patch is an implementation of parallel check of files. It uses
GNU parallel to run multiple spatch at once.
The concurrency level is set via the CONCURRENCY_LEVEL environment
variable.

11 years agoStateful detection inspection continuation API call should update per
Anoop Saldanha [Mon, 30 Sep 2013 16:22:07 +0000 (21:52 +0530)] 
Stateful detection inspection continuation API call should update per
signature's Sigmatch entry as well.

11 years agoThresholding: move parsing code into separate func
Victor Julien [Thu, 19 Sep 2013 14:41:06 +0000 (16:41 +0200)] 
Thresholding: move parsing code into separate func

11 years agoSplit Thresholds and Suppression
Victor Julien [Thu, 19 Sep 2013 14:16:50 +0000 (16:16 +0200)] 
Split Thresholds and Suppression

Thresholds and suppression can be handled independently. Suppression
only suppresses output, and is not related to Threshold state tracking.

This simplifies mixing suppression and thresholding rules.

Part of the Bug #425 effort.