]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
3 years agoutil/action: convert unittests to FAIL/PASS API 7436/head
Juliana Fajardini [Thu, 26 May 2022 22:07:55 +0000 (19:07 -0300)] 
util/action: convert unittests to FAIL/PASS API

Task #5371

3 years agoutil/action: unittests clean-up (to sv tests)
Juliana Fajardini [Thu, 26 May 2022 21:53:03 +0000 (18:53 -0300)] 
util/action: unittests clean-up (to sv tests)

Removing all unittests that work better as suricata-verify tests.

Task #5371

3 years agounittest: minor helper cleanup
Victor Julien [Wed, 18 May 2022 12:36:24 +0000 (14:36 +0200)] 
unittest: minor helper cleanup

3 years agodetect/parse: cleanup test
Victor Julien [Wed, 25 May 2022 13:01:15 +0000 (15:01 +0200)] 
detect/parse: cleanup test

3 years agodetect: parsing test cleanups/improvements
Victor Julien [Wed, 18 May 2022 12:46:28 +0000 (14:46 +0200)] 
detect: parsing test cleanups/improvements

3 years agohost-os-info: add test to show mixed ipv4/ipv6
Victor Julien [Wed, 18 Dec 2019 19:21:01 +0000 (20:21 +0100)] 
host-os-info: add test to show mixed ipv4/ipv6

3 years agorule/vars: clean up tests
Victor Julien [Wed, 18 May 2022 18:47:33 +0000 (20:47 +0200)] 
rule/vars: clean up tests

3 years agodetect/iponly: minor code cleanup
Victor Julien [Tue, 24 May 2022 10:55:39 +0000 (12:55 +0200)] 
detect/iponly: minor code cleanup

3 years agodetect/iponly: include postmatch in determination
Victor Julien [Mon, 23 May 2022 11:59:31 +0000 (13:59 +0200)] 
detect/iponly: include postmatch in determination

3 years agodetect/iponly: simplify handling of 'any' parsing
Victor Julien [Tue, 10 May 2022 12:22:36 +0000 (14:22 +0200)] 
detect/iponly: simplify handling of 'any' parsing

3 years agodetect: address parsing variable rename to match code style
Victor Julien [Tue, 10 May 2022 11:26:07 +0000 (13:26 +0200)] 
detect: address parsing variable rename to match code style

3 years agodetect/iponly: remove unused code
Victor Julien [Fri, 13 May 2022 08:01:51 +0000 (10:01 +0200)] 
detect/iponly: remove unused code

3 years agorust: fix doc comments that trigger rust warnings
Juliana Fajardini [Thu, 26 May 2022 23:28:41 +0000 (20:28 -0300)] 
rust: fix doc comments that trigger rust warnings

Rust generates warnings that are treated as errors for documentation
blocks before `extern` blocks.

3 years agogithub-actions: bump ossf/scorecard-action from 1.0.4 to 1.1.0
dependabot[bot] [Wed, 25 May 2022 19:45:53 +0000 (19:45 +0000)] 
github-actions: bump ossf/scorecard-action from 1.0.4 to 1.1.0

Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 1.0.4 to 1.1.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/c1aec4ac820532bab364f02a81873c555a0ba3a1...5c8bc69dc88b65c66584e07611df79d3579b0377)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agostream: add packet header outside of lock 7430/head
Victor Julien [Thu, 26 May 2022 11:30:56 +0000 (13:30 +0200)] 
stream: add packet header outside of lock

3 years agolog/pcap: open handles outside of lock
Victor Julien [Thu, 26 May 2022 11:29:59 +0000 (13:29 +0200)] 
log/pcap: open handles outside of lock

3 years agolog/pcap: add buffer timeout
Scott Jordan [Thu, 3 Feb 2022 20:18:11 +0000 (15:18 -0500)] 
log/pcap: add buffer timeout

Set timeout for pcap log so that packets do not sit
in buffer. Set default to one second.

3 years agostream: memcap tracking for TcpSegment alloc
Scott Jordan [Mon, 1 Nov 2021 21:43:43 +0000 (16:43 -0500)] 
stream: memcap tracking for TcpSegment alloc

3 years agolog/pcap: handle case of multiple link types
Eric Leblond [Fri, 12 Mar 2021 09:56:51 +0000 (10:56 +0100)] 
log/pcap: handle case of multiple link types

3 years agoflow: set datalink for pseudo packet
Eric Leblond [Thu, 11 Mar 2021 22:58:37 +0000 (23:58 +0100)] 
flow: set datalink for pseudo packet

Set pseudo packet datalink to the global one. This fixes the case
where the pcap handle is open with information coming from a
pseudo packet. Without this, we did end up in most cases with
an Ethernet packet being written in a Raw pcap.

3 years agosuricata: introduce global linktype
Eric Leblond [Thu, 11 Mar 2021 22:55:53 +0000 (23:55 +0100)] 
suricata: introduce global linktype

As Suricata is not supporting pcap-ng we have to stick with one single
datalink type for the capture if ever we want to do pcap logging.
Assuming this, this patch introduces a function to set the link
type globally. This will be used with pcap conditional logging
to get the logging of TCP segments with the correct link type.

3 years agolog/pcap: log segments for pseudo packets
Eric Leblond [Wed, 10 Mar 2021 15:40:12 +0000 (16:40 +0100)] 
log/pcap: log segments for pseudo packets

3 years agolog/pcap: fix conditional pcap in tag mode
Eric Leblond [Thu, 25 Feb 2021 21:50:01 +0000 (22:50 +0100)] 
log/pcap: fix conditional pcap in tag mode

We were missing the first packet when using condition pcap logging
in tag mode as it was not tagged. As a result we were not getting
the stream data triggering the alert in the pcap file.

3 years agodetect/tag: add a tag for first packet
Eric Leblond [Thu, 25 Feb 2021 21:48:16 +0000 (22:48 +0100)] 
detect/tag: add a tag for first packet

We may need to know that a packet has been tagged but is the
first one (and thus is not tagged).

3 years agolog/pcap: dump segments of both sides of tcp session.
Scott Jordan [Wed, 17 Feb 2021 22:36:42 +0000 (16:36 -0600)] 
log/pcap: dump segments of both sides of tcp session.

This patch updates tcp segment dumping to dump segments
from both sides of the session in order when capturing
alerts and tags.

3 years agodoc: add info about capture_file key
Eric Leblond [Sun, 14 Feb 2021 18:14:30 +0000 (19:14 +0100)] 
doc: add info about capture_file key

3 years agolog/pcap and eve/alert: get pcap filename to support multi mode
Eric Leblond [Sat, 13 Feb 2021 20:56:51 +0000 (21:56 +0100)] 
log/pcap and eve/alert: get pcap filename to support multi mode

This patch adds a function to get the current pcap file name that
will be used to current packet. This patch also  updates EVE
alerts to add pcap output filename when pcap capture is done in
multi or normal mode.

3 years agolog/pcap: fix typo in error message
Eric Leblond [Sat, 13 Feb 2021 20:34:34 +0000 (21:34 +0100)] 
log/pcap: fix typo in error message

3 years agostream: count realloc in memcap
Eric Leblond [Mon, 8 Feb 2021 20:46:26 +0000 (21:46 +0100)] 
stream: count realloc in memcap

TCP memory cap was not taking into account the memory that can
be used by realloc of Packet headers in TCP segments.

3 years agolog/pcap: update copyright date
Eric Leblond [Sun, 7 Feb 2021 18:31:44 +0000 (19:31 +0100)] 
log/pcap: update copyright date

3 years agodoc: add conditional pcap logging info
Eric Leblond [Sat, 6 Feb 2021 22:17:30 +0000 (23:17 +0100)] 
doc: add conditional pcap logging info

3 years agolog/pcap: introduce tag as logging condition
Eric Leblond [Sat, 6 Feb 2021 20:19:04 +0000 (21:19 +0100)] 
log/pcap: introduce tag as logging condition

This patch adds the tag as logging condition. If this option is
used all tagged packets are written to the pcap.

3 years agolog/pcap: fix some indentation and white spaces
Eric Leblond [Sat, 6 Feb 2021 21:35:38 +0000 (22:35 +0100)] 
log/pcap: fix some indentation and white spaces

3 years agolog/pcap: add support for tunnel logging
Eric Leblond [Sat, 6 Feb 2021 08:52:53 +0000 (09:52 +0100)] 
log/pcap: add support for tunnel logging

In alert mode, we need to write the root packet to the pcap
file instead of the packet that did trigger the alert.

3 years agolog/pcap: add existing stream logging
Eric Leblond [Sat, 6 Feb 2021 21:18:25 +0000 (22:18 +0100)] 
log/pcap: add existing stream logging

This patch update the alert mode of pcap logging.

It uses the packet header data added to the TCP segments
to build packets corresponding to the acked data that did trigger
the alert. It then write it to the pcap file before starting to
dump all packet for the flow that did alert.

3 years agostream: conditionally add packet header to segment
Eric Leblond [Sat, 30 Jan 2021 20:57:32 +0000 (21:57 +0100)] 
stream: conditionally add packet header to segment

This patch optionally adds packet header to the TCP segment
and update the for each segment function by changing the
callback.

This patch is based on the work by Scott Jordan <scottfgjordan@gmail.com>

3 years agodetect: add flag when packet is first with alert
Eric Leblond [Sun, 8 Nov 2020 17:10:49 +0000 (18:10 +0100)] 
detect: add flag when packet is first with alert

We add a flag to packet to be able to know if this packet was the
first one to get alerts on the flow.

3 years agolog/pcap: add PcapWrite function
Eric Leblond [Sun, 8 Nov 2020 16:50:58 +0000 (17:50 +0100)] 
log/pcap: add PcapWrite function

It will be used later when multiple writing operations will be
necessary.

3 years agolog/pcap: conditional logging
Eric Leblond [Sun, 1 Nov 2020 08:54:47 +0000 (09:54 +0100)] 
log/pcap: conditional logging

Add an option to only write to pcap packets with alerts and flow
that have alerted.

3 years agogithub-ci: remove fedora 34 build 7427/head
Jason Ish [Tue, 24 May 2022 18:17:44 +0000 (12:17 -0600)] 
github-ci: remove fedora 34 build

Fedora 34 goes EOL in early June. The checks in this build are already
covered by the 35 and 36 builds.

3 years agogithub-ci: bump fedora versions 7423/head
Jason Ish [Mon, 23 May 2022 15:26:44 +0000 (09:26 -0600)] 
github-ci: bump fedora versions

35 -> 36
34 -> 35
33 -> 34

3 years agorules: use primary default-rule-path if set on command line
Jason Ish [Wed, 4 May 2022 19:18:09 +0000 (13:18 -0600)] 
rules: use primary default-rule-path if set on command line

When reloading rules, respect `--set default-rule-path=...` from the
command line if set.

Previously the rule reload would always take the default-rule-path from
the configuration file, even if overrided on the command line.

Issue: #1911

3 years agodetect/alert: directly increment alerts.discarded
Juliana Fajardini [Mon, 9 May 2022 14:24:18 +0000 (11:24 -0300)] 
detect/alert: directly increment alerts.discarded

In the unlikely case of AlertQueueExpand failure, we were incrementing
the discarded alerts stats in AlertQueueAppend via the Packet member in the
DetectEngineThreadCtx, which may not be initialized yet.

Bug #5353

3 years agodcerpc: use vecdeque tx iterator
Philippe Antoine [Fri, 13 May 2022 07:43:11 +0000 (09:43 +0200)] 
dcerpc: use vecdeque tx iterator

Ticket: #5321

3 years agogithub-actions: bump github/codeql-action from 2.1.9 to 2.1.11
dependabot[bot] [Tue, 17 May 2022 19:43:53 +0000 (19:43 +0000)] 
github-actions: bump github/codeql-action from 2.1.9 to 2.1.11

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.9 to 2.1.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/7502d6e991ca767d2db617bfd823a1ed925a0d59...a3a6c128d771b6b9bdebb1c9d0583ebd2728a108)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agogithub-actions: bump actions/upload-artifact from 3.0.0 to 3.1.0
dependabot[bot] [Fri, 20 May 2022 19:32:03 +0000 (19:32 +0000)] 
github-actions: bump actions/upload-artifact from 3.0.0 to 3.1.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/6673cd052c4cd6fcf4b4e6e60ea986c889389535...3cea5372237819ed00197afe530f5a7ea3e805c8)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoprotodetect: use both directions over UDP
Philippe Antoine [Wed, 17 Jul 2019 13:21:13 +0000 (15:21 +0200)] 
protodetect: use both directions over UDP

As is already done for TCP

Ticket: #2757

3 years agoprotodetect: be more tolerant
Philippe Antoine [Wed, 17 Jul 2019 13:19:30 +0000 (15:19 +0200)] 
protodetect: be more tolerant

Do not mask protocols on both directions with only first packet

For instance :
When the first packet is no valid DNS but on port 53 (a junk request)
second packet (error response from server) does not get checked for DNS
as first packet bit masked away DNS for both directions

Ticket: #2757

3 years agostacktrace-on-signal: Use kill(getpid(), sig_num) 7389/head 7395/head
Arne Welzel [Wed, 4 May 2022 18:06:36 +0000 (20:06 +0200)] 
stacktrace-on-signal: Use kill(getpid(), sig_num)

kill(0, ...) re-raises the signal to every processes in the process
group which may impact unrelated processes.

Concretely, in our CI pipeline, a segfaulting Suricata process killed
the test driver.

3 years agosuricata.yaml: include version that generated this file
Jason Ish [Wed, 4 May 2022 21:19:48 +0000 (15:19 -0600)] 
suricata.yaml: include version that generated this file

Add a line to the configuration that says which version generated the
configuration file.  For example:

    # This configuration generated by:
    #     Suricata 7.0.0-dev

Issue: #4784

3 years agostream/segtree: improve docs, error handling
Victor Julien [Tue, 22 Mar 2022 15:59:17 +0000 (16:59 +0100)] 
stream/segtree: improve docs, error handling

3 years agostreaming/buffer: add debug validation for 'impossible' condition
Victor Julien [Tue, 22 Mar 2022 15:55:52 +0000 (16:55 +0100)] 
streaming/buffer: add debug validation for 'impossible' condition

3 years agoapp-layer: make registration structure more compact
Victor Julien [Tue, 3 May 2022 17:56:19 +0000 (19:56 +0200)] 
app-layer: make registration structure more compact

3 years agohtp: minor format string fixes 7392/head
Victor Julien [Thu, 5 May 2022 08:41:15 +0000 (10:41 +0200)] 
htp: minor format string fixes

3 years agodatasets: constify some function args
Victor Julien [Thu, 28 Apr 2022 15:50:30 +0000 (17:50 +0200)] 
datasets: constify some function args

3 years agotime: reduce scope of static string
Victor Julien [Wed, 27 Apr 2022 19:28:53 +0000 (21:28 +0200)] 
time: reduce scope of static string

3 years agothreshold: constify detect engine arg
Victor Julien [Wed, 27 Apr 2022 19:28:25 +0000 (21:28 +0200)] 
threshold: constify detect engine arg

3 years agothash: reduce scope for var; suggested by cppcheck
Victor Julien [Wed, 27 Apr 2022 19:27:50 +0000 (21:27 +0200)] 
thash: reduce scope for var; suggested by cppcheck

3 years agospm: constify badchars; suggested by cppcheck
Victor Julien [Wed, 27 Apr 2022 19:27:07 +0000 (21:27 +0200)] 
spm: constify badchars; suggested by cppcheck

3 years agoradix: small cppcheck suggested cleanup
Victor Julien [Wed, 27 Apr 2022 19:26:19 +0000 (21:26 +0200)] 
radix: small cppcheck suggested cleanup

3 years agopacketpool: minor cleanup
Victor Julien [Wed, 27 Apr 2022 19:25:51 +0000 (21:25 +0200)] 
packetpool: minor cleanup

3 years agostream: minor code cleanups suggested by cppcheck
Victor Julien [Wed, 27 Apr 2022 19:21:09 +0000 (21:21 +0200)] 
stream: minor code cleanups suggested by cppcheck

3 years agodefrag: minor code cleanups suggested by cppcheck
Victor Julien [Wed, 27 Apr 2022 19:19:43 +0000 (21:19 +0200)] 
defrag: minor code cleanups suggested by cppcheck

3 years agooutput/flow: no double var init
Victor Julien [Wed, 27 Apr 2022 19:18:57 +0000 (21:18 +0200)] 
output/flow: no double var init

3 years agosmtp: minor code cleanup
Victor Julien [Wed, 27 Apr 2022 19:18:17 +0000 (21:18 +0200)] 
smtp: minor code cleanup

3 years agoapp-layer: minor code cleanups suggested by cppcheck
Victor Julien [Wed, 27 Apr 2022 19:16:05 +0000 (21:16 +0200)] 
app-layer: minor code cleanups suggested by cppcheck

3 years agoapp-layer/expectation: reduce scope and init vars
Victor Julien [Wed, 27 Apr 2022 19:15:25 +0000 (21:15 +0200)] 
app-layer/expectation: reduce scope and init vars

3 years agoftp: code clarifications
Victor Julien [Wed, 27 Apr 2022 18:19:09 +0000 (20:19 +0200)] 
ftp: code clarifications

src/app-layer-ftp.c:945:49: style: Parameter 'ftp_state' can be declared with const [constParameter]
static FTPTransaction *FTPGetOldestTx(FtpState *ftp_state, FTPTransaction *starttx)
                                                ^

3 years agoutil/byte: minor cleanup
Victor Julien [Wed, 27 Apr 2022 15:28:14 +0000 (17:28 +0200)] 
util/byte: minor cleanup

3 years agothreads: remove usused code; wrap in guards
Victor Julien [Wed, 27 Apr 2022 15:21:25 +0000 (17:21 +0200)] 
threads: remove usused code; wrap in guards

3 years agothreads: remove unused function
Victor Julien [Wed, 27 Apr 2022 14:52:43 +0000 (16:52 +0200)] 
threads: remove unused function

3 years agounittests: wrap unittest registration in guards
Victor Julien [Wed, 27 Apr 2022 14:54:49 +0000 (16:54 +0200)] 
unittests: wrap unittest registration in guards

3 years agoapp-layer/profiling: hide profiling code behind guards
Victor Julien [Wed, 27 Apr 2022 14:49:24 +0000 (16:49 +0200)] 
app-layer/profiling: hide profiling code behind guards

3 years agoapp-layer/events: remove unused function
Victor Julien [Wed, 27 Apr 2022 14:47:12 +0000 (16:47 +0200)] 
app-layer/events: remove unused function

3 years agooutput/frames: fix eof var overwrite
Victor Julien [Wed, 27 Apr 2022 14:40:14 +0000 (16:40 +0200)] 
output/frames: fix eof var overwrite

3 years agostream/reassembly: reduce scope of variable
Victor Julien [Wed, 27 Apr 2022 14:37:28 +0000 (16:37 +0200)] 
stream/reassembly: reduce scope of variable

3 years agostream/buffer: remove redundant check
Victor Julien [Wed, 27 Apr 2022 13:57:45 +0000 (15:57 +0200)] 
stream/buffer: remove redundant check

3 years agodecode/checksums: constify pointer args
Victor Julien [Wed, 27 Apr 2022 13:48:18 +0000 (15:48 +0200)] 
decode/checksums: constify pointer args

3 years agodetect/state: address cppcheck warnings
Victor Julien [Wed, 27 Apr 2022 13:35:46 +0000 (15:35 +0200)] 
detect/state: address cppcheck warnings

src/detect-engine-state.c:127:91: style: Suspicious calculation. Please use parentheses to clarify the code. The code ''a&b?c:d'' should be written as either ''(a&b)?c:d'' or ''a&(b?c:d)''. [clarifyCalculation]
    DetectEngineStateDirection *dir_state = &state->dir_state[direction & STREAM_TOSERVER ? 0 : 1];
                                                                                          ^
src/detect-engine-state.c:194:53: style: Suspicious calculation. Please use parentheses to clarify the code. The code ''a&b?c:d'' should be written as either ''(a&b)?c:d'' or ''a&(b?c:d)''. [clarifyCalculation]
    de_state->dir_state[direction & STREAM_TOSERVER ? 0 : 1].filestore_cnt += file_no_match;
                                                    ^
src/detect-engine-state.c:201:57: style: Suspicious calculation. Please use parentheses to clarify the code. The code ''a&b?c:d'' should be written as either ''(a&b)?c:d'' or ''a&(b?c:d)''. [clarifyCalculation]
    if (de_state->dir_state[direction & STREAM_TOSERVER ? 0 : 1].filestore_cnt == sgh->filestore_cnt)
                                                        ^

3 years agodetect/file: minor code cleanup
Victor Julien [Wed, 27 Apr 2022 13:33:20 +0000 (15:33 +0200)] 
detect/file: minor code cleanup

Reduce scope where possible. Suggested by cppcheck.

3 years agorunmodes: fix more warnings
Victor Julien [Thu, 28 Apr 2022 15:49:07 +0000 (17:49 +0200)] 
runmodes: fix more warnings

3 years agomemcmp: no-simd no case loop can scan forward
Victor Julien [Fri, 6 May 2022 21:52:00 +0000 (23:52 +0200)] 
memcmp: no-simd no case loop can scan forward

3 years agomemcmp: use SCMEMCMP_BYTES everywhere; general cleanups
Victor Julien [Fri, 6 May 2022 16:20:40 +0000 (18:20 +0200)] 
memcmp: use SCMEMCMP_BYTES everywhere; general cleanups

3 years agomemcmp: work around GCC 12+ 'blend' issues
Victor Julien [Fri, 6 May 2022 15:46:40 +0000 (17:46 +0200)] 
memcmp: work around GCC 12+ 'blend' issues

Since GCC 12 the memcmp code using `_mm_blendv_epi8` failed to work.
Inspection of the disassembled objects suggests that it simply omits
the instruction on systems that are not AVX512 capable. On AVX512
it does replace it with VPCMPB logic that appears to work.

Luckily our use of blend is actually uncessary. A simple AND is sufficient.

Bug: #5312.

3 years agomemcmp: remove unreachable code from memcmp simd
Victor Julien [Thu, 5 May 2022 05:16:53 +0000 (07:16 +0200)] 
memcmp: remove unreachable code from memcmp simd

cppcheck:

src/util-memcmp.h:281:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:280:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:269:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:281:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^
src/util-memcmp.h:344:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:343:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:318:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:344:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^
src/util-memcmp.h:171:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:170:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:159:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:171:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^
src/util-memcmp.h:233:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:232:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:208:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:233:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^

3 years agodetect/iponly: fix debug compiler warning
Victor Julien [Fri, 6 May 2022 09:13:09 +0000 (11:13 +0200)] 
detect/iponly: fix debug compiler warning

3 years agodcerpc: convert transaction list to vecdeque 7367/head
Jason Ish [Mon, 2 May 2022 18:19:51 +0000 (12:19 -0600)] 
dcerpc: convert transaction list to vecdeque

Allows for more efficient removal from front of the list.

Ticket: #5271

3 years agomqtt, rdp: fix copyright dates
Jason Ish [Mon, 2 May 2022 18:19:29 +0000 (12:19 -0600)] 
mqtt, rdp: fix copyright dates

3 years agorust: RustParser same fields as AppLayerParser
Philippe Antoine [Mon, 2 May 2022 20:50:04 +0000 (22:50 +0200)] 
rust: RustParser same fields as AppLayerParser

So that there is no problem when crossing FFI

3 years agoconfigure.ac: handle undefined LEVEL1_DCACHE_LINESIZE
Sascha Steinbiss [Sat, 30 Apr 2022 12:20:38 +0000 (14:20 +0200)] 
configure.ac: handle undefined LEVEL1_DCACHE_LINESIZE

On some platforms (riscv64, s390x) this value is "undefined" as returned
from getconf. We also need to handle this to avoid using the string
"undefined" blindly in further #defines.

3 years agodoc: add note about file.data and file_data
jason taylor [Mon, 2 May 2022 12:06:56 +0000 (12:06 +0000)] 
doc: add note about file.data and file_data

Signed-off-by: jason taylor <jtfas90@gmail.com>
3 years agodoc: update file_data to file.data keyword
jason taylor [Tue, 26 Apr 2022 20:49:19 +0000 (20:49 +0000)] 
doc: update file_data to file.data keyword

Signed-off-by: jason taylor <jtfas90@gmail.com>
3 years agodoc: remove extra newline in order to match style
jason taylor [Tue, 26 Apr 2022 20:35:52 +0000 (20:35 +0000)] 
doc: remove extra newline in order to match style

Signed-off-by: jason taylor <jtfas90@gmail.com>
3 years agodoc: remove extraneous + characters
jason taylor [Tue, 26 Apr 2022 20:33:07 +0000 (20:33 +0000)] 
doc: remove extraneous + characters

Signed-off-by: jason taylor <jtfas90@gmail.com>
3 years agoftp-data: fix direction for active mode commands 7356/head
Victor Julien [Sat, 30 Apr 2022 14:54:07 +0000 (16:54 +0200)] 
ftp-data: fix direction for active mode commands

Set correct direction for PORT mode, where the server connects
to the client.

The direction is not also strictly enforced. No data in the wrong
direction will be accepted to setup the file or to be added to the
file after setup.

This also fixes files getting closed twice.

Adds some general cleanups.

Bug: #3542.

3 years agonfs3/records: Fix typo 7349/head
Sam Muhammed [Sat, 12 Feb 2022 17:53:00 +0000 (19:53 +0200)] 
nfs3/records: Fix typo

Fix response_lookup unittest name

3 years agotemplate: convert GetTx to SCLogDebug
Philippe Antoine [Thu, 14 Apr 2022 11:54:53 +0000 (13:54 +0200)] 
template: convert GetTx to SCLogDebug

as it is especially verbose for fuzzing

3 years agoscripts/bundle: use git instead of tar.gz
Jason Ish [Thu, 21 Apr 2022 19:41:15 +0000 (13:41 -0600)] 
scripts/bundle: use git instead of tar.gz

To better fit with our current CI processes, use git to clone the
suricata-update and libhtp dependencies.  The requirements.txt file has
been modified to take a repo URL and a `-b` command line option for tag
or branch.

For the master branch we will use the libhtp 0.5.x branch and the
suricata-update master branch.

Also allows for repo and branch names to be overrided with environment
variables:
- SU_REPO
- SU_BRANCH
- LIBHTP_REPO
- LIBHTP_BRANCH

3 years agodecode: fix integer warnings
Philippe Antoine [Tue, 18 Jan 2022 14:29:17 +0000 (15:29 +0100)] 
decode: fix integer warnings

Ticket: 4516

3 years agoftp: truncate first segment if over max length
Jason Ish [Fri, 22 Apr 2022 18:04:37 +0000 (12:04 -0600)] 
ftp: truncate first segment if over max length

The first segment was not limited to the configured maximum line length
allowing it to be up to 65k. This could result in the next input length
being negative, which while handled properly by the code, did trigger a
debug validation assertion.

The fix is to be consistent and apply the limit to the first segment as
well, which does ensure the input_len could never be less than 0.

Ticket #5281