Andreas Herz [Tue, 31 May 2016 21:18:06 +0000 (23:18 +0200)]
suricata: fix double packet processing threads
With the additional ParseInterfacesList the packet processing threads
were doubled since the Interface was included twice unless the device
was passed via the commandline with af-packet=IF.
The additonal ParseInterfacesList isn't necessary so remove it again
Victor Julien [Tue, 31 May 2016 12:18:04 +0000 (14:18 +0200)]
pfring: improve profiling
Reset packet profiling after pfring_recv. The packet was taken from
the packet pool before this call. The packet will already have it's
start ticks initialized. To avoid including ticks while pfring_recv
waits for traffic, reset the ticks right after it.
Victor Julien [Sun, 29 May 2016 08:40:46 +0000 (10:40 +0200)]
flow worker: profiling
Previously the detect and stream code lived in their own thread
modules. This meant profiling showed their cost as part of the
thread module profiling logic. Now that only the flow worker is
a thread module this no longer works.
This patch introduces profiling for the 3 current flow worker
steps: flow, stream, detect.
Victor Julien [Fri, 27 May 2016 10:14:16 +0000 (12:14 +0200)]
smtp: improve thread data use
The SMTP app layer used a thread local data structure for the mpm in
reply parsing, but it only used a pmq. The MpmThreadCtx was actually
global. Until now this wasn't really noticed because non of the mpm's
used the thread ctx.
Hyperscan does use it however.
This patch creates a new structure SMTPThreadCtx, which contains both
the pmq and the mpm thread ctx. It's passed directly to the reply
parsing function instead of storing a pointer to it in the SMTPState.
Additionally fix a small memory leak warning wrt the smtp global mpm
state.
Eric Leblond [Tue, 12 Apr 2016 09:46:43 +0000 (11:46 +0200)]
af-packet: reset stats at start of capture
We can loose packets during setup because we are reading nothing.
So it is logical to discard the counter at start of capture to
start from a clean state. This means we don't need to account the
drop at start. But the stats call that will reset the drop counts
will also return and reset the packets count. So we need to know
how many packets we really have. This is in fact the number of
packets coming from the stats call minus the number of discarded
packets and the drop count. All the other packets will have to be
read.
Eric Leblond [Fri, 1 Apr 2016 12:01:09 +0000 (14:01 +0200)]
af-packet: use mmap capture by default
Update the code to use mmap capture by default even in unset in
configuration file. mmap capture is now be turned off by using
explicitely 'use-mmap: no' in configuration.
Eric Leblond [Sat, 9 Apr 2016 14:07:23 +0000 (16:07 +0200)]
af-packet: detect availability of tpacket_v3
If TPACKET_V3 is not defined then it is not available and we should
not build anything related to tpacket_v3. This will allow us to
activate it dy default and fallback to v2 if not available.
Eric Leblond [Fri, 22 Apr 2016 20:15:53 +0000 (22:15 +0200)]
af-packet: AFPWalkBlock error handling
Error handling was not done. The implementation is making the
choice to consider we must detroy the socket in case of parsing
error. The same was done for tpacket_v2.
Eric Leblond [Fri, 1 Apr 2016 20:33:22 +0000 (22:33 +0200)]
af-packet: continuing cleaning and hole hunting
Suppress useless fields in AFPThreadVars. This patch also get rid
of bytes counter as it was only used to display a message at exit.
Information on livedev and on packet counters are enough.
Eric Leblond [Mon, 28 Oct 2013 16:19:31 +0000 (17:19 +0100)]
af-packet: tpacket_v3 implementation
This patch adds a basic implementation of AF_PACKET tpacket v3. It
is basic in the way it is only working for 'workers' runnning mode.
If not in 'workers' mode there is a fallback to tpacket_v2. Feature
is activated via tpacket-v3 option in the af-packet section of
Suricata YAML.
Victor Julien [Mon, 16 Nov 2015 09:05:56 +0000 (10:05 +0100)]
http: improve body inspection
Enforce inspect window also in IDS mode. Try always to get at least
'inspect win' worth of data. In case there is more new data, take
some of the old data as well to make sure there is always some overlap.
This unifies IDS and IPS modes, the only difference left is the start
of inspection. IDS waits until min_size is available, IPS starts right
away.
Victor Julien [Wed, 11 Nov 2015 23:19:52 +0000 (00:19 +0100)]
http body handling: use streaming buffer API
Convert HTTP body handling to use the Streaming Buffer API. This means
the HtpBodyChunks no longer maintain their own data segments, but
instead add their data to the StreamingBuffer instance in the HtpBody
structure.
In case the HtpBodyChunk needs to access it's data it can do so still
through the Streaming Buffer API.
Updates & simplifies the various users of the reassembled bodies:
multipart parsing and the detection engine.