]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
8 years agodns: fix log filtering 2719/head
Jason Ish [Tue, 9 May 2017 23:40:56 +0000 (17:40 -0600)] 
dns: fix log filtering

Previously only a subset of the records could be selected
in custom. Now allow any to be selected.

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
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 agobug 2113: unix-socket start up race
Victor Julien [Tue, 16 May 2017 07:39:02 +0000 (09:39 +0200)] 
bug 2113: unix-socket start up race

8 years agoflow-worker: clean up thread init 2634/head
Victor Julien [Thu, 16 Feb 2017 15:41:06 +0000 (16:41 +0100)] 
flow-worker: clean up thread init

8 years agoautoconf - look for stdbool.h
Jason Ish [Mon, 16 Jan 2017 22:02:43 +0000 (16:02 -0600)] 
autoconf - look for stdbool.h

8 years agohttp: fix body tracking corner case
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 agoaf-packet: fix parsing packet in TPACKET_V3 mode
Alexander Gozman [Mon, 20 Feb 2017 13:47:31 +0000 (16:47 +0300)] 
af-packet: fix parsing packet in TPACKET_V3 mode

AFPParsePacketV3() saved tpacket_block_desc structure
instead of tpacket3_hdr. As a result, reconstructed
packets were wrong.

Bug #2047.

8 years agoaf-packet: get VLAN info for packets in TPACKET_V3 mode
Alexander Gozman [Mon, 20 Feb 2017 13:43:10 +0000 (16:43 +0300)] 
af-packet: get VLAN info for packets in TPACKET_V3 mode

8 years agoaf-packet: write VLAN info for both TPACKET_V2 and V3
Alexander Gozman [Mon, 20 Feb 2017 13:41:18 +0000 (16:41 +0300)] 
af-packet: write VLAN info for both TPACKET_V2 and V3

8 years agodefrag: fix argument used in macro to match signature
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 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 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 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 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 agoipv4: update checksum function to be like tcp/udp
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 agoqa/appveyor: install libiconv-devel 2632/head
Victor Julien [Fri, 24 Mar 2017 09:15:09 +0000 (10:15 +0100)] 
qa/appveyor: install libiconv-devel

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 agotravis: fix pkg-config in mac builds
Victor Julien [Fri, 24 Mar 2017 11:40:18 +0000 (12:40 +0100)] 
travis: fix pkg-config in mac builds

Unlink pkg-config before installing.

8 years agotravis: fix libpcre in mac builds
Jason Ish [Fri, 17 Mar 2017 17:11:07 +0000 (11:11 -0600)] 
travis: fix libpcre in mac builds

It looks like Travis changed their Mac image and pcre is now
installed by default. In case it gets removed again, just unlink
it before re-installing so it doesn't fail on install.

8 years agoMakefile: fix race condition in make install-full
Jason Ish [Thu, 16 Feb 2017 19:02:58 +0000 (13:02 -0600)] 
Makefile: fix race condition in make install-full

Use recursive make for the install process so it
is executed in a predictable order.

Addresses issue:
https://redmine.openinfosecfoundation.org/issues/1470
which triggered on OSX/macOS.

8 years agochangelog: update for 3.2.1 release suricata-3.2.1
Victor Julien [Wed, 15 Feb 2017 07:49:07 +0000 (08:49 +0100)] 
changelog: update for 3.2.1 release

8 years agodns: fix outputs with 0-len A/AAAA records
Victor Julien [Mon, 13 Feb 2017 09:39:26 +0000 (10:39 +0100)] 
dns: fix outputs with 0-len A/AAAA records

8 years agodns: fix out of bounds read
Victor Julien [Thu, 9 Feb 2017 14:40:30 +0000 (15:40 +0100)] 
dns: fix out of bounds read

On a zero size A or AAAA record, 4 or 16 bytes would still be
read.

Found with AFL+ASAN.

8 years agodefrag - take protocol into account during re-assembly
Jason Ish [Sun, 5 Feb 2017 13:57:54 +0000 (07:57 -0600)] 
defrag - take protocol into account during re-assembly

The IP protocol was not being used to match fragments with
their packets allowing a carefully constructed packet
with a different protocol to be matched, allowing re-assembly
to complete, creating a packet that would not be re-assembled
by the destination host.

8 years agoafl: add ethernet and erspan entry points 2552/head
Victor Julien [Sun, 12 Feb 2017 06:52:04 +0000 (07:52 +0100)] 
afl: add ethernet and erspan entry points

8 years agoafl: clean up commandline parsing
Victor Julien [Sat, 11 Feb 2017 09:47:38 +0000 (10:47 +0100)] 
afl: clean up commandline parsing

8 years agoafl: pass a packet queue to decoder calls
Victor Julien [Fri, 10 Feb 2017 18:58:27 +0000 (19:58 +0100)] 
afl: pass a packet queue to decoder calls

8 years agoafl: set the packet data so pktlen gets set
Jason Ish [Fri, 10 Feb 2017 17:21:57 +0000 (11:21 -0600)] 
afl: set the packet data so pktlen gets set

8 years agoafl: minimalistic script to start AFL fuzzers
Victor Julien [Thu, 9 Feb 2017 18:10:02 +0000 (19:10 +0100)] 
afl: minimalistic script to start AFL fuzzers

in suricata source dir:

mkdir afl
cd afl
bash ../scripts/afl/runafl.sh decoder-ipv4

8 years agoafl: util script to list crashed series
Victor Julien [Thu, 9 Feb 2017 17:34:20 +0000 (18:34 +0100)] 
afl: util script to list crashed series

8 years agoafl: improve packet fuzz testing
Victor Julien [Thu, 9 Feb 2017 17:22:18 +0000 (18:22 +0100)] 
afl: improve packet fuzz testing

Due to the use of AFL_LOOP and initialization/deinit outside of it,
part of the fuzzing relied on the global 'state' in flow and defrag.
Because of this crashes that were found could not be reproduced. The
saved crash input was only the last in the series.

This patch addresses that. It requires a new output directory 'dump'
where the packet fuzzers will store all their input. If the AFL_LOOP
fails the files will not be removed and this 'serie' can be read
again for reproducing the issue.

e.g.: AFL would work with:
--afl-decoder-ppp=@@

and after a crash is found the produced serie can be read with:
--afl-decoder-ppp-serie=1486656919-514163

The series have a timestamp as name and a suffix that controls the
order in which the files will be 'replayed' in Suricata.

8 years agoafl: add decoder ipv4 option
Victor Julien [Thu, 9 Feb 2017 08:45:54 +0000 (09:45 +0100)] 
afl: add decoder ipv4 option

8 years agompm-ac: fix integer overflow on allocation 2550/head
Sascha Steinbiss [Wed, 8 Feb 2017 11:39:06 +0000 (12:39 +0100)] 
mpm-ac: fix integer overflow on allocation

The size of a memory buffer to be allocated was kept in a signed int
instead of a size_t, leading to an overflow when large lists of long
and diverse patterns cause the amount of AC states to blow up (>2GB).
Fixes Redmine issues #1827 and #1843.

Signed-off-by: Sascha Steinbiss <sascha@steinbiss.name>
8 years agoalert: silence compiler type warning
Sascha Steinbiss [Wed, 8 Feb 2017 11:40:00 +0000 (12:40 +0100)] 
alert: silence compiler type warning

The `ts_ecr' and `ts_val' struct fields are integer types, not
pointers. This leads GCC 6.3.0 to complain about comparisons to
NULL.

Signed-off-by: Sascha Steinbiss <sascha@steinbiss.name>
8 years agodetect: don't run IP inspection on non-IP packets 2549/head
Victor Julien [Wed, 8 Feb 2017 12:55:34 +0000 (13:55 +0100)] 
detect: don't run IP inspection on non-IP packets

The code to get the rule group (sgh) would return the group for
IP proto 0 instead of nothing. This lead to certain types of rules
unintentionally matching (False Positive).

Since the packets weren't actually IP, the logged alert records
were missing the IP header.

Bug #2017.

8 years agoafl: fix ENIP, switch DNS to UDP and add --afl-dnstcp*
Victor Julien [Wed, 8 Feb 2017 08:20:54 +0000 (09:20 +0100)] 
afl: fix ENIP, switch DNS to UDP and add --afl-dnstcp*

8 years agoafl: with -Wshadow issues
Victor Julien [Wed, 8 Feb 2017 07:40:46 +0000 (08:40 +0100)] 
afl: with -Wshadow issues

8 years agoaf-packet: add VLAN header when needed in IPS mode
Eric Leblond [Tue, 1 Nov 2016 21:09:31 +0000 (22:09 +0100)] 
af-packet: add VLAN header when needed in IPS mode

When packet is coming from a real ethernet card, the kernel is
stripping the vlan header and delivering a modified packet so
we need to insert the VLAN header back before sending the packet
on the wire.

To do so, we pass an option to the raw socket to add a reserve
before the packet data. It will get Suricata some head room to
to move the ethernet addresses before there actual place and
and insert the VLAN header in the correct place.

We get VLAN info from the ring buffer as the call of AFPWrite is
always done in the release function so we still have access to the
memory.

8 years agodetect-tls-sni: add link to documentation 2534/head
Eric Leblond [Mon, 30 Jan 2017 19:25:41 +0000 (20:25 +0100)] 
detect-tls-sni: add link to documentation

8 years agodoc: document the tls_sni keyword
Eric Leblond [Mon, 30 Jan 2017 19:24:10 +0000 (20:24 +0100)] 
doc: document the tls_sni keyword

8 years agodetect-tls: add url field pointing to doc
Eric Leblond [Mon, 30 Jan 2017 19:13:04 +0000 (20:13 +0100)] 
detect-tls: add url field pointing to doc

8 years agodetect-xbits: set documentation URL
Eric Leblond [Mon, 30 Jan 2017 18:18:37 +0000 (19:18 +0100)] 
detect-xbits: set documentation URL

8 years agodns-log: log requests even when there is no response
Jason Ish [Tue, 31 Jan 2017 18:32:18 +0000 (12:32 -0600)] 
dns-log: log requests even when there is no response

The JSON logger had already been updated to handle
transactions without a response. Apply the same logic
to the older dns-log where a logger is registered
for each direction.

Fixes issue 2012.

8 years agoapp-layer-parsing: detect malformed input
Andreas Herz [Tue, 29 Nov 2016 21:10:56 +0000 (22:10 +0100)] 
app-layer-parsing: detect malformed input

If the app-layer-parsing has a very long content it exceeds the maximum
defined in "alproto_name". This adds a check for the too long content
before it will be passed to "strlcpy" and logs an error.

8 years agodetect: remove unused flow_locked hint
Victor Julien [Fri, 23 Dec 2016 13:59:11 +0000 (14:59 +0100)] 
detect: remove unused flow_locked hint

8 years agodetect: make tenant loading less verbose
Victor Julien [Fri, 23 Dec 2016 10:58:30 +0000 (11:58 +0100)] 
detect: make tenant loading less verbose

8 years agoprofiling: fix memory leaks
Victor Julien [Fri, 23 Dec 2016 10:08:11 +0000 (11:08 +0100)] 
profiling: fix memory leaks

8 years agodetect: use TLS_STATE_CERT_READY in cert inspect
Victor Julien [Wed, 21 Dec 2016 19:13:28 +0000 (20:13 +0100)] 
detect: use TLS_STATE_CERT_READY in cert inspect

8 years agotls: introduce 'cert ready' state
Victor Julien [Wed, 21 Dec 2016 19:10:57 +0000 (20:10 +0100)] 
tls: introduce 'cert ready' state

8 years agocommon: add BIT_U8 macro
Victor Julien [Fri, 23 Dec 2016 14:17:01 +0000 (15:17 +0100)] 
common: add BIT_U8 macro

8 years agompm/spm: check for SSSE3 and enable/disable HS 2524/head
Sascha Steinbiss [Fri, 20 Jan 2017 14:28:41 +0000 (15:28 +0100)] 
mpm/spm: check for SSSE3 and enable/disable HS

The new Hyperscan 4.4 API provides a function to check for SSSE3
presence at runtime. This allows us to fall back to non-Hyperscan
matchers on systems without SSSE3 even when the suricata executable
is built with Hyperscan support. Addresses Redmine issue #2010.

Signed-off-by: Sascha Steinbiss <sascha@steinbiss.name>
Tested-by: Arturo Borrero Gonzalez <arturo@debian.org>
8 years agostream: initialize stream segment pool from mtu
Victor Julien [Thu, 26 Jan 2017 17:05:11 +0000 (18:05 +0100)] 
stream: initialize stream segment pool from mtu

If segments section in the yaml is ommitted (default) or when the
pool size is set to 'from_mtu', the size of the pool will be MTU
minus 40. If the MTU couldn't be determined, it's assumed to be
1500, so the segment size for the bool will be 1460.

8 years agomtu: track max mtu for capture devices
Victor Julien [Fri, 27 Jan 2017 09:03:39 +0000 (10:03 +0100)] 
mtu: track max mtu for capture devices

8 years agoshutdown: remove pid file last
Victor Julien [Fri, 27 Jan 2017 09:15:59 +0000 (10:15 +0100)] 
shutdown: remove pid file last

8 years agostartup: clean up main loop
Victor Julien [Wed, 25 Jan 2017 09:13:46 +0000 (10:13 +0100)] 
startup: clean up main loop

8 years agounittests: clean up registration and startup
Victor Julien [Wed, 25 Jan 2017 08:51:15 +0000 (09:51 +0100)] 
unittests: clean up registration and startup

8 years agoshutdown: move global shutdown steps into func
Victor Julien [Wed, 25 Jan 2017 08:34:57 +0000 (09:34 +0100)] 
shutdown: move global shutdown steps into func

8 years agostartup/shutdown: cleanup and unify with unix mode
Victor Julien [Tue, 24 Jan 2017 11:27:35 +0000 (12:27 +0100)] 
startup/shutdown: cleanup and unify with unix mode

8 years agothreads: fix missed logging at shutdown 2518/head
Victor Julien [Thu, 26 Jan 2017 09:16:53 +0000 (10:16 +0100)] 
threads: fix missed logging at shutdown

At shutdown, all flows that still need work are handled by the flow
force reassembly logic. This means one or more flow end pseudo packets
are generated and pushed through the engine for final detection and
logging.

In some cases this would not work correctly. This was caused by the
flow timeout logic kicking in before all the 'live' packets were
processed. Before the flow timeout handling runs the receive threads
are disabled, however the engine did not wait for the in-flight
packets to be fully processed. In autofp mode, packets could still
be in the queue between receive thread(s) and flow worker(s).

This patch adds a new function that 'drains' all the packet threads
of any in-progress packets before moving on the flow timeout logic.

Bug #1946.

8 years agotemplate script: use bash and require ed 2516/head
Jason Ish [Thu, 19 Jan 2017 15:28:45 +0000 (09:28 -0600)] 
template script: use bash and require ed

For now these scripts only work in bash, and the "ed" program
is required.

8 years agotemplates: require the protocol name to start with a capital
Jason Ish [Fri, 18 Nov 2016 16:53:25 +0000 (10:53 -0600)] 
templates: require the protocol name to start with a capital

When running ./setup-app-layer.sh require the protocol name to
start with a capital letter so it looks somewhat like a proper
name. This will help give better function names.

For example:

   ./setup-app-layer.sh IRC
   ./setup-app-layer.sh Irc

will create function names starting with IRC or Irc. But we do
not want function names to start with "irc".

8 years agoconfigure: prevent combination of unittests and debug-validation
Andreas Herz [Thu, 19 Jan 2017 22:48:59 +0000 (23:48 +0100)] 
configure: prevent combination of unittests and debug-validation

8 years agodoc: add documentation for Lua SCFlowHasAlerts
Mats Klepsland [Fri, 13 Jan 2017 10:50:35 +0000 (11:50 +0100)] 
doc: add documentation for Lua SCFlowHasAlerts

8 years agooutput-json-flow: add has_alerts field
Mats Klepsland [Fri, 13 Jan 2017 10:46:59 +0000 (11:46 +0100)] 
output-json-flow: add has_alerts field

Add has_alerts field to flow eve-log to indicate if a flow has
any alerts or not.

8 years agolua: add SCFlowHasAlerts function
Mats Klepsland [Fri, 13 Jan 2017 10:08:55 +0000 (11:08 +0100)] 
lua: add SCFlowHasAlerts function

Add SCFlowHasAlerts() to check if a flow has alerts. Returns true
on alerts, false otherwise.

Example:

  has_alerts = SCFlowHasAlerts()
  if has_alerts then
    -- do something
  end

8 years agoflow: set flag to indicate that a flow has alerts
Mats Klepsland [Fri, 13 Jan 2017 10:03:55 +0000 (11:03 +0100)] 
flow: set flag to indicate that a flow has alerts

Set FLOW_HAS_ALERTS flag on the flow on alerts. Add FlowHasAlerts(..)
and FlowSetHasAlertsFlag(..) to check and set this flag.

8 years agoutil-file: introduce new functions for file size 2514/head
Eric Leblond [Thu, 19 Jan 2017 18:52:41 +0000 (10:52 -0800)] 
util-file: introduce new functions for file size

This patch introduces the FileDataSize and FileTrackedSize functions.
The first one is just a renaming of the initial FilSize function
whereas the other one is using the newly introduced size field as
value.

8 years agooutput-json-file: use size instead of FileSize
Eric Leblond [Wed, 18 Jan 2017 19:09:29 +0000 (11:09 -0800)] 
output-json-file: use size instead of FileSize

FileSize is not returning the actual value when file store is not
used.

8 years agoutil-file: change file size computation
Eric Leblond [Wed, 18 Jan 2017 19:08:21 +0000 (11:08 -0800)] 
util-file: change file size computation

The file size returned by FileSize is invalid if file store is not
used so we introduce a new size field in File structure that is used
to store the size.

8 years agoBug #2009: added CAP_NET_ADMIN for PCAP and af-packet modes.
Alexander Gozman [Thu, 19 Jan 2017 10:31:38 +0000 (13:31 +0300)] 
Bug #2009: added CAP_NET_ADMIN for PCAP and af-packet modes.

Without this capability suricata is unable to get network
interface's settings.

8 years agopcap-log: fix pcre_study error check
Jason Ish [Thu, 19 Jan 2017 05:23:11 +0000 (23:23 -0600)] 
pcap-log: fix pcre_study error check

Code was failing on a NULL return value which can be returned
when there was nothing todo instead of an error. Instead
check the errbuf for a non-NULL value to determine error.

8 years agodoc: napatech formatting fixes
Victor Julien [Tue, 17 Jan 2017 15:28:49 +0000 (16:28 +0100)] 
doc: napatech formatting fixes

8 years agodoc: add napatech to userguide
Victor Julien [Tue, 17 Jan 2017 15:07:37 +0000 (16:07 +0100)] 
doc: add napatech to userguide

8 years agodoc: initial Napatech documentation
Peter Sanders [Fri, 9 Dec 2016 20:18:47 +0000 (15:18 -0500)] 
doc: initial Napatech documentation

8 years agoapp-layer-detect-proto.c: fix indent
Jason Ish [Wed, 18 Jan 2017 15:32:23 +0000 (09:32 -0600)] 
app-layer-detect-proto.c: fix indent

A recent commit was outdented by 1 column.

8 years agoapp-layer - fix secondary probing parser logic
Jason Ish [Wed, 18 Jan 2017 15:30:48 +0000 (09:30 -0600)] 
app-layer - fix secondary probing parser logic

Apply the same logic to pe2 as pe1 for determining which
probe to call. Missed in previous commit.

8 years agohyperscan: fix minor coverity issue in error path
Victor Julien [Wed, 18 Jan 2017 14:13:40 +0000 (15:13 +0100)] 
hyperscan: fix minor coverity issue in error path

*** CID 1398951:  API usage errors  (LOCK)
/src/util-mpm-hs.c: 722 in SCHSPreparePatterns()
716         SCMutexUnlock(&g_db_table_mutex);
717
718         SCHSFreeCompileData(cd);
719         return 0;
720
721     error:
>>>     CID 1398951:  API usage errors  (LOCK)
>>>     "pthread_mutex_unlock" unlocks "g_db_table_mutex" while it is unlocked.
722         SCMutexUnlock(&g_db_table_mutex);
723         if (pd) {
724             PatternDatabaseFree(pd);
725         }
726         if (cd) {

8 years agosmb: add tcp/445 to proto detect fallback 2501/head
Victor Julien [Wed, 18 Jan 2017 10:37:25 +0000 (11:37 +0100)] 
smb: add tcp/445 to proto detect fallback

8 years agosmb: detect protocol in both directions
Victor Julien [Wed, 18 Jan 2017 10:36:33 +0000 (11:36 +0100)] 
smb: detect protocol in both directions

8 years agotx logging: only update logged tx id if all loggers logged 2499/head
Jason Ish [Mon, 9 Jan 2017 22:11:08 +0000 (16:11 -0600)] 
tx logging: only update logged tx id if all loggers logged

Prevents the case where the logged id is incremented if a newer
transaction is complete and an older one is still outstanding.

For example, dns request0, unsolicited dns response, dns response0

would result in the valid response0 never being logged.

Similarily this could happen for:
  request0, request1, response1, response0

which would end up having request0, request1 and response1 logged,
but response0 would not be logged.

8 years agoutil-file: fix error logic in hash computation
Eric Leblond [Tue, 17 Jan 2017 20:59:51 +0000 (12:59 -0800)] 
util-file: fix error logic in hash computation

This patch fixes an issue with hash computation resulting in the
invalidity of at least one hash when at least two different hashes
functions were used.

Impact was setting as `force-hash: [md5, sha256]` not to be valid.
Also it could lead to false negative if too different hash functions
had to be used on a single file due to signatures.

8 years agounix-socket: fix shadowed variable 2495/head
Jason Ish [Tue, 17 Jan 2017 21:48:33 +0000 (15:48 -0600)] 
unix-socket: fix shadowed variable

ret does not need to be redefined here, the existing
declaration of ret can be used.

8 years agotravis: export CFLAGS on linux
Jason Ish [Tue, 17 Jan 2017 21:39:15 +0000 (15:39 -0600)] 
travis: export CFLAGS on linux

8 years agotravis: add a build with -DNDEBUG
Jason Ish [Tue, 17 Jan 2017 21:31:25 +0000 (15:31 -0600)] 
travis: add a build with -DNDEBUG

8 years agoaddress parsing: fix memory leak in error path 2494/head
Victor Julien [Wed, 11 Jan 2017 14:36:15 +0000 (15:36 +0100)] 
address parsing: fix memory leak in error path

8 years agossl: suppress scan-build warnings
Victor Julien [Wed, 11 Jan 2017 14:32:45 +0000 (15:32 +0100)] 
ssl: suppress scan-build warnings

8 years agooutput: clean up output function
Victor Julien [Wed, 11 Jan 2017 14:20:25 +0000 (15:20 +0100)] 
output: clean up output function

Don't allocate memory per call.

8 years agosmb/dcerpc: suppress scan-build warnings
Victor Julien [Wed, 11 Jan 2017 13:55:34 +0000 (14:55 +0100)] 
smb/dcerpc: suppress scan-build warnings

8 years agoac-bs: fix scan-build warnings
Victor Julien [Wed, 11 Jan 2017 13:55:13 +0000 (14:55 +0100)] 
ac-bs: fix scan-build warnings

8 years agoqueue: add debug assertions to TAILQ
Victor Julien [Wed, 11 Jan 2017 13:34:41 +0000 (14:34 +0100)] 
queue: add debug assertions to TAILQ

To avoid scan-build fp's add assertions that are only active if
built with scan-build.