]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
8 years agoautogen: cleanup rust strict warning 2854/head
Jason Ish [Mon, 24 Jul 2017 16:40:53 +0000 (10:40 -0600)] 
autogen: cleanup rust strict warning

8 years agoSample systemd unit file for Suricata.
Jason Ish [Thu, 20 Jul 2017 20:53:09 +0000 (14:53 -0600)] 
Sample systemd unit file for Suricata.

Create a sample systemd unit file based on the build time
configuration.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2138

8 years agoSample logrotate configuration file.
Jason Ish [Mon, 24 Jul 2017 15:14:17 +0000 (09:14 -0600)] 
Sample logrotate configuration file.

Create a sample logrotate configuration file with filenames
set for the configuration.

8 years agodetect: more gracefully handle mpm prepare failure 2850/head
Victor Julien [Wed, 19 Jul 2017 10:45:39 +0000 (12:45 +0200)] 
detect: more gracefully handle mpm prepare failure

Exit with error instead of using the detection engine in a broken state.

Bug #2187

8 years agodetect: reject dsize rules that can't match
Victor Julien [Wed, 19 Jul 2017 10:16:48 +0000 (12:16 +0200)] 
detect: reject dsize rules that can't match

Rules can contain conflicting statements and lead to a unmatchable rule.

2 examples are rejected by this patch:

1. dsize < content
2. dsize < content@offset

Bug #2187

8 years agoUpdate public-data-sets.rst with stratosphere project
Sebastian Garcia [Fri, 14 Jul 2017 14:30:48 +0000 (16:30 +0200)] 
Update public-data-sets.rst with stratosphere project

Add the datasets of the Stratosphere project to the list.

8 years agomingw: don't try to build unix socket
Victor Julien [Sat, 15 Jul 2017 08:00:57 +0000 (10:00 +0200)] 
mingw: don't try to build unix socket

8 years agowindows: use wpcap instead of pcap
Victor Julien [Sat, 15 Jul 2017 07:48:40 +0000 (09:48 +0200)] 
windows: use wpcap instead of pcap

Windows pcap libraries such as winpcap all use a library name of
wpcap instead of just pcap. Support this in configure.

8 years agowin32: minor compile warning fixes
Victor Julien [Mon, 17 Jul 2017 08:09:01 +0000 (10:09 +0200)] 
win32: minor compile warning fixes

8 years agomingw: fix random function
Victor Julien [Fri, 14 Jul 2017 19:12:50 +0000 (21:12 +0200)] 
mingw: fix random function

8 years agococci: add test to check for uint use
Victor Julien [Fri, 14 Jul 2017 19:06:37 +0000 (21:06 +0200)] 
cocci: add test to check for uint use

uint is non-standard and not supported by MinGW. So ban it's use.

spatch file by Eric Leblond.

8 years agocleanup: remove all uint use
Victor Julien [Fri, 14 Jul 2017 19:03:04 +0000 (21:03 +0200)] 
cleanup: remove all uint use

8 years agococci: ban memmem
Victor Julien [Fri, 14 Jul 2017 19:30:36 +0000 (21:30 +0200)] 
cocci: ban memmem

8 years agodnp3: use BasicSearch instead of memmem
Jason Ish [Fri, 14 Jul 2017 19:31:10 +0000 (13:31 -0600)] 
dnp3: use BasicSearch instead of memmem

Mingw doesn't support memmem.

8 years agorust: require jansson for rust build
Jason Ish [Fri, 14 Jul 2017 15:09:33 +0000 (09:09 -0600)] 
rust: require jansson for rust build

8 years agotravis: enable strict rust; use rust 1.15.0
Jason Ish [Fri, 14 Jul 2017 14:28:44 +0000 (08:28 -0600)] 
travis: enable strict rust; use rust 1.15.0

Adds --enable-rust-strict to fail on warnings. Also update
the minimum Rust version from 1.7.0 to 1.15.0.

8 years agorust: --enable-rust-strict to turn warnings into errors
Jason Ish [Fri, 14 Jul 2017 14:26:30 +0000 (08:26 -0600)] 
rust: --enable-rust-strict to turn warnings into errors

8 years agodoc: add pid-file section to suricata.yaml doc
Jason Ish [Mon, 17 Jul 2017 21:07:27 +0000 (15:07 -0600)] 
doc: add pid-file section to suricata.yaml doc

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2104

8 years agosuricata.yaml: better comment on pid-file option
Jason Ish [Mon, 17 Jul 2017 20:58:57 +0000 (14:58 -0600)] 
suricata.yaml: better comment on pid-file option

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2104

8 years agodoc: add more details to log rotation doc
Jason Ish [Mon, 17 Jul 2017 20:55:20 +0000 (14:55 -0600)] 
doc: add more details to log rotation doc

8 years agodoc: move log rotation to output section
Jason Ish [Mon, 17 Jul 2017 17:42:18 +0000 (11:42 -0600)] 
doc: move log rotation to output section

8 years agorust/dns/tcp - probe even if payload is short 2838/head
Jason Ish [Thu, 13 Jul 2017 16:28:48 +0000 (10:28 -0600)] 
rust/dns/tcp - probe even if payload is short

As the DNS probe just uses the query portion of a response, don't
require there to be as many bytes as specified in the TCP DNS
header. This can occur in large responses where probe is called
without all the data.

Fixes the cases where the app proto is recorded as failed.

Fixes issue:
https://redmine.openinfosecfoundation.org/issues/2169

8 years agogcc7: format-truncation fix for lua
Victor Julien [Fri, 14 Jul 2017 09:05:51 +0000 (11:05 +0200)] 
gcc7: format-truncation fix for lua

8 years agochangelog: update for 4.0.0-rc2 release suricata-4.0.0-rc2
Victor Julien [Wed, 12 Jul 2017 14:45:41 +0000 (16:45 +0200)] 
changelog: update for 4.0.0-rc2 release

8 years agoder/asn1: limit recursion
Victor Julien [Mon, 10 Jul 2017 08:15:54 +0000 (10:15 +0200)] 
der/asn1: limit recursion

Limit the number of recursive calls in the DER/ASN.1 decoder to avoid
stack overflows.

Found using AFL.

8 years agorust/nfs: implement events 2835/head
Victor Julien [Wed, 12 Jul 2017 08:56:56 +0000 (10:56 +0200)] 
rust/nfs: implement events

Remove lots of panic statements in favor of setting non-fatal events.

Bug #2175.

8 years agoradix: fix risky malloc call 2834/head
Victor Julien [Thu, 13 Jul 2017 08:04:47 +0000 (10:04 +0200)] 
radix: fix risky malloc call

GCC7 said:
  CC       util-radix-tree.o
In file included from util-debug-filters.h:29:0,
                 from util-debug.h:34,
                 from suricata-common.h:421,
                 from util-radix-tree.c:26:
util-radix-tree.c: In function ‘SCRadixAddKey’:
util-mem.h:177:12: error: argument 1 range [1844674407156206796818446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
     ptrmem = malloc((a)); \
     ~~~~~~~^~~~~~~~~~~~~
util-radix-tree.c:749:42: note: in expansion of macro ‘SCMalloc’
             if ( (inter_node->netmasks = SCMalloc((node->netmask_cnt - i) *
                                          ^~~~~~~~
In file included from suricata-common.h:69:0,
                 from util-radix-tree.c:26:
/usr/include/stdlib.h:443:14: note: in a call to allocation function ‘malloc’ declared here
 extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
              ^~~~~~

scan-build said:
util-radix-tree.c:749:42: warning: Call to 'malloc' has an allocation size of 0 bytes
            if ( (inter_node->netmasks = SCMalloc((node->netmask_cnt - i) *
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./util-mem.h:177:14: note: expanded from macro 'SCMalloc'
    ptrmem = malloc((a)); \
             ^~~~~~~~~~~
1 warning generated.

8 years agogcc7: fix format-truncation warnings in runmodes
Victor Julien [Thu, 13 Jul 2017 07:57:40 +0000 (09:57 +0200)] 
gcc7: fix format-truncation warnings in runmodes

Example:

util-runmodes.c: In function ‘RunModeSetIPSAutoFp’:
util-runmodes.c:496:40: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
         snprintf(qname, sizeof(qname), "pickup%d", thread+1);
                                        ^~~~~~~~~~
util-runmodes.c:496:9: note: ‘snprintf’ output between 8 and 17 bytes into a destination of size16
         snprintf(qname, sizeof(qname), "pickup%d", thread+1);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solved by reducing 'thread' to a uint16_t and limiting the max
thread count to 1024.

8 years agogcc7: fix format truncation warning
Victor Julien [Thu, 13 Jul 2017 07:06:39 +0000 (09:06 +0200)] 
gcc7: fix format truncation warning

detect-rpc.c: In function ‘DetectRpcParse’:
detect-rpc.c:225:50: error: ‘%s’ directive argument is null [-Werror=format-truncation=]
                 SCLogError(SC_ERR_INVALID_VALUE, "invalid rpc option %s",args[i]);
                                                  ^
util-debug.h:239:77: note: in definition of macro ‘SCLogErr’
             int _sc_log_ret = snprintf(_sc_log_msg, SC_LOG_MAX_LOG_MSG_LEN, __VA_ARGS__);   \
                                                                             ^~~~~~~~~~~
detect-rpc.c:225:17: note: in expansion of macro ‘SCLogError’
                 SCLogError(SC_ERR_INVALID_VALUE, "invalid rpc option %s",args[i]);
                 ^~~~~~~~~~

8 years agopcap-log: fix path construct check
Victor Julien [Thu, 13 Jul 2017 06:51:30 +0000 (08:51 +0200)] 
pcap-log: fix path construct check

8 years agogcc7: fixes for format string warnings 2833/head
Victor Julien [Wed, 12 Jul 2017 16:44:33 +0000 (18:44 +0200)] 
gcc7: fixes for format string warnings

GCC 7.1.1 on Fedora gave several warnings with -Wimplicit-fallthrough
and -Wformat-truncation

This patch addresses the warnings.

8 years agorust/nfs: improve proto detect 2831/head
Victor Julien [Mon, 10 Jul 2017 09:51:43 +0000 (11:51 +0200)] 
rust/nfs: improve proto detect

8 years agorust/nfs: remove debug rec_size check
Victor Julien [Mon, 10 Jul 2017 08:26:38 +0000 (10:26 +0200)] 
rust/nfs: remove debug rec_size check

Records larger than 40k are perfectly valid.

Bug #2162.

8 years agoproto detect: improve 'failed' handling
Victor Julien [Tue, 11 Jul 2017 09:06:51 +0000 (11:06 +0200)] 
proto detect: improve 'failed' handling

Don't try to call parser for 'failed'. Also don't set one direction
warning if TS is failed and our direction is unknown/complete so failed
as well.

8 years agossl: minor code reformatting
Victor Julien [Tue, 11 Jul 2017 09:06:21 +0000 (11:06 +0200)] 
ssl: minor code reformatting

8 years agoapp-layer: increment flow counter if one sided
Eric Leblond [Sun, 14 May 2017 18:40:51 +0000 (20:40 +0200)] 
app-layer: increment flow counter if one sided

In the case of protocol like SMTP, we detect application layer on
only one side.  Consequence was a missed increment in the flow
counter.

8 years agostream: don't reset state on syn/ack resend
Victor Julien [Mon, 10 Jul 2017 12:33:09 +0000 (14:33 +0200)] 
stream: don't reset state on syn/ack resend

Bug #1958.

The reset was originally created for issue #523, but that works
well without the reset as well.

8 years agodecode: add config option to disable teredo 2827/head
Victor Julien [Fri, 7 Jul 2017 14:32:50 +0000 (16:32 +0200)] 
decode: add config option to disable teredo

Ticket #744.

8 years agostats: print alert count at shutdown 2826/head
Victor Julien [Fri, 7 Jul 2017 11:34:21 +0000 (13:34 +0200)] 
stats: print alert count at shutdown

Bug #1855.

8 years agodetect: fix mix of pass and noalert
Victor Julien [Fri, 7 Jul 2017 10:18:28 +0000 (12:18 +0200)] 
detect: fix mix of pass and noalert

Noalert rules did not apply pass logic to the flow.

Bug #1888.

8 years agolua/alert: expose transaction if available
Victor Julien [Fri, 7 Jul 2017 09:14:04 +0000 (11:14 +0200)] 
lua/alert: expose transaction if available

Bug #1748.

8 years agopcre: fix \xHH issue for http_host
Victor Julien [Fri, 7 Jul 2017 08:57:47 +0000 (10:57 +0200)] 
pcre: fix \xHH issue for http_host

The http_host keyword checks if the regex contains uppercase characters.
This check was rejecting valid syntax in the following format:

    content:"|2E|suricata"; http_host; pcre:"/\x2Esuricata$/W";

This patch addresses this case.

Bug #1957.

8 years agoisdataat: fix mem leak
Victor Julien [Fri, 7 Jul 2017 08:50:01 +0000 (10:50 +0200)] 
isdataat: fix mem leak

8 years agodoc: small typo under '4.3.1.5' section
Abbed [Sat, 1 Jul 2017 22:40:00 +0000 (01:40 +0300)] 
doc: small typo under '4.3.1.5' section

8 years agoUpdate Changelog for 4.0.0-rc1 release suricata-4.0.0-rc1
Victor Julien [Wed, 28 Jun 2017 10:43:44 +0000 (12:43 +0200)] 
Update Changelog for 4.0.0-rc1 release

8 years agodoc: document http-body logging 2819/head
Eric Leblond [Wed, 28 Jun 2017 11:56:43 +0000 (13:56 +0200)] 
doc: document http-body logging

8 years agooutput-json-alert: fix error handling
Eric Leblond [Mon, 26 Jun 2017 16:19:39 +0000 (18:19 +0200)] 
output-json-alert: fix error handling

MemBuffer was not freed in case of allocation error.

8 years agooutput-json-alert: log http body
Eric Leblond [Mon, 26 Jun 2017 16:17:47 +0000 (18:17 +0200)] 
output-json-alert: log http body

Add support for HTTP body logging as printable or as base64.

8 years agooutput-json-http: add functions to log http body
Giuseppe Longo [Thu, 14 Apr 2016 12:26:58 +0000 (14:26 +0200)] 
output-json-http: add functions to log http body

This patch adds two functions that permits to log the http body
in printable or base64 format.

8 years agoAdd NULL-terminator to app-layer template (fix #1930) 2815/head
Pierre Chifflier [Sun, 23 Oct 2016 15:20:25 +0000 (17:20 +0200)] 
Add NULL-terminator to app-layer template (fix #1930)

8 years agolog: destroy file mutex 2814/head
Victor Julien [Wed, 28 Jun 2017 07:23:42 +0000 (09:23 +0200)] 
log: destroy file mutex

8 years agolog: wrap rotation and write in lock
Jason Ish [Mon, 26 Jun 2017 17:04:46 +0000 (11:04 -0600)] 
log: wrap rotation and write in lock

The application log is subject to rotation, so the check for
rotation, the actual rotation and write needs to be done under
lock to ensure the file pointer is in a consisten state
at the time of write().

Fixes issue:
https://redmine.openinfosecfoundation.org/issues/2155

8 years agorust/dns: handle multiple txt strings
Jason Ish [Tue, 27 Jun 2017 22:47:23 +0000 (16:47 -0600)] 
rust/dns: handle multiple txt strings

Fix handling of TXT records when there are multiple strings
in a single TXT record. For now, conform to the C implementation
where an answer record is created for each string in a single
txt record.

Also removes the data_len field from the answer entry. In Rust,
the length is available from actual data, which after decoding
may actually be different than the encoded data length, so just
use the length from the actual data.

8 years agorust: enable/disable yaml settings
Victor Julien [Tue, 27 Jun 2017 19:51:00 +0000 (21:51 +0200)] 
rust: enable/disable yaml settings

Based on compile time settings, enable/disable app-layers
and loggers.

8 years agoAdd NTP event rules (commented) to the default config
Pierre Chifflier [Tue, 20 Jun 2017 14:11:58 +0000 (16:11 +0200)] 
Add NTP event rules (commented) to the default config

8 years agoAdd event rules for NTP events
Pierre Chifflier [Tue, 20 Jun 2017 11:57:46 +0000 (13:57 +0200)] 
Add event rules for NTP events

8 years agoNTP: change parse function to return the number of parsed messages
Pierre Chifflier [Mon, 19 Jun 2017 11:40:42 +0000 (13:40 +0200)] 
NTP: change parse function to return the number of parsed messages

8 years agoAdd NTP parser (rust-experimental)
Pierre Chifflier [Mon, 19 Jun 2017 11:19:23 +0000 (13:19 +0200)] 
Add NTP parser (rust-experimental)

8 years agoRust gen-c-headers: keep 'const' attribute
Pierre Chifflier [Mon, 19 Jun 2017 11:20:07 +0000 (13:20 +0200)] 
Rust gen-c-headers: keep 'const' attribute

8 years agoAutotools: add switch to build experimental Rust parsers
Pierre Chifflier [Mon, 19 Jun 2017 11:17:20 +0000 (13:17 +0200)] 
Autotools: add switch to build experimental Rust parsers

8 years agopcap: fix linktype raw issues 2812/head
Victor Julien [Tue, 27 Jun 2017 13:07:40 +0000 (15:07 +0200)] 
pcap: fix linktype raw issues

On OpenBSD 6.0 and 6.1 the following pcap gets a datalink type of
101 instead of our defined DLT_RAW.

    File type:           Wireshark/tcpdump/... - pcap
    File encapsulation:  Raw IP
    File timestamp precision:  microseconds (6)
    Packet size limit:   file hdr: 262144 bytes
    Number of packets:   23
    File size:           11 kB
    Data size:           11 kB
    Capture duration:    7,424945 seconds
    First packet time:   2017-05-25 21:59:31,957953
    Last packet time:    2017-05-25 21:59:39,382898
    Data byte rate:      1536 bytes/s
    Data bit rate:       12 kbps
    Average packet size: 496,00 bytes
    Average packet rate: 3 packets/s
    SHA1:                120cff9878b93ac74b68fb9216027bef3b3c018f
    RIPEMD160:           35fa287bf30d8be8b8654abfe26e8d3883262e8e
    MD5:                 13fe4bc50fe09bdd38f07739bd1ff0f0
    Strict time order:   True
    Number of interfaces in file: 1
    Interface #0 info:
                         Encapsulation = Raw IP (7/101 - rawip)
                         Capture length = 262144
                         Time precision = microseconds (6)
                         Time ticks per second = 1000000
                         Number of stat entries = 0
                         Number of packets = 23

On Linux it is 12.

On the tcpdump/libpcap site the DLT_RAW is defined as 101:
http://www.tcpdump.org/linktypes.html

Strangely, on OpenBSD the DLT_RAW macro is defined as 14 as expected.
So for some reason, libpcap on OpenBSD uses 101 which seems to match
the tcpdump/libpcap documentation.

So this patch adds support for datalink 101 as RAW.

8 years agodetect: fix crash when stream inspect runs on UDP 2811/head
Victor Julien [Tue, 27 Jun 2017 07:59:48 +0000 (09:59 +0200)] 
detect: fix crash when stream inspect runs on UDP

Certain rules can apply to both TCP and UDP. For example 'alert dns'
rules are inspected against both TCP and UDP. This lead to the
stream inspect engine being called on a UDP packet.

This patch fixes the issue by exiting early from the stream inspect
engine if a) proto is not TCP or b) ssn is not available

Bug #2158.

8 years agoeve/alert: redo option parsing 2805/head
Victor Julien [Mon, 26 Jun 2017 11:53:22 +0000 (13:53 +0200)] 
eve/alert: redo option parsing

Clean up option parsing. Allow options to be disabled as well as
enabled.

E.g.
    metadata: true
    flow: false

The metadata setting will enable all. Then flow is disabled.

8 years agodoc: info about new config for alert events in EVE
Eric Leblond [Thu, 22 Jun 2017 07:20:05 +0000 (09:20 +0200)] 
doc: info about new config for alert events in EVE

8 years agooutput-json-alert: rename applayer to metadata
Eric Leblond [Mon, 26 Jun 2017 08:41:11 +0000 (10:41 +0200)] 
output-json-alert: rename applayer to metadata

8 years agodoc: add app_proto to alert event
Eric Leblond [Thu, 22 Jun 2017 07:15:00 +0000 (09:15 +0200)] 
doc: add app_proto to alert event

8 years agooutput-json-alert: add app_proto or flow to events
Eric Leblond [Wed, 21 Jun 2017 17:50:11 +0000 (19:50 +0200)] 
output-json-alert: add app_proto or flow to events

This patch adds a partial flow entry in the alert event
(if applayer or flow is selected) or simply app_proto if
it is not.

app_proto is useful as filter and aggregation field. And
the partial flow entry contains more information about the
proto as well as some volumetry info.

8 years agorust: make distcheck fixes 2804/head
Jason Ish [Wed, 21 Jun 2017 18:44:37 +0000 (12:44 -0600)] 
rust: make distcheck fixes

8 years agorust: for sclog*, strip nul bytes before logging
Jason Ish [Wed, 21 Jun 2017 15:06:22 +0000 (09:06 -0600)] 
rust: for sclog*, strip nul bytes before logging

8 years agorust: safe string handling in logging
Jason Ish [Tue, 20 Jun 2017 18:47:34 +0000 (12:47 -0600)] 
rust: safe string handling in logging

In logging (SCLog*), safely convert strings to cstrings instead
of blindly unwrapping them.

Also implement a simple rust logger if the Suricata C context
is not available.

8 years agorust/dns: cargo unit test prototype
Jason Ish [Tue, 20 Jun 2017 16:30:35 +0000 (10:30 -0600)] 
rust/dns: cargo unit test prototype

Do remove compiler warning when building without unit tests.

8 years agorust: save cargo and CARGO_HOME to variables
Jason Ish [Tue, 20 Jun 2017 16:17:54 +0000 (10:17 -0600)] 
rust: save cargo and CARGO_HOME to variables

During configure, substitute the path of cargo, as well as the
value of CARGO_HOME as variables. This fixes the case where a
user might do:
  make
  sudo make install
Which will cause the cargo bits to be rebuilt, including
re-downloading external crates.

By saving these to variables we can be sure that the same
values are used during make install as were used during
make which prevents the Rust artifacts from being rebuild
during "sudo make install".

8 years agooutput-json-alert: fallback to payload if stream is void
Eric Leblond [Thu, 22 Jun 2017 15:48:00 +0000 (17:48 +0200)] 
output-json-alert: fallback to payload if stream is void

If stream logging results in no data then we fallback to payload
data to get somethingi that could be interesting  instead of
nothing.

8 years agosuricata.yaml: add some port variables
Eric Leblond [Tue, 20 Jun 2017 17:00:22 +0000 (19:00 +0200)] 
suricata.yaml: add some port variables

These variables are used by Talos ruleset and defining them allow
to get almost all rules of ruleset loaded.

8 years agodetect-asn1: fix memory leak
Eric Leblond [Mon, 19 Jun 2017 20:54:17 +0000 (22:54 +0200)] 
detect-asn1: fix memory leak

8 years agoutil-print: add 0 at end of buffer
Eric Leblond [Mon, 19 Jun 2017 18:16:01 +0000 (20:16 +0200)] 
util-print: add 0 at end of buffer

Add a 0 at the end of the printed buffer to be sure we terminate
with a 0 to avoid problem when calling strlen().

8 years agotunnel: refactor tunnel verdict handling
Victor Julien [Tue, 20 Jun 2017 10:13:14 +0000 (12:13 +0200)] 
tunnel: refactor tunnel verdict handling

Observed:

STARTTLS creates 2 pseudo packets which are tied to a real packet.
TPR (tunnel packet ref) counter increased to 2.

Pseudo 1: goes through 'verdict', increments 'ready to verdict' to 1.
Packet pool return code frees this packet and decrements TPR in root
to 1. RTV counter not changed. So both are now 1.

Pseudo 2: verdict code sees RTV == TPR, so verdict is set based on
pseudo packet. This is too soon. Packet pool return code frees this
packet and decrements TPR in root to 0.

Real packet: TRP is 0 so set verdict on this packet. As verdict was
already set, NFQ reports an issue.

The decrementing of TPR doesn't seem to make sense as RTV is not
updated.

Solution:

This patch refactors the ref count and verdict count logic. The beef
is now handled in the generic function TmqhOutputPacketpool(). NFQ
and IPFW call a utility function VerdictTunnelPacket to see if they
need to verdict a packet.

Remove some unused macro's for managing these counters.

8 years agonfs: log number of chunks that xfer'd a file 2793/head
Victor Julien [Mon, 19 Jun 2017 07:52:16 +0000 (09:52 +0200)] 
nfs: log number of chunks that xfer'd a file

8 years agonfs: add nfs to alerts
Victor Julien [Sat, 17 Jun 2017 08:39:24 +0000 (10:39 +0200)] 
nfs: add nfs to alerts

Also add a single 'applayer' option for alert augmentation that
applies to all app-layers.

8 years agonfs: add to fileinfo events
Victor Julien [Fri, 16 Jun 2017 18:35:33 +0000 (20:35 +0200)] 
nfs: add to fileinfo events

8 years agorust/nfs: add (file)handle to log as crc32
Victor Julien [Fri, 16 Jun 2017 14:09:18 +0000 (16:09 +0200)] 
rust/nfs: add (file)handle to log as crc32

8 years agotravis: set dist to trusty (Ubuntu 14.04). 2790/head
Jason Ish [Fri, 16 Jun 2017 14:54:38 +0000 (08:54 -0600)] 
travis: set dist to trusty (Ubuntu 14.04).

The default is still 12.04 which is EOL.

8 years agorust/dns: pass byte arrays directly to rust/json
Jason Ish [Fri, 16 Jun 2017 05:40:50 +0000 (23:40 -0600)] 
rust/dns: pass byte arrays directly to rust/json

Using the json.set_string_from_bytes which will
safely convert the bytes printable ascii string
before logging.

8 years agorust/lua: use lua_pushlstring for strings
Jason Ish [Fri, 16 Jun 2017 05:39:26 +0000 (23:39 -0600)] 
rust/lua: use lua_pushlstring for strings

Lua strings can contain NULLs, and Rust strings are UTF8 which
can also contain NULLs. Use pushlstring so a NULL containing
string can be pushed.

8 years agorust/json: only output printable characters
Jason Ish [Fri, 16 Jun 2017 05:38:04 +0000 (23:38 -0600)] 
rust/json: only output printable characters

Rust strings are UTF8 and we cannot yet rely on jansson
having json_stringn on all supported OS distributions yet
so sanitize strings to ascii before printing.

Also add set_string_from_bytes which is like set_string, but
accepts a byte array as input.

8 years agorust/nfs: fix style warning 2787/head
Victor Julien [Fri, 16 Jun 2017 10:02:14 +0000 (12:02 +0200)] 
rust/nfs: fix style warning

8 years agonfs: nfs_version keyword
Victor Julien [Fri, 16 Jun 2017 08:25:18 +0000 (10:25 +0200)] 
nfs: nfs_version keyword

Store nfs version in tx and add keyword to match on it.

8 years agoeve/nfs: log nfs version
Victor Julien [Fri, 16 Jun 2017 06:09:48 +0000 (08:09 +0200)] 
eve/nfs: log nfs version

8 years agonfs: rename nfs3 to nfs
Victor Julien [Thu, 15 Jun 2017 13:00:12 +0000 (15:00 +0200)] 
nfs: rename nfs3 to nfs

Since the parser now also does nfs2, the name nfs3 became confusing.
As it's still in beta, we can rename so this patch renames all 'nfs3'
logic to simply 'nfs'.

8 years agonfs3: create file tx for read on request
Victor Julien [Wed, 14 Jun 2017 14:34:00 +0000 (16:34 +0200)] 
nfs3: create file tx for read on request

This is done so that we can add creds to it.

8 years agonfs3: add readdirplus path
Victor Julien [Wed, 14 Jun 2017 12:17:58 +0000 (14:17 +0200)] 
nfs3: add readdirplus path

8 years agonfs: log more rpc
Victor Julien [Wed, 14 Jun 2017 10:41:49 +0000 (12:41 +0200)] 
nfs: log more rpc

8 years agonfs: split record parsers into different files
Victor Julien [Wed, 14 Jun 2017 08:22:08 +0000 (10:22 +0200)] 
nfs: split record parsers into different files

8 years agonfs3: fill bytes corner case
Victor Julien [Tue, 13 Jun 2017 06:39:16 +0000 (08:39 +0200)] 
nfs3: fill bytes corner case

8 years agonfs: fix rust data type declaration
Victor Julien [Mon, 12 Jun 2017 21:15:42 +0000 (23:15 +0200)] 
nfs: fix rust data type declaration

8 years agonfs2: basic record parsing and tracking
Victor Julien [Mon, 12 Jun 2017 07:41:31 +0000 (09:41 +0200)] 
nfs2: basic record parsing and tracking

8 years agonfs3: support NFS over UDP
Victor Julien [Sat, 10 Jun 2017 21:19:29 +0000 (23:19 +0200)] 
nfs3: support NFS over UDP

8 years agonfs3: probing parsers in both directions
Victor Julien [Sat, 10 Jun 2017 20:31:40 +0000 (22:31 +0200)] 
nfs3: probing parsers in both directions

8 years agonfs3: search for next record if needed after GAP
Victor Julien [Sat, 10 Jun 2017 12:58:06 +0000 (14:58 +0200)] 
nfs3: search for next record if needed after GAP

8 years agorust/nfs: handle GAPs
Victor Julien [Thu, 8 Jun 2017 13:13:49 +0000 (15:13 +0200)] 
rust/nfs: handle GAPs

In normal records it will try to continue parsing.

GAP 'data' will be passed to file api as '0's. New call is used
so that the file API does know it is dealing with a GAP. Such
files are flagged as truncated at the end of the file and no
checksums are calculated.