]> git.ipfire.org Git - people/ms/suricata.git/log
people/ms/suricata.git
9 years agooutput-lua: add example packet log script
Victor Julien [Thu, 20 Feb 2014 08:39:24 +0000 (09:39 +0100)] 
output-lua: add example packet log script

Example packet log script that outputs to stdout in the alert-
fast log format.

9 years agooutput-lua: packet logger support
Victor Julien [Thu, 20 Feb 2014 08:36:16 +0000 (09:36 +0100)] 
output-lua: packet logger support

Through 'needs' the script init function can indicate it wants to
see packets and select a condition function. Currently only alerts
is an option:

    function init (args)
        local needs = {}
        needs["type"] = "packet"
        needs["filter"] = "alerts"
        return needs
    end

9 years agooutput-lua: new file for common functions
Victor Julien [Wed, 19 Feb 2014 12:49:35 +0000 (13:49 +0100)] 
output-lua: new file for common functions

Add output-lua-common.[ch] to store functions common to various parts
of the lua output framework.

9 years agooutput: Lua HTTP log initial implementation
Victor Julien [Tue, 11 Feb 2014 13:44:21 +0000 (14:44 +0100)] 
output: Lua HTTP log initial implementation

Initial version of a HTTP LUA logger. Execute lua scripts from the
Tx-log API.

9 years agooutput-lua: support submodules
Victor Julien [Wed, 19 Feb 2014 11:52:03 +0000 (12:52 +0100)] 
output-lua: support submodules

Use the OutputCtx::submodules list to register additional log modules.
Currently this is hardcoded to the 'lua' module.

9 years agooutput-lua: display warning if no lua support
Victor Julien [Wed, 19 Feb 2014 11:50:57 +0000 (12:50 +0100)] 
output-lua: display warning if no lua support

Display a warning that the lua module is not available if we're
not compiled against lua(jit).

9 years agooutput: add submodules list to OutputCtx
Victor Julien [Wed, 19 Feb 2014 11:46:50 +0000 (12:46 +0100)] 
output: add submodules list to OutputCtx

Add a list to the OutputCtx that can contain OutputModule structures.
This will be used by a 'parent' module to register submodules directly.

9 years agostreaming: pass tx_id to logger
Victor Julien [Wed, 18 Jun 2014 10:15:58 +0000 (12:15 +0200)] 
streaming: pass tx_id to logger

This way we can distinguish between various tx' in the logger.

9 years agostreaming-loggers: add configuration
Victor Julien [Tue, 17 Jun 2014 15:49:05 +0000 (17:49 +0200)] 
streaming-loggers: add configuration

Add a (disabled by default) config to the yaml

9 years agotcp-data-log: file and dir logging modes
Victor Julien [Fri, 13 Jun 2014 10:05:33 +0000 (12:05 +0200)] 
tcp-data-log: file and dir logging modes

Add a file logging mode, which logs all the data into a single log file.

Also, make the directory logging more configurable.

9 years agotcp-data: new streaming logger
Victor Julien [Sat, 5 Apr 2014 08:02:38 +0000 (10:02 +0200)] 
tcp-data: new streaming logger

tcp-data logs out reassembled stream data in a streaming fashion.

Records type to log into different directories.

9 years agostreaming logger: support Http Body logging
Victor Julien [Thu, 12 Jun 2014 09:42:00 +0000 (11:42 +0200)] 
streaming logger: support Http Body logging

Add an argument to the registration to indicate which iterator
needs to be used: Stream or HttpBody

Add HttpBody Iterator, calling the logger(s) for each Http body chunk.

9 years agooutput-streaming: StreamIterator
Victor Julien [Sat, 5 Apr 2014 08:00:27 +0000 (10:00 +0200)] 
output-streaming: StreamIterator

StreamIterator implementation for iterating over ACKed segments.

Flag each segment as logged when the log function has been called for it.

Set a 'OPEN' flag for the first segment in both directions.

Set a 'CLOSE' flag when the stream ends. If the last segment was already
logged, a empty CLOSE call is performed with NULL data.

9 years agooutput-streaming: a Log API for streaming data
Victor Julien [Fri, 4 Apr 2014 10:51:26 +0000 (12:51 +0200)] 
output-streaming: a Log API for streaming data

This patch adds a new Log API for streaming data such as TCP reassembled
data and HTTP body data. It could also replace Filedata API.

Each time a new chunk of data is available, the callback will be called.

9 years agoFix compiler warning about uninitialized variable in mpipe.
Ken Steele [Tue, 12 Aug 2014 23:57:41 +0000 (19:57 -0400)] 
Fix compiler warning about uninitialized variable in mpipe.

9 years agoSimple code fixes
Duarte Silva [Tue, 12 Aug 2014 17:13:52 +0000 (18:13 +0100)] 
Simple code fixes
- Removed unnecessary assignment of the data field
- Removed else condition (same function called for IPv4 and IPV6)
- Fixed constants to be a power of two (used in bitwise operations)

9 years agoOptimize Packet Ext data freeing
Victor Julien [Wed, 13 Aug 2014 14:33:50 +0000 (16:33 +0200)] 
Optimize Packet Ext data freeing

Move the logic of PacketFreeExtData into a macro 'PACKET_FREE_EXTDATA'.
It was called for each packet.

9 years agopacket pool: fix ext_pkt cleaning
Eric Leblond [Wed, 13 Aug 2014 08:48:26 +0000 (10:48 +0200)] 
packet pool: fix ext_pkt cleaning

The field ext_pkt was cleaned before calling the release function.
The result was that IPS mode such as the one of AF_PACKET were not
working anymore because they were not able to send the data which
were initially pointed by ext_pkt.

This patch moves the ext_pkt cleaning to the cleaning macro. This
ensures that the cleaning is done for allocated and pool packets.

9 years agopacket recycle: remove mutex destroy/init
Victor Julien [Wed, 9 Jul 2014 06:55:47 +0000 (08:55 +0200)] 
packet recycle: remove mutex destroy/init

This was necessary earlier when there was a memset involved.

9 years agopacket recycle: do most clean up on packet reuse
Victor Julien [Wed, 9 Jul 2014 06:51:29 +0000 (08:51 +0200)] 
packet recycle: do most clean up on packet reuse

Call PACKET_RELEASE_REFS from PacketPoolGetPacket() so that
we only access the large packet structure just before actually
using it. Should give better cache behaviour.

9 years agopacket recycle: split macro
Victor Julien [Wed, 9 Jul 2014 06:50:26 +0000 (08:50 +0200)] 
packet recycle: split macro

Split PACKET_RECYCLE into 2 parts. One part for cleanup to do before a
packet is returned to the pool, the other after it's retrieved from
the pool.

9 years agoFix decode tests calling PACKET_DO_RECYCLE instead of PACKET_RECYCLE
Victor Julien [Wed, 9 Jul 2014 08:59:49 +0000 (10:59 +0200)] 
Fix decode tests calling PACKET_DO_RECYCLE instead of PACKET_RECYCLE

9 years agoUpdate Changelog for 2.1beta1
Victor Julien [Tue, 12 Aug 2014 13:59:05 +0000 (15:59 +0200)] 
Update Changelog for 2.1beta1

9 years agoUpdate Changelog for 2.0.3
Victor Julien [Fri, 8 Aug 2014 07:49:18 +0000 (09:49 +0200)] 
Update Changelog for 2.0.3

9 years agoFix GRE Source Routing Header definition
Ken Steele [Wed, 5 Feb 2014 23:00:19 +0000 (18:00 -0500)] 
Fix GRE Source Routing Header definition

The Source Routing Header had routing defined as a char* for a field
of variable size. Since that field was not being used in the code, I
removed the pointer and added a comment.

9 years agoMore structures that need to be marked Packed.
Ken Steele [Fri, 20 Dec 2013 18:50:43 +0000 (13:50 -0500)] 
More structures that need to be marked Packed.

These structures are cast from raw packet data, so they should be packed.
The case is:

typedef struct Foo_ {
} Foo;

Foo *f = (Foo *)pkt;

9 years agoAdd Packed attribute on Header structures
Ken Steele [Fri, 20 Dec 2013 16:52:12 +0000 (11:52 -0500)] 
Add Packed attribute on Header structures

Structures that are used to cast packet data into fields need to be packed
so that the compiler doesn't add any padding to these fields. This also helps
Tile-Gx to avoid unaligned loads because the compiler will insert code to
handle the possible unaligned load.

9 years agolua: improve configure checks
Victor Julien [Mon, 11 Aug 2014 12:14:59 +0000 (14:14 +0200)] 
lua: improve configure checks

The base 'lua' library has different names on different OS' and even
Linux distro's. Instead of selecting the proper one, we now just try
all. This way no OS/distro specific knowledge about the name is needed.

9 years agoalert-json: clean up flags
Victor Julien [Fri, 8 Aug 2014 12:25:31 +0000 (14:25 +0200)] 
alert-json: clean up flags

Make payload/packet logging code also use the flags field in
AlertJsonOutputCtx, instead of in the LogFileCtx.

9 years agojson-alert: include HTTP info on the alerts
Giuseppe Longo [Thu, 7 Aug 2014 13:10:45 +0000 (15:10 +0200)] 
json-alert: include HTTP info on the alerts

Extends the JSON alert output to include the HTTP data
at the time of the alert.

9 years agojson-http: refactoring output code
Giuseppe Longo [Thu, 7 Aug 2014 12:36:54 +0000 (14:36 +0200)] 
json-http: refactoring output code

Splits the output code in two public functions and permits
to call them from the alert function

9 years agoUse extra data structure in json alert output
Duarte Silva [Thu, 31 Jul 2014 16:06:20 +0000 (17:06 +0100)] 
Use extra data structure in json alert output
to store local configuration

9 years agostream: detect and filter out bad window updates
Victor Julien [Wed, 16 Jul 2014 22:23:50 +0000 (00:23 +0200)] 
stream: detect and filter out bad window updates

Reported in bug 1238 is an issue where stream reassembly can be
disrupted.

A packet that was in-window, but otherwise unexpected set the
window to a really low value, causing the next *expected* packet
to be considered out of window. This lead to missing data in the
stream reassembly.

The packet was unexpected in various ways:
- it would ack unseen traffic
- it's sequence number would not match the expected next_seq
- set a really low window, while not being a proper window update

Detection however, it greatly hampered by the fact that in case of
packet loss, quite similar packets come in. Alerting in this case
is unwanted. Ignoring/skipping packets in this case as well.

The logic used in this patch is as follows. If:

- the packet is not a window update AND
- packet seq > next_seq AND
- packet acq > next_seq (packet acks unseen data) AND
- packet shrinks window more than it's own data size
THEN set event and skip the packet in the stream engine.

So in case of a segment with no data, any window shrinking is rejected.

Bug #1238.

9 years agoipv6: fix dst/hop header option parsing
Victor Julien [Thu, 7 Aug 2014 13:02:56 +0000 (15:02 +0200)] 
ipv6: fix dst/hop header option parsing

The extension header option parsing used a uint8_t internally. However
much bigger option sizes are valid.

9 years agodefrag: use 'struct timeval' for timeout tracking
Victor Julien [Tue, 5 Aug 2014 15:28:17 +0000 (17:28 +0200)] 
defrag: use 'struct timeval' for timeout tracking

Until now the time out handling in defrag was done using a single
uint32_t that tracked seconds. This lead to corner cases, where
defrag trackers could be timed out a little too early.

9 years agoipv6: set event on unsupported nh
Victor Julien [Mon, 28 Jul 2014 12:41:15 +0000 (14:41 +0200)] 
ipv6: set event on unsupported nh

If a next header / protocol is encountered that we can't handle (yet)
set an event. Disabled the rule by default.

    decode-event:ipv6.unknown_next_header;

9 years agoipv6: more robust ipv6 exthdr handling
Victor Julien [Mon, 28 Jul 2014 11:59:44 +0000 (13:59 +0200)] 
ipv6: more robust ipv6 exthdr handling

Skip past Shim6, HIP and Mobility header.

Detect data after 'none' header.
    decode-event:ipv6.data_after_none_header;

9 years agoipv6: detect frag header reserved field non-zero
Victor Julien [Mon, 28 Jul 2014 10:07:13 +0000 (12:07 +0200)] 
ipv6: detect frag header reserved field non-zero

Frag Header length field is reserved, and should be set to 0.

    decode-event:ipv6.fh_non_zero_reserved_field;

9 years agoipv6: make exthdr parsing more robust
Victor Julien [Thu, 24 Jul 2014 14:50:34 +0000 (16:50 +0200)] 
ipv6: make exthdr parsing more robust

Improve data length checks. Detect PadN option with 0 length.

9 years agoipv6: set flag on type 0 routing header
Victor Julien [Thu, 17 Jul 2014 13:57:16 +0000 (15:57 +0200)] 
ipv6: set flag on type 0 routing header

Type 0 Routing headers are deprecated per RFC 5095.

This patch sets an decode event flag that can be matched on through:
    decode-event:ipv6.rh_type_0;

9 years agoipv6 defrag: fix unfragmentable exthdr handling
Victor Julien [Thu, 24 Jul 2014 11:39:10 +0000 (13:39 +0200)] 
ipv6 defrag: fix unfragmentable exthdr handling

Fix or rather implement handling of unfragmentable exthdrs in ipv6.
The exthdr(s) appearing before the frag header were copied into the
reassembled packet correctly, however the stripping of the frag header
did not work correctly.

Example:
The common case is a frag header directly after the ipv6 header:

[ipv6 header]->[frag header]->[icmpv6 (part1)]
[ipv6 header]->[frag header]->[icmpv6 (part2)]

This would result in:
[ipv6 header]->[icmpv6]

The ipv6 headers 'next header' setting would be updated to point to
whatever the frag header was pointing to.

This would also happen when is this case:

[ipv6 header]->[hop header]->[frag header]->[icmpv6 (part1)]
[ipv6 header]->[hop header]->[frag header]->[icmpv6 (part2)]

The result would be:
[ipv6 header]->[hop header]->[icmpv6]

However, here too the ipv6 header would have been updated to point
to what the frag header pointed at. So it would consider the hop header
as if it was an ICMPv6 header, or whatever the frag header pointed at.

The result is that packets would not be correctly parsed, and thus this
issue can lead to evasion.

This patch implements handling of the unfragmentable part. In the first
segment that is stored in the list for reassembly, this patch detects
unfragmentable headers and updates it to have the last unfragmentable
header point to the layer after the frag header.

Also, the ipv6 headers 'next hdr' is only updated if no unfragmentable
headers are used. If they are used, the original value is correct.

Reported-By: Rafael Schaefer <rschaefer@ernw.de>
Bug #1244.

9 years agopacket pool: init pthread key before using it
Victor Julien [Fri, 1 Aug 2014 07:55:43 +0000 (09:55 +0200)] 
packet pool: init pthread key before using it

In the packet pool code, it's critical to initialize the pthread key
before using it. Applies only to the code used if __thread isn't
supported.

9 years agopacket pool: cosmetic cleanups
Victor Julien [Fri, 1 Aug 2014 07:54:34 +0000 (09:54 +0200)] 
packet pool: cosmetic cleanups

9 years agoprscript: update URL
Eric Leblond [Thu, 31 Jul 2014 09:48:41 +0000 (11:48 +0200)] 
prscript: update URL

Buildbot server has been moved to another box.

9 years agomagic: disable tests depending on magic version
Victor Julien [Thu, 31 Jul 2014 13:49:11 +0000 (15:49 +0200)] 
magic: disable tests depending on magic version

Some tests depend on specific results by specific magic versions.
Disable these.

9 years agosuricata: RunUnittests now return void
Eric Leblond [Wed, 30 Jul 2014 15:17:51 +0000 (17:17 +0200)] 
suricata: RunUnittests now return void

RunUnittests function is now a terminal function (calling exit
before leaving).

9 years agounittests: don't register app layer test
Eric Leblond [Tue, 29 Jul 2014 08:05:23 +0000 (10:05 +0200)] 
unittests: don't register app layer test

Some tests are already registered via the function
AppLayerParserRegisterProtocolUnittests. So we don't need to
egister them during runmode initialization.

9 years agoFix up mistaken style change
Victor Julien [Thu, 31 Jul 2014 10:17:58 +0000 (12:17 +0200)] 
Fix up mistaken style change

9 years agofixup
Ken Steele [Wed, 30 Jul 2014 18:44:45 +0000 (14:44 -0400)] 
fixup

9 years agoEnforce function coding standard
Ken Steele [Wed, 30 Jul 2014 18:19:35 +0000 (14:19 -0400)] 
Enforce function coding standard

Functions should be defined as:

int foo(void)
{
}

Rather than:
int food(void) {
}

All functions where changed by a script to match this standard.

9 years agoeve: add tx_id to output for alerts and events
Victor Julien [Sat, 12 Jul 2014 07:25:21 +0000 (09:25 +0200)] 
eve: add tx_id to output for alerts and events

Add tx_id field for correlating alerts and events per tx.

9 years agoUpdate app-layer-htp.c
sxhlinux [Thu, 24 Jul 2014 02:00:40 +0000 (10:00 +0800)] 
Update app-layer-htp.c

When keyword "boundary=" doesn't exist in the http_header, the value of r is 0 and this condition shouldn't return 0 instead 1;

9 years agoReduce reallocation in AC Tile MPM creation.
Ken Steele [Thu, 3 Jul 2014 16:42:12 +0000 (12:42 -0400)] 
Reduce reallocation in AC Tile MPM creation.

Exponentially increase the memory allocated for new states when adding new
states, then at the end resize down to the actually final size so that no space is wasted.

9 years agoAdd input interface's name to JSON log
Alexander Gozman [Mon, 28 Jul 2014 16:22:32 +0000 (20:22 +0400)] 
Add input interface's name to JSON log

9 years agopcap-log: yaml comment update
Victor Julien [Wed, 30 Jul 2014 09:00:53 +0000 (11:00 +0200)] 
pcap-log: yaml comment update

9 years agopcap-log: unify lock handling, fixes Coverity warn
Victor Julien [Wed, 30 Jul 2014 08:58:30 +0000 (10:58 +0200)] 
pcap-log: unify lock handling, fixes Coverity warn

*** CID 1229124:  Data race condition  (MISSING_LOCK)
/src/log-pcap.c: 363 in PcapLog()
357         {
358             return TM_ECODE_OK;
359         }
360
361         PcapLogLock(pl);
362
>>>     CID 1229124:  Data race condition  (MISSING_LOCK)
>>>     Accessing "pl->pkt_cnt" without holding lock "PcapLogData_.plog_lock". Elsewhere, "PcapLogData_.pkt_cnt" is accessed with "PcapLogData_.plog_lock" held 1 out of 2 times (1 of these accesses strongly imply that it is necessary).
363         pl->pkt_cnt++;
364         pl->h->ts.tv_sec = p->ts.tv_sec;
365         pl->h->ts.tv_usec = p->ts.tv_usec;
366         pl->h->caplen = GET_PKT_LEN(p);
367         pl->h->len = GET_PKT_LEN(p);
368         len = sizeof(*pl->h) + GET_PKT_LEN(p);

9 years agoCleanup Packet Pools when done.
Ken Steele [Tue, 29 Jul 2014 15:13:56 +0000 (11:13 -0400)] 
Cleanup Packet Pools when done.

9 years agoFix Packet Stacks for non-TLS Operating Systems
Ken Steele [Tue, 29 Jul 2014 13:31:49 +0000 (09:31 -0400)] 
Fix Packet Stacks for non-TLS Operating Systems

On non-TLS systems, check each time the Thread Local Storage
is requested and if it has not been initialized for this thread, initialize it.
The prevents not initializing the worker threads in autofp run mode.

9 years agotravis-ci: use make check
Eric Leblond [Fri, 4 Jul 2014 15:00:55 +0000 (17:00 +0200)] 
travis-ci: use make check

This patch replaces unittest run by make check. It also install
coccinelle so we should have more test.

9 years agococcinelle: fix problem with coccinelle 1.0rc21
Eric Leblond [Tue, 1 Jul 2014 17:27:34 +0000 (19:27 +0200)] 
coccinelle: fix problem with coccinelle 1.0rc21

coccinelle 1.0rc21 has a problem with regular expression handling.
This result in a Fatal Error when test system detects an coding
error.

This patch fixes the problem by using a simple blob inside
semantic patch instead of using a regular expression to define
the function.

It also fixes add an optimization on matching suppressing a
useless <.. ..> construction.

Fixes have been suggested by Julia Lawall.

9 years agoflow-recycler: support multiple instances
Victor Julien [Mon, 21 Jul 2014 13:13:42 +0000 (15:13 +0200)] 
flow-recycler: support multiple instances

Use new management API to run the flow recycler.

Make number of threads configurable:

flow:
  memcap: 64mb
  hash-size: 65536
  prealloc: 10000
  emergency-recovery: 30
  managers: 2
  recyclers: 2

This sets up 2 flow recyclers.

9 years agoflow-manager: support multiple instances
Victor Julien [Sat, 12 Jul 2014 11:47:33 +0000 (13:47 +0200)] 
flow-manager: support multiple instances

Use new management API to run the flow manager.

Support multiple flow managers, where each of them works with it's
own part of the flow hash.

Make number of threads configurable:

flow:
  memcap: 64mb
  hash-size: 65536
  prealloc: 10000
  emergency-recovery: 30
  managers: 2

This sets up 2 flow managers.

Handle misc tasks only in instance 1: Handle defrag hash timeout
handing, host hash timeout handling and flow spare queue updating
only from the first instance.

9 years agothreads: add management API
Victor Julien [Wed, 16 Jul 2014 07:59:48 +0000 (09:59 +0200)] 
threads: add management API

Currently management threads do their own thread setup and handling. This
patch introduces a new way of handling management threads.

Functionality that needs to run as a management thread can now register
itself as a regular 'thread module' (TmModule), where the 'Management'
callback is registered.

9 years agoflow id: quick and dirty first stab at a flow id
Victor Julien [Wed, 4 Jun 2014 11:37:02 +0000 (13:37 +0200)] 
flow id: quick and dirty first stab at a flow id

Add a 'flow_id' that is the same for all records produced for packets
belonging to the same flow.

This patch simply takes the flow's memory address.

9 years agoflow: add flow_end_flags field, add logging
Victor Julien [Fri, 23 May 2014 12:54:05 +0000 (14:54 +0200)] 
flow: add flow_end_flags field, add logging

The flow end flags field is filled by the flow manager or the flow
hash (in case of forced timeout of a flow) to record the timeout
conditions in the flow:
- emergency mode
- state
- reason (timed out or forced)

Add logging to the flow logger.

9 years agoflow: move FlowGetFlowState
Victor Julien [Fri, 23 May 2014 12:51:44 +0000 (14:51 +0200)] 
flow: move FlowGetFlowState

Move FlowGetFlowState to flow-private.h so that all parts of the flow
engine can use it.

9 years agoflow log: log TCP state
Victor Julien [Fri, 23 May 2014 09:49:37 +0000 (11:49 +0200)] 
flow log: log TCP state

Log the TCP state at timeout.

9 years agoflow-recycler: speed up flow-recycler shutdown
Victor Julien [Thu, 22 May 2014 10:53:51 +0000 (12:53 +0200)] 
flow-recycler: speed up flow-recycler shutdown

Thread was killed by the generic TmThreadKillThreads instead of
the FlowKillFlowRecyclerThread. The latter wakes the thread up, so
that shutdown is quite a bit faster.

9 years agoflow: log individual tcp flags
Victor Julien [Thu, 22 May 2014 10:39:12 +0000 (12:39 +0200)] 
flow: log individual tcp flags

Log the tcp flags.

9 years agonetflow: log individual tcp flags
Victor Julien [Thu, 22 May 2014 10:37:27 +0000 (12:37 +0200)] 
netflow: log individual tcp flags

Log the tcp flags.

9 years agojson: add tcp flags to json utility function
Victor Julien [Thu, 22 May 2014 10:36:45 +0000 (12:36 +0200)] 
json: add tcp flags to json utility function

Turns a flags bitfield into a set of json bools.

9 years agonetflow-json: initial version
Victor Julien [Wed, 21 May 2014 14:54:18 +0000 (16:54 +0200)] 
netflow-json: initial version

Initial version of netflow module, a flow logger that logs each
direction in a completely separate record (line).

9 years agoflow-log: log TCP flags per direction
Victor Julien [Wed, 21 May 2014 13:37:10 +0000 (15:37 +0200)] 
flow-log: log TCP flags per direction

In addition to flags for the entire session, also log out TCP flags
for both directions separately.

9 years agostream: track TCP flags per stream direction
Victor Julien [Wed, 21 May 2014 12:29:15 +0000 (14:29 +0200)] 
stream: track TCP flags per stream direction

For netflow logging track TCP flags per stream direction. As the struct
had no more space left without expanding it, the flags and wscale
fields are now compressed.

9 years agoflow: init logger thread data for decoders
Victor Julien [Fri, 9 May 2014 12:56:55 +0000 (14:56 +0200)] 
flow: init logger thread data for decoders

Initialize the output flow api thread data for the decoder threads.

9 years agodecode: pass ThreadVars to DecodeThreadVarsFree
Victor Julien [Fri, 9 May 2014 13:10:54 +0000 (15:10 +0200)] 
decode: pass ThreadVars to DecodeThreadVarsFree

Flow output thread data deinit function which will be called from
DecodeThreadVarsFree will need it.

9 years agoflow: prepare flow forced reuse logging
Victor Julien [Fri, 9 May 2014 12:37:07 +0000 (14:37 +0200)] 
flow: prepare flow forced reuse logging

Most flows are marked for clean up by the flow manager, which then
passes them to the recycler. The recycler logs and cleans up. However,
under resource stress conditions, the packet threads can recycle
existing flow directly. So here the recycler has no role to play, as
the flow is immediately used.

For this reason, the packet threads need to be able to invoke the
flow logger directly.

The flow logging thread ctx will stored in the DecodeThreadVars
stucture. Therefore, this patch makes the DecodeThreadVars an argument
to FlowHandlePacket.

9 years agoflow: take flow pkt & byte count out of debug
Victor Julien [Wed, 7 May 2014 07:16:46 +0000 (09:16 +0200)] 
flow: take flow pkt & byte count out of debug

Until now the flow packet and byte counters were only available in
DEBUG mode. For logging purposes they are now available always.

9 years agoflow: don't BUG_ON if no loggers are enabled
Victor Julien [Tue, 6 May 2014 18:48:47 +0000 (20:48 +0200)] 
flow: don't BUG_ON if no loggers are enabled

API is always called, even if no loggers are enabled. Don't abort()
in this case.

9 years agoflow: clean up recycle queue at shutdown
Victor Julien [Tue, 6 May 2014 18:37:41 +0000 (20:37 +0200)] 
flow: clean up recycle queue at shutdown

Mostly for tests that don't start the recycler thread, make sure
all flows are cleaned up.

9 years agoflow unittest: update flow manager unit test
Victor Julien [Tue, 6 May 2014 11:47:18 +0000 (13:47 +0200)] 
flow unittest: update flow manager unit test

Test now tests a different queue.

9 years agoflow: track lastts in struct timeval
Victor Julien [Tue, 6 May 2014 10:15:39 +0000 (12:15 +0200)] 
flow: track lastts in struct timeval

Track full timestamp for lastts in flows to be able to log it.

9 years agoflow: track bytes per direction
Victor Julien [Tue, 6 May 2014 09:54:28 +0000 (11:54 +0200)] 
flow: track bytes per direction

Track bytes in both flow directions for logging purposes.

9 years agoflow log: log start/end times
Victor Julien [Tue, 6 May 2014 08:11:49 +0000 (10:11 +0200)] 
flow log: log start/end times

Log time of first packet (flow creation) and of the last packet.

9 years agoflow-log: log TCP flags seen
Victor Julien [Fri, 2 May 2014 07:54:16 +0000 (09:54 +0200)] 
flow-log: log TCP flags seen

Log TCP flags seen during the life time of a flow/session.

9 years agotcp: track TCP packet flags per session
Victor Julien [Fri, 2 May 2014 07:45:01 +0000 (09:45 +0200)] 
tcp: track TCP packet flags per session

For logging out in flow logging.

9 years agoflow-log: log pkts, bytes
Victor Julien [Fri, 2 May 2014 06:25:22 +0000 (08:25 +0200)] 
flow-log: log pkts, bytes

Only in DEBUG currently.

9 years agoflow-json-log: stub
Victor Julien [Thu, 1 May 2014 15:31:31 +0000 (17:31 +0200)] 
flow-json-log: stub

Stub for JSON flow logger.

9 years agoflow: flow log threading setup
Victor Julien [Thu, 1 May 2014 15:30:32 +0000 (17:30 +0200)] 
flow: flow log threading setup

Set up threading for the flow logger.

9 years agoflow log: call logger from recycler
Victor Julien [Thu, 1 May 2014 12:18:59 +0000 (14:18 +0200)] 
flow log: call logger from recycler

Call the flow logger API from the recycler thread, so that timed
out flows are logged.

9 years agoflow: output api stub
Victor Julien [Thu, 1 May 2014 11:31:10 +0000 (13:31 +0200)] 
flow: output api stub

Basic output API for flow logging.

9 years agoflow recycler: unix socket support
Victor Julien [Thu, 1 May 2014 10:50:02 +0000 (12:50 +0200)] 
flow recycler: unix socket support

Support starting and shutting down the flow recycler thread in the
unix socket runmode.

9 years agoflow recycler: shutdown
Victor Julien [Wed, 30 Apr 2014 16:49:39 +0000 (18:49 +0200)] 
flow recycler: shutdown

Only shut down when all flows in the recycle queue have been processed.

9 years agoflow: move flow cleanup to new 'recycler'
Victor Julien [Wed, 30 Apr 2014 11:57:17 +0000 (13:57 +0200)] 
flow: move flow cleanup to new 'recycler'

Move Flow clean up from the flow manager to the new flow recycler.

9 years agoflow: introduce FlowRecycler stub
Victor Julien [Wed, 30 Apr 2014 11:37:30 +0000 (13:37 +0200)] 
flow: introduce FlowRecycler stub

FlowRecycler thread stub. Start/stop code.

9 years agoflow: new flow queue: flow_recycle_q
Victor Julien [Wed, 30 Apr 2014 10:30:30 +0000 (12:30 +0200)] 
flow: new flow queue: flow_recycle_q

This queue will be used by the FlowManager to pass timed out flows
to another thread that will do the actual cleanup.

9 years agoFix eve 'filetype' parsing
Victor Julien [Mon, 28 Jul 2014 07:27:17 +0000 (09:27 +0200)] 
Fix eve 'filetype' parsing

Now that we use 'filetype' instead of 'type', we should also
use 'regular' instead of 'file'.

Added fallback to make sure we stay compatible to old configs.

9 years agoFixed memory leak
Alexander Gozman [Fri, 18 Jul 2014 20:02:19 +0000 (00:02 +0400)] 
Fixed memory leak

9 years agoFix possible crash when logfile descriptor is invalid
Alexander Gozman [Fri, 18 Jul 2014 16:36:12 +0000 (20:36 +0400)] 
Fix possible crash when logfile descriptor is invalid

9 years agoFix handling filetype for eve log
Alexander Gozman [Fri, 18 Jul 2014 16:34:23 +0000 (20:34 +0400)] 
Fix handling filetype for eve log