Commit Graph

8514 Commits (38e6901c34119f49903fa92130afe292aa948f13)
 

Author SHA1 Message Date
Victor Julien 38e6901c34 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 ago
Maurizio Abba 62ac13523a 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 ago
Pierre Chifflier 4b6555588f NTP: ensure parser name is not freed after registration 7 years ago
Danny Browning aae50f8a7e util-time: Add function to convert timespec to epoch millis 7 years ago
Victor Julien e41acd3d05 destate: test cleanups 7 years ago
Victor Julien 56b1df1b4d http: clean up & improve unittests 7 years ago
Eric Leblond ba0899a77f conf: add function to get child with default 7 years ago
Eric Leblond 4bfa3aeaf9 af-packet: synchronize flags sizes
They are passed from config to threads so they need to be of the
same size.
7 years ago
Maurizio Abba 7266c12b4f 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 ago
Pierre Chifflier ec62eedc87 Rust: remove deprecated functions LoggerFlags::get_logged/set_logged 7 years ago
Pierre Chifflier 5c6868b327 NTP: update logger to use new API 7 years ago
Victor Julien 044e7b8e20 output: add missing dnp3 profiling labels 7 years ago
Victor Julien d634140fa2 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 ago
Victor Julien bca0cd71ae 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 ago
Victor Julien 01724f04fa 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 ago
Victor Julien 40986b1f61 detect: put inspect code for MATCH-list into func
Introduce DetectRunInspectRulePacketMatches to inspect the signatures
match list.
7 years ago
Victor Julien 70597066e0 detect: move detect cleanup into util func 7 years ago
Victor Julien 01f9d0076c detect: move packet hdr inspect into util func 7 years ago
Eric Leblond 9ecd60c7a2 detect-ftpdata: register keyword
Keyword registration was missing so the keyword was not existing.
7 years ago
Maurizio Abba 204474de39 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 ago
Victor Julien e1e9ada9df rust/nfs: improve file close handling 7 years ago
Nick Price 350b5d99ce rust/nfs: don't panic on malformed NFS traffic
Instead set events.
7 years ago
Eric Leblond ce59ec5d13 af-packet: free ring buffer at exit 7 years ago
Victor Julien 485663583a rust/mingw: fix linker issues on mingw 7 years ago
Victor Julien 746638b220 cuda: remove
Remove CUDA support as it has been broken for a long time.

Ticket #2382.
7 years ago
Victor Julien 282dad79ca scan-build: fix memleak warning in port parsing 7 years ago
Victor Julien f342b11277 detect/tos: minor cleanups 7 years ago
Victor Julien 0c36ea64c2 detect/tos: fix memleak in error path 7 years ago
Victor Julien 2a4b5adce8 scan-build: simplify FatalErrorOnInit macro 7 years ago
Victor Julien 8aab6016cb scan-build: don't use memory wrappers 7 years ago
Victor Julien c563c1fcab scan-build: fix warning in radix tree 7 years ago
Victor Julien 50a5b2e458 scan-build: fix warning in streaming buffer 7 years ago
Victor Julien f2cacca9f8 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 ago
Pierre Chifflier f5b27ae767 Rust: fix probing function prototype: change sign and add Flow 7 years ago
Victor Julien 28ddf48899 mingw: improve ipaddress parsing 7 years ago
Victor Julien d62a212fa2 mingw: fix issues in pcap directory code
Fix issues with 'stat' and explicitly skip . and ..
7 years ago
Victor Julien 6c7d485bf8 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 ago
Victor Julien 1261d30df0 mingw/cygwin: explicitly disable unix socket 7 years ago
Victor Julien 6b75162194 mingw: use c:\Program Files\Suricata for w64 7 years ago
Victor Julien 650e6b316d ipv6: add string validation function 7 years ago
Victor Julien 13477d60ee ipv4: add string validation function 7 years ago
Victor Julien aa2eddfb98 decode/mime: improve ip address validation
inet_pton on Windows/MinGW is very liberal, so do manual validation
of IP address formatting.
7 years ago
Victor Julien d6a7f6b53f mingw: work around mingw more liberal ip parsing 7 years ago
Victor Julien 269cd03a43 console: no color for native windows build 7 years ago
Victor Julien 275eb839d1 mingw: disable pid checking from pidfile
kill() call is not supported in MinGW
7 years ago
Victor Julien 3fc73addae mingw: fix 'struct tm' compilation issue 7 years ago
Victor Julien 46cb00ec6c 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 ago
Victor Julien 11be9bd971 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 ago
Victor Julien 895df9a6f6 mingw: fix use of undefined USR2 signal 7 years ago
Victor Julien e113fa96e9 mingw: fix compilation of signals code 7 years ago