]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
10 years agosuri-graphite: add ouput to file option 1502/head
Eric Leblond [Wed, 20 May 2015 19:45:25 +0000 (21:45 +0200)] 
suri-graphite: add ouput to file option

The --ooutput option allows to write the stats to a file given as
argument the format used is JSON for easy parsing.

10 years agosuri-graphite: add daemonization capability
Eric Leblond [Sun, 17 May 2015 17:02:37 +0000 (19:02 +0200)] 
suri-graphite: add daemonization capability

You can now use -d or --daemon to daemonize the process.

10 years agosuri-graphite: fix port option
Eric Leblond [Sun, 17 May 2015 16:57:48 +0000 (18:57 +0200)] 
suri-graphite: fix port option

If port is specified on command line we need to convert it as an
integer before using it as argument to connect.

10 years agologfile: rename ALERT_ types to LOGFILE_TYPE_
Victor Julien [Fri, 22 May 2015 12:23:18 +0000 (14:23 +0200)] 
logfile: rename ALERT_ types to LOGFILE_TYPE_

10 years agooutput-json: suppress global variable
Eric Leblond [Wed, 20 May 2015 11:40:01 +0000 (13:40 +0200)] 
output-json: suppress global variable

It uses the new type field in the LogFileCtx instead.

This fixes the problem of not being able to use two eve-json
instance with different logging methods.

10 years agolog file: add type flag
Eric Leblond [Wed, 20 May 2015 11:38:10 +0000 (13:38 +0200)] 
log file: add type flag

It will be used to store if the file is syslog or a real file.

10 years agosuricata.yaml: fix the name of EVE module
Eric Leblond [Sat, 7 Feb 2015 10:36:37 +0000 (11:36 +0100)] 
suricata.yaml: fix the name of EVE module

It is netflow and not newflow.

10 years agooutput-json: fix type of data parameter
Eric Leblond [Sat, 7 Feb 2015 00:58:28 +0000 (01:58 +0100)] 
output-json: fix type of data parameter

The cast of data to AlertJsonThread was not correct as the real
type of the void pointer is a OutputJsonCtx. This was working by
luck because they both have a file_ctx as first element.

10 years agoFeature #1440: support wildcards in rule filenames 1501/head
Alexander Gozman [Wed, 13 May 2015 18:18:43 +0000 (21:18 +0300)] 
Feature #1440: support wildcards in rule filenames

10 years agoFix rcode parsing, as noticed by Coverity.
David Cannings [Mon, 11 May 2015 20:51:38 +0000 (21:51 +0100)] 
Fix rcode parsing, as noticed by Coverity.

Without support for OPT RR from RFC6891 (Extension mechanisms for DNS)
values of RCODE above 15 are not possible.  Remove dead code which will
never match.

10 years agoconf - process includes even if not at root node.
Jason Ish [Mon, 11 May 2015 22:50:19 +0000 (16:50 -0600)] 
conf - process includes even if not at root node.

10 years agoradix-tree - prevent out of bounds array access
Jason Ish [Mon, 11 May 2015 16:20:25 +0000 (10:20 -0600)] 
radix-tree - prevent out of bounds array access

An IPv6 entry specified before an IPv4 entry on the host-os-policy
table can cause the stream byte array to be access one byte after
the end of the allocated memory at util-radix-tree.c:578.

10 years agoBug 1281 - Add tests for rule content of lengths > 255.
Jason Ish [Fri, 2 Jan 2015 21:30:30 +0000 (15:30 -0600)] 
Bug 1281 - Add tests for rule content of lengths > 255.

10 years agoBug 1281 - Accept rule content with lengths greater than 255.
Jason Ish [Mon, 27 Oct 2014 17:36:26 +0000 (11:36 -0600)] 
Bug 1281 - Accept rule content with lengths greater than 255.

10 years agoalert-json: fix stream logging for IPS mode 1489/head
Victor Julien [Tue, 19 May 2015 13:54:41 +0000 (15:54 +0200)] 
alert-json: fix stream logging for IPS mode

Switch direction in IPS mode.

10 years agothreads: add untimed control cond call
Victor Julien [Mon, 18 May 2015 16:05:11 +0000 (18:05 +0200)] 
threads: add untimed control cond call

The control conditions so far could only do timed waits, not normal
waits.

10 years agodetect: minor cleanups 1487/head
Victor Julien [Wed, 13 May 2015 12:26:13 +0000 (14:26 +0200)] 
detect: minor cleanups

10 years agoparsing: s/strtok/strtok_r/g
Victor Julien [Wed, 13 May 2015 12:25:49 +0000 (14:25 +0200)] 
parsing: s/strtok/strtok_r/g

Remove all strtok uses and replace them by strtok_r.

Do the same for Windows builds. Cygwin builds fine with strtok_r.

Add strtok to banned function list.

10 years agothreading: explain purpose of threadvars mucond
Victor Julien [Thu, 14 May 2015 08:38:58 +0000 (10:38 +0200)] 
threading: explain purpose of threadvars mucond

10 years agoflow: don't hold tv_root_lock longer than needed
Victor Julien [Thu, 14 May 2015 08:38:10 +0000 (10:38 +0200)] 
flow: don't hold tv_root_lock longer than needed

Don't hold it longer than needed in shutting down.

10 years agothreading: remove unused cmd thread create func
Victor Julien [Thu, 14 May 2015 08:17:16 +0000 (10:17 +0200)] 
threading: remove unused cmd thread create func

10 years agounix-manager: convert to thread module
Victor Julien [Wed, 13 May 2015 14:52:11 +0000 (16:52 +0200)] 
unix-manager: convert to thread module

Sync command thread for unix manager with other managers and make
it a full thread module.

10 years agoreference/classification: call global init for unittests 1484/head
Victor Julien [Wed, 13 May 2015 08:21:20 +0000 (10:21 +0200)] 
reference/classification: call global init for unittests

10 years agoreference: update pcre globals use
Victor Julien [Wed, 13 May 2015 07:53:49 +0000 (09:53 +0200)] 
reference: update pcre globals use

Don't update globals each time we parse, but instead do it once at
startup.

10 years agoclassification: update pcre globals use
Victor Julien [Wed, 13 May 2015 07:37:39 +0000 (09:37 +0200)] 
classification: update pcre globals use

Don't update globals each time we parse, but instead do it once at
startup.

10 years agoreference: remove global
Victor Julien [Tue, 12 May 2015 14:53:02 +0000 (16:53 +0200)] 
reference: remove global

10 years agoclassification: remove global from parsing
Victor Julien [Tue, 12 May 2015 14:20:27 +0000 (16:20 +0200)] 
classification: remove global from parsing

Parsing code used a 'fd' global. Remove this.

10 years agostream: fix --disable-detection reassembly issue 1479/head
Victor Julien [Tue, 5 May 2015 17:43:33 +0000 (19:43 +0200)] 
stream: fix --disable-detection reassembly issue

Due to an error at initialization, the stream engine would not disable
'raw' reassembly automatically when --disable-detection was used.

This lead to segments not getting cleared from the segment lists.

10 years agostream: remove FLOW_NO_APPLAYER_INSPECTION flag
Victor Julien [Wed, 28 Jan 2015 12:07:19 +0000 (13:07 +0100)] 
stream: remove FLOW_NO_APPLAYER_INSPECTION flag

Instead, intruduce StreamTcpDisableAppLayer to disable app layer
tracking and reassembly. StreamTcpAppLayerIsDisabled can be used
to check it.

Replace all uses of FlowSetSessionNoApplayerInspectionFlag and
the FLOW_NO_APPLAYER_INSPECTION.

10 years agostream: remove FLOW_NO_APPLAYER_INSPECTION use from tests
Victor Julien [Wed, 28 Jan 2015 11:16:32 +0000 (12:16 +0100)] 
stream: remove FLOW_NO_APPLAYER_INSPECTION use from tests

10 years agostream: improve 'no app layer' handling
Victor Julien [Tue, 5 May 2015 15:48:18 +0000 (17:48 +0200)] 
stream: improve 'no app layer' handling

When the session/flow was flagged as 'no applayer inspect', which
could happen as a result various reasons, packets would still be
considered by the app layer reassembly.

When ACK'd, they would be removed again. Depending also on the raw
reassembly.

In very long sessions however, this meganism could fail leading to
virtually endlessly growing segment lists.

This patch makes sure that segments that come in on a 'no app layer'
session are tagged properly or even not added at all.

Use a new ssn flag instead of flow flag for no app tracking.

10 years agoapp-layer: add DisableAppLayer
Victor Julien [Wed, 28 Jan 2015 10:12:37 +0000 (11:12 +0100)] 
app-layer: add DisableAppLayer

Move various app layer related flag setting calls into a utility
function "DisableAppLayer"

10 years agoapp-layer: de_state optimization
Victor Julien [Tue, 7 Apr 2015 14:00:08 +0000 (16:00 +0200)] 
app-layer: de_state optimization

Add API to bypass expensive TX list walks. This API call is optional.

Implement it for HTTP and DNS.

10 years agodetect-state: update test to check state storing
Victor Julien [Wed, 25 Mar 2015 14:54:35 +0000 (15:54 +0100)] 
detect-state: update test to check state storing

10 years agodetect-state: handle duplicate inspect/match
Victor Julien [Tue, 24 Mar 2015 14:36:39 +0000 (15:36 +0100)] 
detect-state: handle duplicate inspect/match

If for a packet we have a TX N that has detect state and a TX N+1 that
has no detect state, but does have 'progress', we have a corner case
in stateful detection.

ContinueDetection inspects TX N, but cannot flag the rule in the
de_state_sig_array as the next (TX N+1) has already started and needs
to be inspected. 'StartDetection' however, is then unaware of the fact
that ContinueDetection already inspected the rule. It uses the per
session 'inspect_id' that is only moved forward at the end of the
detection run.

This patch adds a workaround. It uses the DetectEngineThreadCtx::
de_state_sig_array to store an offset between the 'base' inspect_id
and the inspect_id that StartDetection should use. The data type is
limited, so if the offset would be too big, a search based fall back
is implemented as well.

10 years agodetect: add de_state duplication check
Victor Julien [Wed, 25 Mar 2015 08:19:49 +0000 (09:19 +0100)] 
detect: add de_state duplication check

Add test to check if no duplicate destate is created.

Only enabled with DEBUG_VALIDATION.

10 years agodetect-state: fix state storing
Victor Julien [Tue, 24 Mar 2015 11:40:27 +0000 (12:40 +0100)] 
detect-state: fix state storing

Fix storing state and bypassing detection. Previously we'd store
on a match only, meaning that StartDetection would rerun often.

Make sure StartDetection only stores if there is something to store.

10 years agodetect-http-header: improve buffer handling
Victor Julien [Tue, 24 Mar 2015 16:25:04 +0000 (17:25 +0100)] 
detect-http-header: improve buffer handling

Previously we could never be calling DetectEngineHHDGetBufferForTX
for TX N and then afterwards for TX N - 1. Due to changes in the
stateful detection code this is now possible.

This patch changes the buffer logic to take the 'inspect_id' as it's
base, instead of the first transaction that we are called with.

10 years agodetect-events: set SIG_MASK_REQUIRE_*_STATE for events
Victor Julien [Wed, 12 Nov 2014 12:41:50 +0000 (13:41 +0100)] 
detect-events: set SIG_MASK_REQUIRE_*_STATE for events

Set SIG_MASK_REQUIRE_*_STATE for event rules to earlier discard
them.

10 years agoengine-analysis: print fast_pattern summary 1478/head
Victor Julien [Mon, 21 Jul 2014 19:09:06 +0000 (21:09 +0200)] 
engine-analysis: print fast_pattern summary

When using engine analysis for print fast_pattern stats, print a
short summary at the end containing per buffer:
- smallest fp
- biggest fp
- number of patterns
- avg fp len

10 years agolua: fix error handling
Victor Julien [Wed, 2 Jul 2014 11:16:28 +0000 (13:16 +0200)] 
lua: fix error handling

10 years agohttp: add event for leading spaces on request line
Victor Julien [Sat, 18 Oct 2014 19:46:59 +0000 (21:46 +0200)] 
http: add event for leading spaces on request line

Libhtp will issue a warning in this case, so we can match on this.
This patch adds event, rule and unittest.

10 years agothreads: fix missing unlock in error handling
Victor Julien [Fri, 16 Jan 2015 10:06:35 +0000 (11:06 +0100)] 
threads: fix missing unlock in error handling

If TmThreadsUnregisterThread was called with out of range 'id', a lock
would not be cleared after returning from the function.

** CID 1264421:  Missing unlock  (LOCK)
/src/tm-threads.c: 2186 in TmThreadsUnregisterThread()

10 years agoUpdate changelog for 2.1beta4 release suricata-2.1beta4
Victor Julien [Fri, 8 May 2015 14:09:24 +0000 (16:09 +0200)] 
Update changelog for 2.1beta4 release

10 years agoaf-packet: use max packet size as snaplen 1473/head
Eric Leblond [Sun, 25 Jan 2015 19:49:28 +0000 (20:49 +0100)] 
af-packet: use max packet size as snaplen

If default_packet_size is set to 0, then we use the maximum packet
size as snaplen.

10 years agoutil-device: fix LiveBuildDeviceListCustom
Eric Leblond [Sun, 25 Jan 2015 18:31:45 +0000 (19:31 +0100)] 
util-device: fix LiveBuildDeviceListCustom

The code was assuming that the dictionnary containing the parameter
of a interface was ordered. But for YAML, the order is not assumed
so in case the configuration is generated we may not be able to
parse correctly the configuration file.

By iterating on child on main node and then iterating on subchild
and doing a match on the name, we are able to find the interface
list. In term of code, this algorithm was obtained by simply
removing the test on the name of the first child.

10 years agooutput-json-http: output status as an integer
Eric Leblond [Tue, 18 Nov 2014 10:07:59 +0000 (11:07 +0100)] 
output-json-http: output status as an integer

HTTP status is an integer and it should be written as such in the
JSON events. This will allow to have improved matching in log
analysis tools.

10 years agococcinelle: update struct flags test
Eric Leblond [Tue, 10 Jun 2014 07:43:56 +0000 (09:43 +0200)] 
coccinelle: update struct flags test

10 years agodecode-der: decode DC keyword
Eric Leblond [Wed, 1 Oct 2014 14:15:06 +0000 (16:15 +0200)] 
decode-der: decode DC keyword

'DC' is used by some certificates and it was not currently translated
to a string.

10 years agofiledata: read inspected tracker settings from suricata.yaml
Giuseppe Longo [Thu, 7 May 2015 21:34:15 +0000 (23:34 +0200)] 
filedata: read inspected tracker settings from suricata.yaml

10 years agofiledata: implement inspected tracker
Giuseppe Longo [Tue, 10 Mar 2015 15:21:14 +0000 (16:21 +0100)] 
filedata: implement inspected tracker

10 years agoUT: implement tests for inspection code
Giuseppe Longo [Fri, 30 Jan 2015 09:36:55 +0000 (10:36 +0100)] 
UT: implement tests for inspection code

10 years agoapp-layer-smtp: make functions as public
Giuseppe Longo [Tue, 10 Feb 2015 14:21:35 +0000 (15:21 +0100)] 
app-layer-smtp: make functions as public

10 years agompm: implement prefiltering for smtp
Giuseppe Longo [Wed, 21 Jan 2015 19:39:34 +0000 (20:39 +0100)] 
mpm: implement prefiltering for smtp

10 years agoDetect engine for smtp file_data file_data: inspecting smtp attachments
Giuseppe Longo [Tue, 20 Jan 2015 16:38:06 +0000 (17:38 +0100)] 
Detect engine for smtp file_data file_data: inspecting smtp attachments

Create a buffer to store reassembled file chunks,
and inspect the content.

10 years agoFileData: add stream_offset field
Giuseppe Longo [Tue, 20 Jan 2015 16:20:57 +0000 (17:20 +0100)] 
FileData: add stream_offset field

This is required to store the offset for reassembling chunks.

10 years agofile_data: register keyword for smtp and tcp protocol
Giuseppe Longo [Tue, 20 Jan 2015 11:02:16 +0000 (12:02 +0100)] 
file_data: register keyword for smtp and tcp protocol

Permits to use file_data keyword with smtp or tcp proto.
Also adds some unit tests

10 years agosignature: set flags and test the protocol
Giuseppe Longo [Thu, 5 Feb 2015 14:04:13 +0000 (15:04 +0100)] 
signature: set flags and test the protocol

This checks if the signature's protocol is http
when setup the content keyword.

Also sets the proper flags based by protocol
since the flag SIG_FLAG_TOSERVER has to be set
if the proto is smtp, otherwise SIG_FLAG_TOCLIENT
is it's http.

10 years agofind and replace HSBDMATCH by FILEDATA
Giuseppe Longo [Tue, 20 Jan 2015 09:28:38 +0000 (10:28 +0100)] 
find and replace HSBDMATCH by FILEDATA

This commit do a find and replace of the following:

- DETECT_SM_LIST_HSBDMATCH by DETECT_SM_LIST_FILEDATA
  sed -i 's/DETECT_SM_LIST_HSBDMATCH/DETECT_SM_LIST_FILEDATA/g' src/*

- HSBD by FILEDATA:
  sed -i 's/HSBDMATCH/FILEDATA/g' src/*

10 years agoFormatting cleanup in detect-replace.c 1470/head
Ken Steele [Thu, 6 Feb 2014 15:22:17 +0000 (10:22 -0500)] 
Formatting cleanup in detect-replace.c

Wrap lines longer than 80 characters
Add "static" for unit tests.
Use (void) for () for function arguments.
Add space after "while(" -> "while ("
Remove space after function names.
Put open bracket of function on a new line.

10 years agoAdd a comment for DetectReplaceList
Ken Steele [Thu, 6 Feb 2014 15:12:24 +0000 (10:12 -0500)] 
Add a comment for DetectReplaceList

Reworded a quote in PR 742 by Regit from Inliniac to explain why adding
the head of the list (really a FIFO) is the correct behavior.

10 years agoFix DetectReplaceAddToList
Ken Steele [Fri, 20 Dec 2013 21:36:58 +0000 (16:36 -0500)] 
Fix DetectReplaceAddToList

I see two problems:
1) If allocating a newlist fails, the function returns NULL, which then
   leaks any existing list elements.
2) The code to add the new value to the list works for the first two, but
   for not the third. For example, replist=A, A->next=B, B->next=NULL, then
   adding C results in replist=A, A->next=C, C->next=NULL, B is lost.

The fix pushes new values onto the head of the list, which might not be
what is needed, but there are no comments on what the function does, so I
made an assumption.

10 years agoFix bug #1435 (data loss when dumping payloads to JSON)
Alexander Gozman [Thu, 16 Apr 2015 09:40:17 +0000 (12:40 +0300)] 
Fix bug #1435 (data loss when dumping payloads to JSON)

10 years agoFix Bug #1204
Zachary Rasmor [Fri, 24 Apr 2015 18:28:32 +0000 (14:28 -0400)] 
Fix Bug #1204

Fix typo that causes eve syslog settings code to be unreachable.

10 years agostream: next_seq handling improvements
Victor Julien [Thu, 9 Apr 2015 06:42:23 +0000 (08:42 +0200)] 
stream: next_seq handling improvements

Allow next_seq updating to recover from cases where last_ack has been
moved beyond it. This can happen if ACK's have been accepted for missing
data that is later retransmitted.

This undoes some of the previous last_ack update changes

10 years agoAdd timezone to timestamp in JSON logs
Alexander Gozman [Thu, 7 May 2015 09:40:28 +0000 (12:40 +0300)] 
Add timezone to timestamp in JSON logs

10 years agoAdded support for full parsing of the rcode header in DNS answer
David Cannings [Thu, 16 Apr 2015 18:40:46 +0000 (19:40 +0100)] 
Added support for full parsing of the rcode header in DNS answer
packets. Where rcode isn't "no error" this is displayed in both DNS and
JSON logs.

Note that this changes the current "No such domain" to "NXDOMAIN" in DNS
logs. This could be fixed if desired to maintain compatibility with
anybody crazy enough to parse the DNS log.

When the rcode is not "no error" (for example NXDOMAIN or SERVFAIL) it
is unlikely that there will be answer RRs. Therefore the rname from the
query is used.

Because the rcode applies to a whole answer packet (not individual
queries) it is impossible to determine which query RR caused the error.
Because of this most DNS servers currently reject multiple queries per
packet. Therefore each query RR is output instead with the relevant
error code, likely to be FORMERR if queries > 1.

10 years agotls: force 'raw' reassembly after each record
Victor Julien [Fri, 1 May 2015 13:12:47 +0000 (15:12 +0200)] 
tls: force 'raw' reassembly after each record

Trigger raw reassembly after each record and after the handshake.

10 years agoapp-layer-modbus: fix deadlock in parsers 1121/head 1147/head 1284/head 1302/head 1353/head 1411/head 1417/head 1441/head 1446/head
DIALLO David [Thu, 30 Apr 2015 17:02:56 +0000 (19:02 +0200)] 
app-layer-modbus: fix deadlock in parsers

10 years agosmtp: fix mime boundary parsing issue
Victor Julien [Thu, 16 Apr 2015 15:05:52 +0000 (17:05 +0200)] 
smtp: fix mime boundary parsing issue

If a boundary was longer than 254 bytes a stack overflow would result
in mime decoding.

Ticket #1449

Reported-by: Kostya Kortchinsky of the Google Security Team
10 years agopcap-file: fix malformed timestamp crash
Victor Julien [Tue, 21 Apr 2015 17:29:12 +0000 (19:29 +0200)] 
pcap-file: fix malformed timestamp crash

A bad timestamp would lead to SCLocalTime returning NULL. This case
wasn't checked, leading to a NULL deref.

Reported-by: Kostya Kortchinsky of the Google Security Team
10 years agoFix possible wrap in uint32_t addition in DER parser
Pierre Chifflier [Sat, 18 Apr 2015 12:24:45 +0000 (14:24 +0200)] 
Fix possible wrap in uint32_t addition in DER parser

Signed-off-by: Pierre Chifflier <pierre.chifflier@ssi.gouv.fr>
10 years agoBug 1340: fix missing flow cleanup 1456/head
Victor Julien [Fri, 1 May 2015 15:58:34 +0000 (17:58 +0200)] 
Bug 1340: fix missing flow cleanup

Fix missing flow output cleanup function leading to a crash in the
unix socket mode.

10 years agopcap: implement LINKTYPE_NULL 1454/head
Victor Julien [Mon, 13 Apr 2015 10:12:46 +0000 (12:12 +0200)] 
pcap: implement LINKTYPE_NULL

Implement LINKTYPE_NULL for pcap live and pcap file.

From: http://www.tcpdump.org/linktypes.html

"BSD loopback encapsulation; the link layer header is a 4-byte field,
 in host byte order, containing a PF_ value from socket.h for the
 network-layer protocol of the packet.

 Note that ``host byte order'' is the byte order of the machine on
 which the packets are captured, and the PF_ values are for the OS
 of the machine on which the packets are captured; if a live capture
 is being done, ``host byte order'' is the byte order of the machine
 capturing the packets, and the PF_ values are those of the OS of
 the machine capturing the packets, but if a ``savefile'' is being
 read, the byte order and PF_ values are not necessarily those of
 the machine reading the capture file."

Feature ticket #1445

10 years agofix reputation parser so that it accepts ipv6 addresses in configuration file.
Tom DeCanio [Fri, 17 Apr 2015 04:28:03 +0000 (21:28 -0700)] 
fix reputation parser so that it accepts ipv6 addresses in configuration file.

10 years agoafl - SCHINfoLoadFromConfig - check for NULL before parsing.
Jason Ish [Mon, 20 Apr 2015 18:12:55 +0000 (12:12 -0600)] 
afl - SCHINfoLoadFromConfig - check for NULL before parsing.

Found by AFL on suricata.yaml.

10 years agoafl - Don't fail if app-layer proto enabled value is NULL.
Jason Ish [Mon, 20 Apr 2015 17:47:18 +0000 (11:47 -0600)] 
afl - Don't fail if app-layer proto enabled value is NULL.

Found by using AFL on suricata.yaml.

10 years agoemail-json: free temporary 'cc' string
Eric Leblond [Wed, 29 Apr 2015 12:57:53 +0000 (14:57 +0200)] 
email-json: free temporary 'cc' string

10 years agoemail-json: free temporary 'to' string
Eric Leblond [Wed, 29 Apr 2015 12:57:07 +0000 (14:57 +0200)] 
email-json: free temporary 'to' string

10 years agoapp-layer-smtp: fix SMTPTransactionFree function
Eric Leblond [Wed, 29 Apr 2015 13:43:47 +0000 (15:43 +0200)] 
app-layer-smtp: fix SMTPTransactionFree function

A typo was causing some freeing tasks not to be executed.

10 years agoprofiling: fix sorting on very long runs
Victor Julien [Wed, 29 Apr 2015 21:34:44 +0000 (23:34 +0200)] 
profiling: fix sorting on very long runs

Fix poor int handling breaking sorts of profiling on long runs
where the numbers could get really big.

10 years agoxbits: fix coverity warnings
Victor Julien [Wed, 29 Apr 2015 13:51:19 +0000 (15:51 +0200)] 
xbits: fix coverity warnings

Switch statement would contain NOALERT even though this was
unreachable.

10 years agocoverity fix: don't do pointer check on static array
Victor Julien [Wed, 29 Apr 2015 13:38:39 +0000 (15:38 +0200)] 
coverity fix: don't do pointer check on static array

10 years agoFix potential deadlock in output
Victor Julien [Wed, 29 Apr 2015 13:03:23 +0000 (15:03 +0200)] 
Fix potential deadlock in output

Coverity:
** CID 1296115:  Program hangs  (ORDER_REVERSAL)
/src/tm-threads.c: 1670 in TmThreadClearThreadsFamily()

The problem is with the by default unused '%m' output parameter.
To get the thread vars it takes the tv_root_lock. This may already
be locked by the calling thread. Also, it could lead to a case of
wrong lock order between the tv_root_lock and the thread_store_lock.

Very unlikely to happen though.

As the %m param isn't really used (by default) this patch just
disables it.

10 years agopacket pool: fix memleaks
Victor Julien [Tue, 21 Apr 2015 15:29:24 +0000 (17:29 +0200)] 
packet pool: fix memleaks

Don't kill flow manager and recyclers before the rest of the threads. The
packet threads may still have packets from their pools. As the flow threads
would destroy their pools the packets would be lost.

This patch doesn't kill the threads, it just pulls them out of their run
loop and into a wait loop. The packet pools won't be cleared until all
threads are killed.

Wait for flow management threads to close before moving on to the
next steps in the shutdown process.

Don't destroy flow force reassembly packet pool too early. Worker
threads may still want to return packets to it.

10 years agothreshold: cleanups
Victor Julien [Wed, 8 Apr 2015 14:22:07 +0000 (16:22 +0200)] 
threshold: cleanups

Use pcre_copy_substring in the most common part of threshold rule
parsing. Minor other cleanups.

10 years agoreference: use pcre_copy_substring
Victor Julien [Wed, 8 Apr 2015 13:34:58 +0000 (15:34 +0200)] 
reference: use pcre_copy_substring

10 years agoclassification: cleanups
Victor Julien [Wed, 8 Apr 2015 13:15:29 +0000 (15:15 +0200)] 
classification: cleanups

Reduce hash table size as regular classification files are usually
below 100 in size. It's not performance critical anyway.

Convert pcre_get_substring calls to pcre_copy_substring.

10 years agosuricatasc: allow for longer response times after connect
Victor Julien [Thu, 16 Apr 2015 13:47:19 +0000 (15:47 +0200)] 
suricatasc: allow for longer response times after connect

10 years agopacket pool: init pool for autofp workers as well
Victor Julien [Wed, 22 Apr 2015 10:38:52 +0000 (12:38 +0200)] 
packet pool: init pool for autofp workers as well

Introduce a new 'PacketPoolInitEmpty' as these pools will not often
need packets.

Also, don't double 'destroy' in the main thread.

10 years agoautofp: reduce flow storage space requirement
Victor Julien [Fri, 17 Apr 2015 09:21:54 +0000 (11:21 +0200)] 
autofp: reduce flow storage space requirement

Use int16_t instead of a regular int to safe 2 bytes per flow.

10 years agothreading: add missing locks to threading storage
Victor Julien [Thu, 23 Apr 2015 07:32:01 +0000 (09:32 +0200)] 
threading: add missing locks to threading storage

Lock threading root lock when walking or updating the threading
storage for 'ThreadVars' objects.

10 years agoAdded new WebDAV http methods. 1445/head
maxtors [Fri, 17 Apr 2015 08:37:21 +0000 (10:37 +0200)] 
Added new WebDAV http methods.

Added more WebDAV functions. A complete list of what http
methods libhtp can handle can be found at:
https://github.com/OISF/libhtp/blob/0.5.x/htp/htp_core.h#L260.
So now the methods array reflects these available functions.

The comments have also been changed to reflect the desired style.

10 years agoReworked pattern registration structure and feedback issues.
maxtors [Fri, 17 Apr 2015 08:03:24 +0000 (10:03 +0200)] 
Reworked pattern registration structure and feedback issues.

1) Reworked pattern registration for http methods and versions.

Instead of being a manual and verbose action of adding one
and one http method with N-amount if prefix spacings and
the same for HTTP versions (eg. HTTP/1.1) i moved it all
to be loop based actions reading values from char arrays.

In the future all that is needed is to add new methods
to the arrays and they will be added as a pattern.

2) Modified pattern registration after feedback.

Changed variable used in snprintf for http method registration
Should have been size of dest buffer at not another var (catsize)
that i had created. Also removed this variable.

Fixed a typo in the comment for registering http versions.
TO_CIENT -> TO_CLIENT.

10 years agoAdded http methods for webdav (rfc4918).
maxtors [Thu, 16 Apr 2015 20:44:36 +0000 (22:44 +0200)] 
Added http methods for webdav (rfc4918).

Included the following methods to app-layer-htp.c:
- PROPFIND
- PROPPATCH
- MKCOL
- COPY
- MOVE
- LOCK
- UNLOCK

10 years agoAdded DELETE and PATCH http methods to app-layer-htp.c
maxtors [Thu, 16 Apr 2015 14:15:10 +0000 (16:15 +0200)] 
Added DELETE and PATCH http methods to app-layer-htp.c

Added two new http methods to the http decoding done in
app-layer-htp.c so that these messages will be decoded as well.

10 years agoapp-layer: update protocol detection tests 1444/head
Victor Julien [Thu, 23 Apr 2015 07:53:20 +0000 (09:53 +0200)] 
app-layer: update protocol detection tests

AppLayerTest09, AppLayerTest10 and AppLayerTest11 depended on a max
protocol detection pattern size of < 17. Update the tests to pass one
extra byte to the app layer. This makes the protocol detection code
flag the session as 'proto detection completed' again.

10 years agoFix Unit ID check 1435/head
David Maciejak [Sun, 8 Feb 2015 02:27:03 +0000 (10:27 +0800)] 
Fix Unit ID check

10 years agoutil-running-mode: setup config file
Eric Leblond [Tue, 27 Jan 2015 20:22:29 +0000 (21:22 +0100)] 
util-running-mode: setup config file

Without that we get warning message.

10 years agolist keywords: fix regression on app layer name
Eric Leblond [Fri, 16 Jan 2015 13:37:41 +0000 (14:37 +0100)] 
list keywords: fix regression on app layer name

It was not anymore displayed.