]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
7 years agothresholds: fix issues with host based thresholds 3168/head
Victor Julien [Tue, 16 Jan 2018 10:54:39 +0000 (11:54 +0100)] 
thresholds: fix issues with host based thresholds

The flow manager thread (that also runs the host cleanup code) would
sometimes free a host before it's thresholds are timed out. This would
lead to misdetection or too many alerts.

This was mostly (only?) visible on slower systems. And was caused by a
mismatch between time concepts of the async flow manager thread and the
packet threads, resulting in the flow manager using a timestamp that
was before the threshold entry creation ts. This would lead to an
integer underflow in the timeout check, leading to a incorrect conclusion
that the threshold entry was timed out.

To address this,  check if the 'check' timestamp is not before the creation
timestamp.

7 years agostream/midstream: be more liberal with window
Victor Julien [Wed, 17 Jan 2018 12:04:54 +0000 (13:04 +0100)] 
stream/midstream: be more liberal with window

Use the wscale setting when updating the window, even if it's very
high.

7 years agothreads: don't crash in slow shutdown 3157/head
Victor Julien [Mon, 15 Jan 2018 17:16:47 +0000 (18:16 +0100)] 
threads: don't crash in slow shutdown

If TmThreadDrainPacketThreads would take more than 60 seconds, the wait
loop that follows it would reach 'timeout' condition immediately. This
would lead to a null ptr deref of 'tv'.

Fix by not counting the TmThreadDrainPacketThreads and also not doing
the null ptr deref in any case.

7 years agotime: Force init cached_minute_start array
Maurizio Abba [Thu, 11 Jan 2018 14:34:37 +0000 (14:34 +0000)] 
time: Force init cached_minute_start array

In offline mode, if the starting timestamp is 0 suricata will never
initialize cached_minute_start array. This cause the timestamp to be
ignored when needed (e.g., in fast.log).

This commit will force the initialization of this array.

7 years agoNTP: ensure parser name is not freed after registration
Pierre Chifflier [Sat, 13 Jan 2018 15:09:26 +0000 (16:09 +0100)] 
NTP: ensure parser name is not freed after registration

7 years agoutil-time: Add function to convert timespec to epoch millis
Danny Browning [Sat, 13 Jan 2018 14:45:25 +0000 (07:45 -0700)] 
util-time: Add function to convert timespec to epoch millis

7 years agodestate: test cleanups
Victor Julien [Wed, 10 Jan 2018 15:24:08 +0000 (16:24 +0100)] 
destate: test cleanups

7 years agohttp: clean up & improve unittests
Victor Julien [Wed, 10 Jan 2018 11:59:52 +0000 (12:59 +0100)] 
http: clean up & improve unittests

7 years agoconf: add function to get child with default
Eric Leblond [Sat, 6 Jan 2018 09:01:55 +0000 (10:01 +0100)] 
conf: add function to get child with default

7 years agoaf-packet: synchronize flags sizes
Eric Leblond [Fri, 5 Jan 2018 21:32:34 +0000 (22:32 +0100)] 
af-packet: synchronize flags sizes

They are passed from config to threads so they need to be of the
same size.

7 years agoprint: Escape backslash in PrintRawUriFp
Maurizio Abba [Thu, 11 Jan 2018 15:21:06 +0000 (15:21 +0000)] 
print: Escape backslash in PrintRawUriFp

PrintRawUriFp does not properly escape backslash. This causes confusion
between a \ character and an hex-encoded character. PrintRawUriBuffer,
instead, correctly does backslash-encoding.
Adding proper escaping of backslash to PrintRawUriFp.

7 years agoRust: remove deprecated functions LoggerFlags::get_logged/set_logged 3140/head
Pierre Chifflier [Thu, 11 Jan 2018 17:54:28 +0000 (18:54 +0100)] 
Rust: remove deprecated functions LoggerFlags::get_logged/set_logged

7 years agoNTP: update logger to use new API
Pierre Chifflier [Thu, 11 Jan 2018 07:17:23 +0000 (08:17 +0100)] 
NTP: update logger to use new API

7 years agooutput: add missing dnp3 profiling labels 3135/head
Victor Julien [Mon, 8 Jan 2018 19:37:28 +0000 (20:37 +0100)] 
output: add missing dnp3 profiling labels

7 years agologging: unique id's per log direction
Victor Julien [Mon, 8 Jan 2018 18:46:06 +0000 (19:46 +0100)] 
logging: unique id's per log direction

For loggers that register once per direction, use unique id's per
direction.

Reshuffle id's to keep tx log id's low so we can use u32 for tracking
logged loggers.

7 years agoapp-layer: use logger bits to avoid looping
Victor Julien [Thu, 5 Oct 2017 22:20:44 +0000 (00:20 +0200)] 
app-layer: use logger bits to avoid looping

Avoid looping in transaction output.

Update app-layer API to store the bits in one step
and retrieve the bits in a single step as well.

Update users of the API.

7 years agoapp-layer: register per proto logger bits
Victor Julien [Thu, 5 Oct 2017 19:07:41 +0000 (21:07 +0200)] 
app-layer: register per proto logger bits

Create a bitmap of the loggers per protocol. This is done at runtime
based on the loggers that are enabled. Take the logger_id for each
logger and store it as a bitmap in the app-layer protcol storage.

Goal is to be able to use it as an expectation later.

7 years agodetect: put inspect code for MATCH-list into func 3133/head
Victor Julien [Sat, 7 Oct 2017 13:01:27 +0000 (15:01 +0200)] 
detect: put inspect code for MATCH-list into func

Introduce DetectRunInspectRulePacketMatches to inspect the signatures
match list.

7 years agodetect: move detect cleanup into util func
Victor Julien [Sat, 7 Oct 2017 10:17:39 +0000 (12:17 +0200)] 
detect: move detect cleanup into util func

7 years agodetect: move packet hdr inspect into util func
Victor Julien [Sat, 7 Oct 2017 10:15:03 +0000 (12:15 +0200)] 
detect: move packet hdr inspect into util func

7 years agodetect-ftpdata: register keyword
Eric Leblond [Fri, 5 Jan 2018 15:58:18 +0000 (16:58 +0100)] 
detect-ftpdata: register keyword

Keyword registration was missing so the keyword was not existing.

7 years agorunmodes: fix single runmode bug with pcap
Maurizio Abba [Fri, 5 Jan 2018 18:03:42 +0000 (18:03 +0000)] 
runmodes: fix single runmode bug with pcap

Fix crash for suricata running with pcap option and single runmode.

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

7 years agorust/nfs: improve file close handling
Victor Julien [Tue, 17 Oct 2017 08:19:00 +0000 (10:19 +0200)] 
rust/nfs: improve file close handling

7 years agorust/nfs: don't panic on malformed NFS traffic
Nick Price [Thu, 28 Dec 2017 16:11:17 +0000 (11:11 -0500)] 
rust/nfs: don't panic on malformed NFS traffic

Instead set events.

7 years agoaf-packet: free ring buffer at exit 3130/head
Eric Leblond [Mon, 1 Jan 2018 18:03:24 +0000 (19:03 +0100)] 
af-packet: free ring buffer at exit

7 years agorust/mingw: fix linker issues on mingw
Victor Julien [Thu, 21 Dec 2017 15:25:13 +0000 (16:25 +0100)] 
rust/mingw: fix linker issues on mingw

7 years agocuda: remove 3128/head
Victor Julien [Sat, 30 Dec 2017 13:55:26 +0000 (14:55 +0100)] 
cuda: remove

Remove CUDA support as it has been broken for a long time.

Ticket #2382.

7 years agoscan-build: fix memleak warning in port parsing 3117/head
Victor Julien [Thu, 21 Dec 2017 11:07:46 +0000 (12:07 +0100)] 
scan-build: fix memleak warning in port parsing

7 years agodetect/tos: minor cleanups
Victor Julien [Thu, 21 Dec 2017 11:02:33 +0000 (12:02 +0100)] 
detect/tos: minor cleanups

7 years agodetect/tos: fix memleak in error path
Victor Julien [Thu, 21 Dec 2017 11:00:28 +0000 (12:00 +0100)] 
detect/tos: fix memleak in error path

7 years agoscan-build: simplify FatalErrorOnInit macro
Victor Julien [Thu, 21 Dec 2017 10:10:52 +0000 (11:10 +0100)] 
scan-build: simplify FatalErrorOnInit macro

7 years agoscan-build: don't use memory wrappers
Victor Julien [Thu, 21 Dec 2017 10:01:12 +0000 (11:01 +0100)] 
scan-build: don't use memory wrappers

7 years agoscan-build: fix warning in radix tree
Victor Julien [Thu, 21 Dec 2017 10:00:28 +0000 (11:00 +0100)] 
scan-build: fix warning in radix tree

7 years agoscan-build: fix warning in streaming buffer
Victor Julien [Thu, 21 Dec 2017 09:59:03 +0000 (10:59 +0100)] 
scan-build: fix warning in streaming buffer

7 years agothreads: avoid NULL-ptr deref in thread init wait
Victor Julien [Thu, 21 Dec 2017 09:47:52 +0000 (10:47 +0100)] 
threads: avoid NULL-ptr deref in thread init wait

** CID 1426745:  Null pointer dereferences  (FORWARD_NULL)
/src/tm-threads.c: 2135 in TmThreadWaitOnThreadInit()

________________________________________________________________________________________________________
*** CID 1426745:  Null pointer dereferences  (FORWARD_NULL)
/src/tm-threads.c: 2135 in TmThreadWaitOnThreadInit()
2129         struct timeval cur_ts;
2130         gettimeofday(&start_ts, NULL);
2131
2132     again:
2133         gettimeofday(&cur_ts, NULL);
2134         if ((cur_ts.tv_sec - start_ts.tv_sec) > 120) {
>>>     CID 1426745:  Null pointer dereferences  (FORWARD_NULL)
>>>     Dereferencing null pointer "tv".
2135             SCLogError(SC_ERR_THREAD_INIT, "thread \"%s\" failed to "
2136                     "initialize in time: flags %04x", tv->name,
2137                     SC_ATOMIC_GET(tv->flags));
2138             return TM_ECODE_FAILED;
2139         }
2140

7 years agoRust: fix probing function prototype: change sign and add Flow
Pierre Chifflier [Wed, 29 Nov 2017 11:07:44 +0000 (12:07 +0100)] 
Rust: fix probing function prototype: change sign and add Flow

7 years agomingw: improve ipaddress parsing 3112/head
Victor Julien [Mon, 11 Dec 2017 17:18:28 +0000 (18:18 +0100)] 
mingw: improve ipaddress parsing

7 years agomingw: fix issues in pcap directory code
Victor Julien [Mon, 11 Dec 2017 12:32:47 +0000 (13:32 +0100)] 
mingw: fix issues in pcap directory code

Fix issues with 'stat' and explicitly skip . and ..

7 years agomingw: wrapper for usleep in threads
Victor Julien [Mon, 27 Nov 2017 13:31:45 +0000 (14:31 +0100)] 
mingw: wrapper for usleep in threads

usleep on MinGW doesn't behave as expected. Added replacement
wrapper around 'Sleep(msec)'. As that has msec resolution and
not a usec resolution, change the various thread init and stop
functions to test for the actual time waited instead of counting
the usecs passed to usleep.

7 years agomingw/cygwin: explicitly disable unix socket
Victor Julien [Mon, 27 Nov 2017 08:06:03 +0000 (09:06 +0100)] 
mingw/cygwin: explicitly disable unix socket

7 years agomingw: use c:\Program Files\Suricata for w64
Victor Julien [Mon, 27 Nov 2017 07:51:35 +0000 (08:51 +0100)] 
mingw: use c:\Program Files\Suricata for w64

7 years agoipv6: add string validation function
Victor Julien [Sun, 26 Nov 2017 10:17:57 +0000 (11:17 +0100)] 
ipv6: add string validation function

7 years agoipv4: add string validation function
Victor Julien [Sun, 26 Nov 2017 10:09:19 +0000 (11:09 +0100)] 
ipv4: add string validation function

7 years agodecode/mime: improve ip address validation
Victor Julien [Sun, 26 Nov 2017 08:58:03 +0000 (09:58 +0100)] 
decode/mime: improve ip address validation

inet_pton on Windows/MinGW is very liberal, so do manual validation
of IP address formatting.

7 years agomingw: work around mingw more liberal ip parsing
Victor Julien [Sat, 25 Nov 2017 13:23:35 +0000 (14:23 +0100)] 
mingw: work around mingw more liberal ip parsing

7 years agoconsole: no color for native windows build
Victor Julien [Sat, 25 Nov 2017 09:34:34 +0000 (10:34 +0100)] 
console: no color for native windows build

7 years agomingw: disable pid checking from pidfile
Victor Julien [Mon, 17 Jul 2017 14:20:22 +0000 (16:20 +0200)] 
mingw: disable pid checking from pidfile

kill() call is not supported in MinGW

7 years agomingw: fix 'struct tm' compilation issue
Victor Julien [Mon, 17 Jul 2017 14:19:32 +0000 (16:19 +0200)] 
mingw: fix 'struct tm' compilation issue

7 years agostrptime: add implementation from NetBSD
Victor Julien [Mon, 17 Jul 2017 13:26:43 +0000 (15:26 +0200)] 
strptime: add implementation from NetBSD

As MinGW doesn't come with strptime take the BSD licensed
implementation from NetBSD. More specifically, the one from

https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-libkml/strptime.c

It's slightly modified to get rid on 'uint'.

7 years agomingw: add SCNtohl and SCNtohs macro's
Victor Julien [Mon, 17 Jul 2017 11:45:44 +0000 (13:45 +0200)] 
mingw: add SCNtohl and SCNtohs macro's

On MinGW the result of ntohl needs to be casted to uint32_t and
the result of ntohs to uint16_t. To avoid doing this everywhere
add SCNtohl and SCNtohs macros.

7 years agomingw: fix use of undefined USR2 signal
Victor Julien [Mon, 17 Jul 2017 11:22:58 +0000 (13:22 +0200)] 
mingw: fix use of undefined USR2 signal

7 years agomingw: fix compilation of signals code
Victor Julien [Mon, 17 Jul 2017 09:02:47 +0000 (11:02 +0200)] 
mingw: fix compilation of signals code

7 years agomingw: work around mingw mkdir
Victor Julien [Sat, 15 Jul 2017 07:40:11 +0000 (09:40 +0200)] 
mingw: work around mingw mkdir

mingw doesn't come with a posix compliant mkdir as it only takes
a single argument.

7 years agoeve: remove json format option - was not used
Jason Ish [Mon, 11 Dec 2017 21:31:58 +0000 (15:31 -0600)] 
eve: remove json format option - was not used

7 years agoeve.flow: removed unused http parameters
Jason Ish [Tue, 19 Dec 2017 22:50:25 +0000 (16:50 -0600)] 
eve.flow: removed unused http parameters

7 years agoeve: fix context datatype used in init functions
Jason Ish [Tue, 19 Dec 2017 21:49:27 +0000 (15:49 -0600)] 
eve: fix context datatype used in init functions

Many were using AlertJsonThread instead of OutputJsonCtx,
but as the datatypes were similar enough no harm was done.

Now that they are using their proper datatype, removed
AlertJsonThread from output.h as its no longer used.

7 years agoeve.dnp3: removed unsed context field
Jason Ish [Tue, 19 Dec 2017 21:46:31 +0000 (15:46 -0600)] 
eve.dnp3: removed unsed context field

7 years agoeve.flow: remove "hi" log message
Jason Ish [Tue, 19 Dec 2017 21:44:17 +0000 (15:44 -0600)] 
eve.flow: remove "hi" log message

7 years agoeve.netflow: remove "hi" log message
Jason Ish [Tue, 19 Dec 2017 21:43:50 +0000 (15:43 -0600)] 
eve.netflow: remove "hi" log message

7 years agorust: add --enable-rust-debug
Victor Julien [Wed, 20 Dec 2017 13:14:34 +0000 (14:14 +0100)] 
rust: add --enable-rust-debug

Add option to put Rust code in non-'--release' mode, preserving
debug symbols.

Until now Suricata would have to be compiled with --enable-debug for
this.

7 years agohostbits: fix test setup 3108/head
Victor Julien [Sat, 14 Oct 2017 21:14:31 +0000 (23:14 +0200)] 
hostbits: fix test setup

7 years agofile_data: move tests into tests/
Victor Julien [Sat, 14 Oct 2017 08:09:57 +0000 (10:09 +0200)] 
file_data: move tests into tests/

7 years agofile_data: unify inspect engines
Victor Julien [Thu, 12 Oct 2017 16:19:23 +0000 (18:19 +0200)] 
file_data: unify inspect engines

Call HTTP from the generic file_data engine.

7 years agofile_data: smtp file_data to generic file_data
Victor Julien [Fri, 29 Sep 2017 21:09:15 +0000 (23:09 +0200)] 
file_data: smtp file_data to generic file_data

Generalize the SMTP file_data inspection into a 'files'
file_data inspection that can be used for any protocol
that uses the File API.

7 years agodetect: minor cleanup
Victor Julien [Sun, 8 Oct 2017 16:28:30 +0000 (18:28 +0200)] 
detect: minor cleanup

7 years agoapp-layer: use bool for 'HasDecoderEvents'
Victor Julien [Sun, 8 Oct 2017 16:23:22 +0000 (18:23 +0200)] 
app-layer: use bool for 'HasDecoderEvents'

7 years agodetect: no tcp flags in mask for pseudo packets
Victor Julien [Tue, 7 Nov 2017 10:28:01 +0000 (11:28 +0100)] 
detect: no tcp flags in mask for pseudo packets

7 years agodetect/mpm: micro optimization in setup
Victor Julien [Sun, 17 Dec 2017 19:08:12 +0000 (20:08 +0100)] 
detect/mpm: micro optimization in setup

7 years agodetect: remove old simd references
Victor Julien [Sun, 8 Oct 2017 12:28:19 +0000 (14:28 +0200)] 
detect: remove old simd references

7 years agodecode/vlan: don't consider ARP 'unknown'
Victor Julien [Wed, 20 Dec 2017 08:30:42 +0000 (09:30 +0100)] 
decode/vlan: don't consider ARP 'unknown'

7 years agopfring: minor code cleanups
Victor Julien [Wed, 20 Dec 2017 08:03:33 +0000 (09:03 +0100)] 
pfring: minor code cleanups

7 years agopfring: add warning for stripped vlan header case
Victor Julien [Wed, 20 Dec 2017 07:57:29 +0000 (08:57 +0100)] 
pfring: add warning for stripped vlan header case

According to PF_RING upstream the vlan header should never be stripped
from the packet PF_RING feeds to Suricata. But upstream also indicated
keeping the check would be a good "safety check".

So in addition to the check, add a warning that warns once (per thread
for implementation simplicity) if the vlan hdr does appear to be stripped
after all.

7 years agopfring: fix vlan handling issues
Victor Julien [Tue, 19 Dec 2017 19:17:39 +0000 (20:17 +0100)] 
pfring: fix vlan handling issues

When Suricata was monitoring traffic with a single vlan layer, the stats
and output instead showed 2. This was caused by the raw packets PF_RING
feeds Suricata would hold the vlan header, but the code assumed that
the header was stripped and the vlan_id passed to Suricata through
PF_RING's extended_hdr.parsed_pkt.

This patch adds the following logic: Check vlan id from the parser packet
PF_RING prepared. PF_RING sets the vlan_id based on its own parsing or
based on the hardware offload. It gives no indication on where the vlan_id
came from, so we rely on the vlan_offset field. If it's 0, we assume the
PF_RING parser did not see the vlan header and got it from the hardware
offload. In this case we will use this information directly, as we won't
get a raw vlan header later. If PF_RING did set the offset, we do the
parsing in the Suricata decoder so that we have full control.

PF_RING *should* put back the vlan header in all cases, and also set the
vlan_offset field, but as a extra precaution keep the check described
above.

Bug #2355.

7 years agoapp-layer-ftp: add memcap for ftp
Eric Leblond [Fri, 24 Nov 2017 15:59:34 +0000 (16:59 +0100)] 
app-layer-ftp: add memcap for ftp

Add a memory cap for the FTP protocol.

7 years agodoc: update file extraction document
Eric Leblond [Sun, 19 Nov 2017 19:27:17 +0000 (20:27 +0100)] 
doc: update file extraction document

Define the list of protocol parsers supporting extraction in one
single place following Andreas Herz' suggestion.

7 years agodoc: update following ftp-data changes
Eric Leblond [Sun, 19 Nov 2017 19:22:46 +0000 (20:22 +0100)] 
doc: update following ftp-data changes

7 years agodetect-ftpdata: match on ftp-data operation
Eric Leblond [Sun, 19 Nov 2017 19:21:08 +0000 (20:21 +0100)] 
detect-ftpdata: match on ftp-data operation

This keyword mathes on ftp operation STOR and RETR. It will allow
rules writer to select if the alert has to be on a put or a fetch
operation.

It is now possible to write a signature like:

  alert ftp-data any any -> any any (msg:"FTP data get firwmare"; ftdata_command:retr; sid:2; rev:1;)

to alert when a file is retrieved from a FTP server.

7 years agoapp-layer-ftp: add ftp-data support
Eric Leblond [Wed, 13 Sep 2017 14:48:29 +0000 (15:48 +0100)] 
app-layer-ftp: add ftp-data support

Use expectation to be able to identify connections that are
ftp data. It parses the PASV response, STOR message and the
RETR message to provide extraction of files.

Implementation in Rust of FTP messages parsing is available.

Also this patch changes some var name prefixed by ssh to ftp.

7 years agoapp-layer-expectation: expectation system
Eric Leblond [Tue, 12 Sep 2017 13:11:01 +0000 (14:11 +0100)] 
app-layer-expectation: expectation system

This patch provides a working expectation system. This will allow
suricata to have a way to identify parallel connections opened by
a protocol such as FTP.

Expectation are a chained list and there is a cleaning by timeout
of the entries.

This patch also defined a counter of expectations that is also
used to check if we need to query IPPairs. This way we only query
the IPPairs store if we have an expectation.

7 years agoapp-layer: add Flow to probing parser functions
Eric Leblond [Tue, 12 Sep 2017 15:43:41 +0000 (16:43 +0100)] 
app-layer: add Flow to probing parser functions

7 years agoflow: add parent_id field
Eric Leblond [Sat, 16 Sep 2017 12:28:22 +0000 (13:28 +0100)] 
flow: add parent_id field

This patch adds a parent_id field to the Flow structure that
contain the flow ID of the parent connection for protocol with
dynamic parallel connection opening like FTP.

7 years agodetect: increase signature mask length
Eric Leblond [Fri, 15 Sep 2017 13:33:33 +0000 (14:33 +0100)] 
detect: increase signature mask length

7 years agosuricata: storage early to get it everywhere
Eric Leblond [Tue, 12 Sep 2017 21:53:51 +0000 (22:53 +0100)] 
suricata: storage early to get it everywhere

7 years agodoc: add memcap commands in unix-socket section 3104/head
Giuseppe Longo [Fri, 1 Dec 2017 13:48:54 +0000 (14:48 +0100)] 
doc: add memcap commands in unix-socket section

7 years agosuricatasc: add commands for memcap handling
Giuseppe Longo [Mon, 20 Nov 2017 14:22:54 +0000 (15:22 +0100)] 
suricatasc: add commands for memcap handling

7 years agorunmode-unix-socket: add commands for memcap handling
Giuseppe Longo [Mon, 20 Nov 2017 14:19:45 +0000 (15:19 +0100)] 
runmode-unix-socket: add commands for memcap handling

This permits to handle memcap values through
unix socket for:
- stream
- stream-reassembly
- flow
- applayer-proto-http
- defrag
- ippair
- host

It will be possible to show or change a memcap value
for a specified configuration and list all memcap values
available.

The following commands are registered for unix-socket:
- memcap-set
- memcap-show
- memcap-list

Output:
>>> memcap-show flow
Success:
{
    "value": "64mb"
}

>>> memcap-set flow 64mb
Success:
"memcap value for 'flow' updated: 67108864"

Command with invalid memcap key:
>>> memcap-set udp 32mb
Error:
"Available config: stream stream-reassembly flow applayer-proto-http defrag ippair host"

Command with an invalid memcap value:
>>> memcap-set http 32mmb
Error:
"error parsing memcap specified, value not changed"

7 years agohost: get/set memcap value
Giuseppe Longo [Mon, 20 Nov 2017 14:13:00 +0000 (15:13 +0100)] 
host: get/set memcap value

This adds new functions that will be called
through unix-socket and permit to update
and show memcap value.

The memcap value needs to be handled in a
thread safe way, so for this reason it is
declared as atomic var.

Another function is added to gets
the memuse value since it will be shown
through unix-socket.

7 years agoippair: get/set memcap value
Giuseppe Longo [Mon, 20 Nov 2017 14:11:15 +0000 (15:11 +0100)] 
ippair: get/set memcap value

This adds new functions that will be called
through unix-socket and permit to update
and show memcap value.

The memcap value needs to be handled in a
thread safe way, so for this reason it is
declared as atomic var.

Another function is added to gets
the memuse value since it will be shown
through unix-socket.

7 years agodefrag: get/set memcap value
Giuseppe Longo [Mon, 20 Nov 2017 14:09:17 +0000 (15:09 +0100)] 
defrag: get/set memcap value

This adds new functions that will be called
through unix-socket and permit to update
and show memcap value.

The memcap value needs to be handled in a
thread safe way, so for this reason it is
declared as atomic var.

Another function is added to gets
the memuse value since it will be shown
through unix-socket.

7 years agohtp: destroy atomic vars
Giuseppe Longo [Mon, 11 Dec 2017 08:42:56 +0000 (09:42 +0100)] 
htp: destroy atomic vars

Atomic vars declared in app-layer-htp-mem.c were not
destroyed when suricata is shutdown.

7 years agohtp: get/set memcap value
Giuseppe Longo [Mon, 20 Nov 2017 14:06:54 +0000 (15:06 +0100)] 
htp: get/set memcap value

This adds new functions that will be called
through unix-socket and permit to update
and show memcap value.

The memcap value needs to be handled in a
thread safe way, so for this reason it is
declared as atomic var.

7 years agoflow: get/set memcap value
Giuseppe Longo [Mon, 20 Nov 2017 14:02:32 +0000 (15:02 +0100)] 
flow: get/set memcap value

This adds new functions that will be called
through unix-socket and permit to update
and show memcap value.

The memcap value needs to be handled in a
thread safe way, so for this reason it is
declared as atomic var.

FlowGetMemuse() function is made as public
because the memuse value will be shown
through unix-socket.

7 years agostream-tcp: get/set memcap value
Giuseppe Longo [Mon, 20 Nov 2017 13:39:22 +0000 (14:39 +0100)] 
stream-tcp: get/set memcap value

This adds new functions that will be called
through unix-socket and permit to update
and show memcap value.

The memcap value needs to be handled in a
thread safe way, so for this reason it is
declared as atomic var.

7 years agostream-tcp-reassemble: declare 'size' as uint64_t
Giuseppe Longo [Wed, 13 Dec 2017 11:26:35 +0000 (12:26 +0100)] 
stream-tcp-reassemble: declare 'size' as uint64_t

According to all checking memcap functions,
the size passed as argument is declared as uint64_t
except for StreamTcpReassembleCheckMemcap where it's
defined as uint32_t.

7 years agoHash table: free bucker in case of insertion error
Pierre Chifflier [Mon, 17 Mar 2014 17:59:35 +0000 (18:59 +0100)] 
Hash table: free bucker in case of insertion error

This fixes a warning raised by cppcheck.

7 years agoHash table: check hash array size when inserting element
Pierre Chifflier [Fri, 14 Mar 2014 17:59:11 +0000 (18:59 +0100)] 
Hash table: check hash array size when inserting element

If the hash function returns an index greater than the array size of the
hash table, the index is not checked. Even if this is the responsibility
of the caller, add a safety check to avoid errors.

7 years agodoc: document log reopen unix socket command
Eric Leblond [Tue, 12 Dec 2017 11:48:42 +0000 (12:48 +0100)] 
doc: document log reopen unix socket command

7 years agounix-socket: add logs reopen command
Eric Leblond [Mon, 27 Nov 2017 10:23:24 +0000 (11:23 +0100)] 
unix-socket: add logs reopen command

We did had a race condition with running logrotate with multiple
EVE Json files. Consequence was one of the file not being reopen
by suricata that did continue to write to the rotated one.

Trying fix on signal handler did fail so this patch implements
log rotation support by adding a dedicated command to unix socket
to reopen the log files.

7 years agodns-log: don't register if HAVE_RUST 3103/head
Jason Ish [Mon, 18 Dec 2017 12:58:18 +0000 (06:58 -0600)] 
dns-log: don't register if HAVE_RUST

Log just one notice message when attempting to register
this logger with HAVE_RUST, instead of logging on
every attempt to output a DNS record.

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

7 years agorust/dns - convert more type values to text
Jason Ish [Mon, 18 Dec 2017 12:46:17 +0000 (06:46 -0600)] 
rust/dns - convert more type values to text

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

Convert more record type and errr code values to text.
Remove duplicate type declarations.