]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
8 years agostream: set 'trigger raw' per direction
Victor Julien [Sat, 18 Feb 2017 23:54:45 +0000 (00:54 +0100)] 
stream: set 'trigger raw' per direction

8 years agodetect / stream: new 'raw' stream inspection
Victor Julien [Fri, 17 Feb 2017 16:59:43 +0000 (17:59 +0100)] 
detect / stream: new 'raw' stream inspection

Remove the 'StreamMsg' approach from the engine. In this approach the
stream engine would create a list of chunks for inspection by the
detection engine. There were several issues:

1. the messages had a fixed size, so blocks of data bigger than ~4k
   would be cut into multiple messages

2. it lead to lots of data copying and unnecessary memory use

3. the StreamMsgs used a central pool

The Stream engine switched over to the streaming buffer API, which
means that the reassembled data is always available. This made the
StreamMsg approach even clunkier.

The new approach exposes the streaming buffer data to the detection
engine. It has to pay attention to an important issue though: packet
loss. The data may have gaps. The streaming buffer API tracks the
blocks of continuous data.

To access the data for inspection a callback approach is used. The
'StreamReassembleRaw' function is called with a callback and data.
This way it runs the MPM and individual rule inspection code. At
the end of each detection run the stream engine is notified that it
can move forward it's 'progress'.

8 years agostream: constify StreamTcpReassembleRawCheckLimit
Victor Julien [Wed, 8 Mar 2017 12:26:54 +0000 (13:26 +0100)] 
stream: constify StreamTcpReassembleRawCheckLimit

8 years agounittests: fail if TCP memory still in use
Victor Julien [Sat, 7 May 2016 15:24:32 +0000 (17:24 +0200)] 
unittests: fail if TCP memory still in use

abort() so test can be analyzed.

8 years agostream-tcp: implement thread pool for segments
Victor Julien [Fri, 6 May 2016 17:45:30 +0000 (19:45 +0200)] 
stream-tcp: implement thread pool for segments

Config option:

stream:
  reassembly:
    segment-prealloc: 2048

8 years agostream: implement memory handling functions
Victor Julien [Fri, 6 May 2016 15:12:42 +0000 (17:12 +0200)] 
stream: implement memory handling functions

8 years agostream: use static instead of dynamic streaming buffer structure
Victor Julien [Thu, 28 Apr 2016 15:21:28 +0000 (17:21 +0200)] 
stream: use static instead of dynamic streaming buffer structure

8 years agostream: test cleanups and fixes
Victor Julien [Thu, 28 Apr 2016 15:20:11 +0000 (17:20 +0200)] 
stream: test cleanups and fixes

8 years agostream: add insert failure counters
Victor Julien [Wed, 8 Mar 2017 11:50:32 +0000 (12:50 +0100)] 
stream: add insert failure counters

8 years agostream: add stream.reassembly.check-overlap-different-data option
Victor Julien [Thu, 28 Apr 2016 09:48:30 +0000 (11:48 +0200)] 
stream: add stream.reassembly.check-overlap-different-data option

8 years agostream: add tcp.overlap and tcp.overlap_diff_data counters
Victor Julien [Thu, 28 Apr 2016 08:53:49 +0000 (10:53 +0200)] 
stream: add tcp.overlap and tcp.overlap_diff_data counters

8 years agostream: improve no app and no raw case
Victor Julien [Sat, 25 Feb 2017 09:20:51 +0000 (10:20 +0100)] 
stream: improve no app and no raw case

8 years agostream: make raw_progress relative to STREAM_BASE_OFFSET
Victor Julien [Thu, 28 Apr 2016 07:53:24 +0000 (09:53 +0200)] 
stream: make raw_progress relative to STREAM_BASE_OFFSET

8 years agostream: make app_progress relative to STREAM_BASE_OFFSET
Victor Julien [Thu, 28 Apr 2016 06:44:10 +0000 (08:44 +0200)] 
stream: make app_progress relative to STREAM_BASE_OFFSET

8 years agostream: reduce space used for progress tracking
Victor Julien [Wed, 27 Apr 2016 20:13:27 +0000 (22:13 +0200)] 
stream: reduce space used for progress tracking

Instead of the explicit base_seq_offset, use a macro instead. The
macro points to the stream buffer offset. The two were always
in sync.

8 years agostream: small cleanups
Victor Julien [Wed, 27 Apr 2016 19:47:10 +0000 (21:47 +0200)] 
stream: small cleanups

8 years agostream: remove unused zero copy setting
Victor Julien [Wed, 27 Apr 2016 19:37:28 +0000 (21:37 +0200)] 
stream: remove unused zero copy setting

8 years agostream: safety check in overlap handling
Victor Julien [Wed, 8 Mar 2017 22:24:59 +0000 (23:24 +0100)] 
stream: safety check in overlap handling

8 years agotcp: streaming implementation
Victor Julien [Tue, 22 Dec 2015 09:26:04 +0000 (10:26 +0100)] 
tcp: streaming implementation

Make stream engine use the streaming buffer API for it's data storage.

This means that the data is stored in a single reassembled sliding
buffer. The subleties of the reassembly, e.g. overlap handling, are
taken care of at segment insertion.

The TcpSegments now have a StreamingBufferSegment that contains an
offset and a length. Using this the segment data can be retrieved
per segment.

Redo segment insertion. The insertion code is moved to it's own file
and is simplified a lot.

A major difference with the previous implementation is that the segment
list now contains overlapping segments if the traffic is that way.
Previously there could be more and smaller segments in the memory list
than what was seen on the wire.

Due to the matching of in memory segments and on the wire segments,
the overlap with different data detection (potential mots attacks)
is much more accurate.

Raw and App reassembly progress is no longer tracked per segment using
flags, but there is now a progress tracker in the TcpStream for each.

When pruning we make sure we don't slide beyond in-use segments. When
both app-layer and raw inspection are beyond the start of the segment
list, the segments might not be freed even though the data in the
streaming buffer is already gone. This is caused by the 'in-use' status
that the segments can implicitly have. This patch accounts for that
when calculating the 'left_edge' of the streaming window.

Raw reassembly still sets up 'StreamMsg' objects for content
inspection. They are set up based on either the full StreamingBuffer,
or based on the StreamingBufferBlocks if there are gaps in the data.

Reworked 'stream needs work' logic. When a flow times out the flow
engine checks whether a TCP flow still needs work. The
StreamNeedsReassembly function is used to test if a stream still has
unreassembled segments or uninspected stream chunks.

This patch updates the function to consider the app and/or raw
progress. It also cleans the function up and adds more meaningful
debug messages. Finally it makes it non-inline.

Unittests have been overhauled, and partly moved into their own files.

Remove lots of dead code.

8 years agostreaming: remove BUG_ON and other improvements
Victor Julien [Fri, 6 May 2016 17:45:11 +0000 (19:45 +0200)] 
streaming: remove BUG_ON and other improvements

Can be triggered by memory limits.

8 years agostreaming: add blocklist
Victor Julien [Wed, 20 Jan 2016 03:31:22 +0000 (22:31 -0500)] 
streaming: add blocklist

Add list of 'blocks'. This list contains offsets and lengths to
continuous data blocks. This is useful for TCP tracking where we
can have data gaps.

The blocks don't contain any data themselves, instead they contain
lenght and offsets. This way no extra copying is needed.

On inserting new data, existing blocks are expanded instead of
having multiple neighbouring blocks.

8 years agostream-tcp: StreamTcpUTAddPayload unittest helper
Victor Julien [Thu, 17 Mar 2016 09:08:00 +0000 (10:08 +0100)] 
stream-tcp: StreamTcpUTAddPayload unittest helper

8 years agoprofile: account flow-worker tcp-prune step
Victor Julien [Fri, 3 Mar 2017 08:08:23 +0000 (09:08 +0100)] 
profile: account flow-worker tcp-prune step

8 years agodoc: http keywords update
Victor Julien [Wed, 5 Apr 2017 08:33:23 +0000 (10:33 +0200)] 
doc: http keywords update

8 years agodetect: implement http_content_len sticky buffer
Victor Julien [Sat, 1 Apr 2017 21:58:51 +0000 (23:58 +0200)] 
detect: implement http_content_len sticky buffer

This implements inspection of the Content-Length buffer as a content
sticky buffer.

8 years agodetect: implement http_content_type sticky buffer
Victor Julien [Sat, 1 Apr 2017 21:28:12 +0000 (23:28 +0200)] 
detect: implement http_content_type sticky buffer

8 years agodetect: implement http_accept_enc sticky buffer
Victor Julien [Sat, 1 Apr 2017 10:38:46 +0000 (12:38 +0200)] 
detect: implement http_accept_enc sticky buffer

Inspects Accept-Encoding header.

8 years agodetect: implement http_accept_lang sticky buffer
Victor Julien [Sat, 1 Apr 2017 10:33:49 +0000 (12:33 +0200)] 
detect: implement http_accept_lang sticky buffer

Inspects Accept-Language header

8 years agodetect: implement http_connection sticky buffer
Victor Julien [Sat, 1 Apr 2017 10:23:05 +0000 (12:23 +0200)] 
detect: implement http_connection sticky buffer

8 years agodetect: implement http referer sticky buffer
Victor Julien [Sat, 1 Apr 2017 10:13:17 +0000 (12:13 +0200)] 
detect: implement http referer sticky buffer

8 years agodetect: http_accept sticky buffer + common code
Victor Julien [Sat, 1 Apr 2017 09:49:20 +0000 (11:49 +0200)] 
detect: http_accept sticky buffer + common code

Implement common code to easily add more per HTTP header detection
keywords.

Implement http_accept sticky buffer. It operates on the HTTP Accept
header.

8 years agotls: logging for session resumption 2672/head
Ray Ruvinskiy [Thu, 24 Nov 2016 17:16:09 +0000 (12:16 -0500)] 
tls: logging for session resumption

We assume session resumption has occurred if the Client Hello message
included a session id, we have not seen the server certificate, but
we have seen a Change Cipher Spec message from the server.

Previously, these transactions were not logged at all because the
server cert was never seen.

Ticket: https://redmine.openinfosecfoundation.org/issues/1969

8 years agodevice: fix warning about NULL device
Ray Ruvinskiy [Wed, 19 Apr 2017 15:27:26 +0000 (11:27 -0400)] 
device: fix warning about NULL device

Fix '[ERRCODE: SC_ERR_INVALID_VALUE(130)] - Name of device should not be null'
warning on start-up with pfring.

Ticket: https://redmine.openinfosecfoundation.org/issues/2097

8 years agoredis: use SCCalloc to reduce risk of unitialized vars
Victor Julien [Thu, 20 Apr 2017 07:32:01 +0000 (09:32 +0200)] 
redis: use SCCalloc to reduce risk of unitialized vars

8 years agoeve: async mode for redis output
fooinha [Thu, 23 Feb 2017 22:42:05 +0000 (22:42 +0000)] 
eve: async mode for redis output

eve: detects libevent for async redis at configure
eve: moves redis output code to new file - util-log-redis.{c,h}
eve: redis ECHO and QUIT commands for async mode
eve: redis output defaults if conf is missing

8 years agodoc: async mode for redis eve output
fooinha [Thu, 23 Feb 2017 22:42:51 +0000 (22:42 +0000)] 
doc: async mode for redis eve output

async: true ## if redis replies are read asynchronously

8 years agoqa: add --no-random commandline option 2666/head
Victor Julien [Sat, 15 Apr 2017 16:58:31 +0000 (18:58 +0200)] 
qa: add --no-random commandline option

8 years agoqa: add rand/rand_r to banned functions
Victor Julien [Sat, 15 Apr 2017 21:34:18 +0000 (23:34 +0200)] 
qa: add rand/rand_r to banned functions

8 years agorandom: convert stream and htp to new call
Victor Julien [Sat, 15 Apr 2017 21:29:48 +0000 (23:29 +0200)] 
random: convert stream and htp to new call

8 years agorandom: improve random logic
Victor Julien [Sat, 15 Apr 2017 21:20:48 +0000 (23:20 +0200)] 
random: improve random logic

Improve random logic for hash tables.

Implement Windows random API if it is available.

8 years agomingw: don't use uint type as mingw doesn't have it
Victor Julien [Thu, 13 Apr 2017 14:55:34 +0000 (16:55 +0200)] 
mingw: don't use uint type as mingw doesn't have it

8 years agocommon: improve byte order and wordsize detection 2661/head
Victor Julien [Mon, 10 Apr 2017 07:39:23 +0000 (09:39 +0200)] 
common: improve byte order and wordsize detection

8 years agocore dumps: check for sys/resource.h
Victor Julien [Mon, 10 Apr 2017 07:38:59 +0000 (09:38 +0200)] 
core dumps: check for sys/resource.h

8 years agocleanup: get rid of %llu format specifiers
Victor Julien [Sun, 9 Apr 2017 19:04:14 +0000 (21:04 +0200)] 
cleanup: get rid of %llu format specifiers

Use more explicit types instead.

8 years agodoc: Napatech docs improvement
psanders240 [Thu, 16 Mar 2017 19:41:16 +0000 (15:41 -0400)] 
doc: Napatech docs improvement

Fix errors and simplify filters.

8 years agotemplate script: typo in app-layer setup script
Jason Ish [Mon, 10 Apr 2017 04:12:12 +0000 (22:12 -0600)] 
template script: typo in app-layer setup script

Check for ed was failing, as it was actually looking for edx.

8 years agopcre: on ppc64 disable only for specific versions
Victor Julien [Thu, 13 Apr 2017 07:58:36 +0000 (09:58 +0200)] 
pcre: on ppc64 disable only for specific versions

Disable jit only for libpcre 8.39 and 8.40 as those were the buggy
versions.

Thanks to Zoltán Herczeg.

8 years agodoc: expand on bpf
Victor Julien [Thu, 13 Apr 2017 07:25:11 +0000 (09:25 +0200)] 
doc: expand on bpf

8 years agodetect: don't consider an empty rule file an error 2655/head
Jason Ish [Wed, 15 Mar 2017 16:52:57 +0000 (10:52 -0600)] 
detect: don't consider an empty rule file an error

8 years agologging: only do non-blocking writes if live
Jason Ish [Wed, 5 Apr 2017 04:44:21 +0000 (22:44 -0600)] 
logging: only do non-blocking writes if live

If running against a pcap there is no reason to drop events,
a blocking socket is fine here. So only do non-blocking writes
when running off a live device.

8 years agoeve: log number of events dropped at exit
Jason Ish [Wed, 5 Apr 2017 04:21:37 +0000 (22:21 -0600)] 
eve: log number of events dropped at exit

8 years agologging: don't block on socket writes
Jason Ish [Thu, 23 Feb 2017 22:22:42 +0000 (16:22 -0600)] 
logging: don't block on socket writes

Writing to a unix socket can cause Suricata to block in the
packet path. This could happen if the read-endpoint of the
unix socket stays connected, but stops reading, or simply
can't read fast enough as part of its event processing.

To choose packets over events, do non-blocking socket
writes and drop the event if the write would block and
update a dropped counter.

8 years agodoc: add documentation for date modifiers in eve-log
Mats Klepsland [Tue, 14 Feb 2017 09:59:41 +0000 (10:59 +0100)] 
doc: add documentation for date modifiers in eve-log

8 years agodoc: add documentation for eve-log file rotation
Mats Klepsland [Tue, 14 Feb 2017 09:53:34 +0000 (10:53 +0100)] 
doc: add documentation for eve-log file rotation

8 years agologging: create log directories when needed
Mats Klepsland [Tue, 14 Feb 2017 09:32:33 +0000 (10:32 +0100)] 
logging: create log directories when needed

Recursively create new log directories when needed. This makes it
possible to use date modifiers in the file path to create
directories based on date, e.g.:

  /var/log/suricata/2017/02/14/

8 years agooutput-json: rotate log file based on time
Mats Klepsland [Tue, 14 Feb 2017 07:41:40 +0000 (08:41 +0100)] 
output-json: rotate log file based on time

Rotate log file based on time. Support both rotating based on a timer (XXs,
XXm, XXd, XXw) and rotating based on a absolute time, like each minute,
hour or day.

8 years agologging: support date modifiers in log filenames
Mats Klepsland [Tue, 14 Feb 2017 07:29:44 +0000 (08:29 +0100)] 
logging: support date modifiers in log filenames

Allow log filenames to contain date modifiers, e.g.:

  - eve-log:
    filename: eve-%Y-%m-%d-%H:%M:%S.json

8 years agopcre: disable jit on powerpc64 2653/head
Victor Julien [Thu, 6 Apr 2017 11:05:35 +0000 (13:05 +0200)] 
pcre: disable jit on powerpc64

It appears that both using gcc and clang something gets misoptimised
around pcre's jit. So disable jit for now.

8 years agodefrag: (windows) detect more overlaps
Jason Ish [Mon, 6 Mar 2017 20:38:04 +0000 (14:38 -0600)] 
defrag: (windows) detect more overlaps

8 years agodefrag: (linux) fix an error in overlapping fragments
Jason Ish [Mon, 6 Mar 2017 17:23:48 +0000 (11:23 -0600)] 
defrag: (linux) fix an error in overlapping fragments

If a subsequent fragment has a lower offset than a previous
one and overlaps, trim off the beginning of the previous
fragment.

Based on an issue reported privately.

8 years agodefrag: use new unit test macros
Jason Ish [Mon, 6 Mar 2017 03:17:47 +0000 (21:17 -0600)] 
defrag: use new unit test macros

Also reformat unit test functions to Suricata style.

8 years agotravis: use new container build infrastructure
Jason Ish [Wed, 29 Mar 2017 20:09:32 +0000 (14:09 -0600)] 
travis: use new container build infrastructure

Migrate to the new Travis container build system. This build system does
not allow use of sudo, so required packages must be done declaratively
which required reworking how we install packages that are conditional
based on the build being done.

Mac builds are still done with sudo=true.

8 years agounix-socket: return failure on failure
Jason Ish [Tue, 4 Apr 2017 13:51:19 +0000 (07:51 -0600)] 
unix-socket: return failure on failure

UnixManagerThreadInit needs to return a failure code if the socket
fails to initialize to avoid entering the UnixManager loop which
will continuously fail on the call to bind, as no listening
socket was setup.

This can occur when the socket fails to initialize due to a
permissions error and fatal init errors is not on.

8 years agolog: tls custom format log
fooinha [Sat, 3 Dec 2016 19:26:16 +0000 (19:26 +0000)] 
log: tls custom format log

8 years agolog: common custom format output
fooinha [Sat, 3 Dec 2016 12:22:26 +0000 (12:22 +0000)] 
log: common custom format output

8 years agogeoip: fix compiler warning
Victor Julien [Thu, 6 Apr 2017 06:59:34 +0000 (08:59 +0200)] 
geoip: fix compiler warning

detect-geoip.c:78:40: error: incompatible pointer types assigning to 'int (*)(ThreadVars *, DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)' from 'int (ThreadVars *, DetectEngineThreadCtx *, Packet *, Signature *, const SigMatchCtx *)' [-Werror,-Wincompatible-pointer-types]
    sigmatch_table[DETECT_GEOIP].Match = DetectGeoipMatch;
                                       ^ ~~~~~~~~~~~~~~~~
1 error generated.

Bug #2045

8 years agomodbus: fix compiler warnings about alignment
Victor Julien [Wed, 5 Apr 2017 19:19:33 +0000 (15:19 -0400)] 
modbus: fix compiler warnings about alignment

app-layer-modbus.c:1226:39: warning: taking address of packed member 'transactionId' of class or structure 'ModbusHeader_' may result in an unaligned pointer value [-Waddress-of-packed-member]
    if (ModbusExtractUint16(modbus, &(header->transactionId), input, input_len, &offset)    ||
                                      ^~~~~~~~~~~~~~~~~~~~~
app-layer-modbus.c:1228:39: warning: taking address of packed member 'protocolId' of class or structure 'ModbusHeader_' may result in an unaligned pointer value [-Waddress-of-packed-member]
        ModbusExtractUint16(modbus, &(header->protocolId), input, input_len, &offset)       ||
                                      ^~~~~~~~~~~~~~~~~~
app-layer-modbus.c:1230:39: warning: taking address of packed member 'length' of class or structure 'ModbusHeader_' may result in an unaligned pointer value [-Waddress-of-packed-member]
        ModbusExtractUint16(modbus, &(header->length), input, input_len, &offset)           ||
                                      ^~~~~~~~~~~~~~
3 warnings generated.

Bug #2088

8 years agopool: fix compiler warning
Victor Julien [Wed, 5 Apr 2017 13:13:17 +0000 (15:13 +0200)] 
pool: fix compiler warning

clang-4.0 reported:

util-pool.c:242:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^           ~
util-pool.c:242:13: note: add parentheses after the '!' to evaluate the bitwise operator first
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
              (                                   )
util-pool.c:242:13: note: add parentheses around left hand side expression to silence this warning
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
            (          )
util-pool.c:261:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^           ~
util-pool.c:261:13: note: add parentheses after the '!' to evaluate the bitwise operator first
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
              (                                   )
util-pool.c:261:13: note: add parentheses around left hand side expression to silence this warning
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
            (          )
2 warnings generated.

8 years agoaf-packet: fix cppcheck false positive 2644/head
Victor Julien [Mon, 3 Apr 2017 14:09:18 +0000 (16:09 +0200)] 
af-packet: fix cppcheck false positive

[src/source-af-packet.c:1903]: (error) Resource leak: fd

8 years agohttp: fix body tracking corner case 2629/head
Victor Julien [Wed, 29 Mar 2017 09:15:51 +0000 (11:15 +0200)] 
http: fix body tracking corner case

In some cases, observed with inspect limits 0, the body tracking could
get confused. When all chunks were already freed, a new chunk would
be considered to be the start of the body. This would overwrite the
bodies 'content_len_so_far' tracker, instead of adding to it. This in
turn could lead to a assertion abort in the inspection code.

This patch redoes the append code to always add the current lenght. It
cleans up the code to remove redundant logic.

Issue: https://redmine.openinfosecfoundation.org/issues/2078
Reported-By: Jørgen Bøhnsdalen
8 years agodefrag: fix argument used in macro to match signature 2627/head
Jason Ish [Mon, 20 Mar 2017 16:54:51 +0000 (10:54 -0600)] 
defrag: fix argument used in macro to match signature

"p" was being used in the macro but was not an argument to
the macro, but it worked due to the context of the macro.

Use the actual macro argument, d2, instead of p.

Results in no change to generated code.

8 years agodoc: add documentation for Lua SCFlowTimestamps
Mats Klepsland [Fri, 10 Mar 2017 06:23:30 +0000 (07:23 +0100)] 
doc: add documentation for Lua SCFlowTimestamps

8 years agolua: add SCFlowTimestamps function
Mats Klepsland [Fri, 10 Mar 2017 06:07:09 +0000 (07:07 +0100)] 
lua: add SCFlowTimestamps function

Add SCFlowTimestamps() to return startts and lastts as seconds and
microseconds from flow.

Examples:

  startts, lastts = SCFlowTimestamps()
  startts_s, lastts_s, startts_us, lastts_us = SCFlowTimestamps()

8 years agodoc: add documentation for eve-log file permissions 2626/head
Mats Klepsland [Wed, 22 Feb 2017 06:54:26 +0000 (07:54 +0100)] 
doc: add documentation for eve-log file permissions

8 years agologging: support custom file permissions
Mats Klepsland [Tue, 21 Feb 2017 09:41:57 +0000 (10:41 +0100)] 
logging: support custom file permissions

Support setting file permissions per logger using 'filemode', e.g.:

  outputs:
    - eve-log:
        enabled: yes
        filetype: regular
        filename: eve.json
        filemode: 660

8 years agoipv4: update checksum function to be like tcp/udp 2624/head
Jason Ish [Tue, 21 Feb 2017 19:42:50 +0000 (13:42 -0600)] 
ipv4: update checksum function to be like tcp/udp

Update the IPv4 checksum function to be like the
changed TCP/UDP checksum functions for consistency.

8 years agotcp/udp: rename checksum functions for better meaning
Jason Ish [Tue, 21 Feb 2017 19:31:41 +0000 (13:31 -0600)] 
tcp/udp: rename checksum functions for better meaning

The TCP/UDP checksum functions no longer just calculate
the checksum, they can validate as well as calculate so
use a more generic name.

8 years agotcp/udp: fix checksum validation when 0xffff
Jason Ish [Fri, 17 Feb 2017 22:04:23 +0000 (16:04 -0600)] 
tcp/udp: fix checksum validation when 0xffff

Issue:
https://redmine.openinfosecfoundation.org/issues/2041

One approach to fixing this issue to just validate the
checksum instead of regenerating it and comparing it. This
method is used in some kernels and other network tools.

When validating, the current checksum is passed in as an
initial argument which will cause the final checksum to be 0
if OK. If generating a checksum, 0 is passed and the result
is the generated checksum.

8 years agodocs: fix statement about flow:to_server
Jon Zeolla [Mon, 13 Mar 2017 16:51:44 +0000 (12:51 -0400)] 
docs: fix statement about flow:to_server

8 years agodocs: clarify how iprep works
Jon Zeolla [Mon, 13 Mar 2017 16:49:04 +0000 (12:49 -0400)] 
docs: clarify how iprep works

8 years agotravis: macos: unlink all deps, then relink
Jason Ish [Fri, 24 Mar 2017 19:59:39 +0000 (13:59 -0600)] 
travis: macos: unlink all deps, then relink

Kind of ugly, but first unlink all dependencies then install.
The deps that don't get an upgrade will remain unlinked, so
relink all dependencies as relinking an already linked dep
does not error out.

8 years agoprint: constify input 2622/head
Victor Julien [Mon, 13 Mar 2017 12:53:52 +0000 (13:53 +0100)] 
print: constify input

8 years agodetect: fix ssl_state test
Victor Julien [Thu, 9 Mar 2017 11:57:40 +0000 (12:57 +0100)] 
detect: fix ssl_state test

8 years agodisable-detect: fix needless file hashing
Victor Julien [Wed, 1 Mar 2017 22:32:21 +0000 (23:32 +0100)] 
disable-detect: fix needless file hashing

When detection is running flags are set on flows to indicate if file
hashing is needed. This is based on global output settings and rules.

In the case of --disable-detection this was not happening, so all
files where hashed with all methods. This has a significant
performance impact.

This patch adds logic to set the flow flags in --disable-detect mode.

8 years agoapp-layer: remove version logic
Victor Julien [Tue, 28 Feb 2017 08:38:00 +0000 (09:38 +0100)] 
app-layer: remove version logic

8 years agoflow: remove unused alversion fields
Victor Julien [Mon, 27 Feb 2017 22:51:31 +0000 (23:51 +0100)] 
flow: remove unused alversion fields

8 years agodetect: remove unused alversion logic
Victor Julien [Mon, 27 Feb 2017 22:44:00 +0000 (23:44 +0100)] 
detect: remove unused alversion logic

8 years agodetect: simplify state detect code: remove unused params
Victor Julien [Mon, 27 Feb 2017 22:39:41 +0000 (23:39 +0100)] 
detect: simplify state detect code: remove unused params

8 years agodetect: clean up test
Victor Julien [Mon, 27 Feb 2017 23:28:10 +0000 (00:28 +0100)] 
detect: clean up test

8 years agobytejump: don't print errors when matching
Victor Julien [Mon, 6 Mar 2017 09:54:57 +0000 (10:54 +0100)] 
bytejump: don't print errors when matching

When bytejump was told to convert some payload data to int from a
string it would print an error to the screen if the conversion
failed. This is unwanted as the payload is controlled by an attacker
and printing is expensive.

8 years agofile-store: fix force store
Victor Julien [Wed, 1 Mar 2017 22:23:04 +0000 (23:23 +0100)] 
file-store: fix force store

8 years agoapp-layer: fix gap handling in protocol detection
Victor Julien [Sun, 26 Feb 2017 18:56:38 +0000 (19:56 +0100)] 
app-layer: fix gap handling in protocol detection

A GAP during protocol detection would lead to all reassembly
getting disabled, so also the raw reassembly. In addition, it
could prevent the opposing side from doing protocol detection.

This patch remove the 'disable reassembly' logic. Stream engine
will take the stream with GAP and app-layer will make the proto
detection as complete.

8 years agofile store: store multiple files if available
Victor Julien [Fri, 10 Mar 2017 18:12:32 +0000 (19:12 +0100)] 
file store: store multiple files if available

8 years agoapp-layer: fix memleak on bad traffic
Victor Julien [Thu, 23 Feb 2017 15:45:32 +0000 (16:45 +0100)] 
app-layer: fix memleak on bad traffic

If state was alloc'd after protocol detection, but then the direction
turned out to be wrong, the state would not be freed.

8 years agoippair: fix xbits unset memleak
Victor Julien [Mon, 27 Feb 2017 19:38:41 +0000 (20:38 +0100)] 
ippair: fix xbits unset memleak

8 years agoippair: use both addresses in hash
Victor Julien [Mon, 27 Feb 2017 17:32:22 +0000 (18:32 +0100)] 
ippair: use both addresses in hash

8 years agostream: validate SACK right edge to be in window
Victor Julien [Mon, 27 Feb 2017 11:27:11 +0000 (12:27 +0100)] 
stream: validate SACK right edge to be in window

8 years agostream: remove unused stream config member
Victor Julien [Sun, 26 Feb 2017 17:32:27 +0000 (18:32 +0100)] 
stream: remove unused stream config member

8 years agostream: make data pointer in StreamSegmentCallback const
Victor Julien [Sun, 24 Apr 2016 07:33:54 +0000 (09:33 +0200)] 
stream: make data pointer in StreamSegmentCallback const

8 years agostream: remove unused variable
Victor Julien [Fri, 17 Feb 2017 15:00:42 +0000 (16:00 +0100)] 
stream: remove unused variable