]> git.ipfire.org Git - people/ms/suricata.git/log
people/ms/suricata.git
2 years agodetect: allows <> syntax for uint ranges master
Philippe Antoine [Thu, 18 Feb 2021 14:43:03 +0000 (15:43 +0100)] 
detect: allows <> syntax for uint ranges

2 years agodetect: use prefilter values for modes
Philippe Antoine [Wed, 17 Feb 2021 16:26:38 +0000 (17:26 +0100)] 
detect: use prefilter values for modes

2 years agodetect: errors for rule with impossible conditions
Philippe Antoine [Wed, 17 Feb 2021 16:14:21 +0000 (17:14 +0100)] 
detect: errors for rule with impossible conditions

Such as >255 for an uint8 field

2 years agouserguide: (nit) fix typo in lua-output page
Juliana Fajardini [Fri, 15 Oct 2021 15:36:24 +0000 (16:36 +0100)] 
userguide: (nit) fix typo in lua-output page

2 years agouserguide: rename pg Lua Scripting->Lua Detection
Juliana Fajardini [Thu, 14 Oct 2021 22:06:01 +0000 (23:06 +0100)] 
userguide: rename pg Lua Scripting->Lua Detection

Since we can have scripts for output _or_ detection, it seems more
clear to rename this page to add more meaning

2 years agouserguide: update buffers list for lua-scripting
Juliana Fajardini [Thu, 14 Oct 2021 21:48:47 +0000 (22:48 +0100)] 
userguide: update buffers list for lua-scripting

2 years agouserguide/lua: add explanation about `need` diffs
Juliana Fajardini [Thu, 14 Oct 2021 21:42:11 +0000 (22:42 +0100)] 
userguide/lua: add explanation about `need` diffs

The differences on how the `need` key works, depending on script
usage (output or detection) confuses users, sometimes (cf doc#4725).
While we don't fix that, just explain this behavior.

2 years agofuzz: restrict flags passed to AppLayerProtoDetectGetProto
Philippe Antoine [Tue, 23 Nov 2021 21:13:56 +0000 (22:13 +0100)] 
fuzz: restrict flags passed to AppLayerProtoDetectGetProto

Completes commit 05f9b3ffc687d1afcfc5984ac9f0ce1888d06bf5

2 years agoapp-layer: include decoder events in app-layer tx data
Jason Ish [Tue, 16 Nov 2021 22:43:57 +0000 (16:43 -0600)] 
app-layer: include decoder events in app-layer tx data

As most parsers use an events structure we can include it in the
tx_data structure to reduce some boilerplate/housekeeping code
in app-layer parsers.

2 years agorange: prevents memory leak of file from HTTP2
Philippe Antoine [Tue, 23 Nov 2021 12:59:47 +0000 (13:59 +0100)] 
range: prevents memory leak of file from HTTP2

Ticket: 4811
Completes commit c023116857426137eb0c7240b80e99a8940f3c5b

state.free should also close files with ranges
as state.free_tx did already

And file_range field should be reset so that there is no
use after free.

2 years agoenip: fix int warnings
Philippe Antoine [Mon, 22 Nov 2021 08:42:40 +0000 (09:42 +0100)] 
enip: fix int warnings

There seems to fix a real bug when an ENIP connection
has more than 65k transactions

2 years agodnp3: fix int warnings
Philippe Antoine [Mon, 22 Nov 2021 08:13:54 +0000 (09:13 +0100)] 
dnp3: fix int warnings

There is a hack to know the type of an integer
and do an explicit cast in the python script
generating the C file

Also extends some bounds check against negative values

2 years agoprotodetect: fix int warnings
Philippe Antoine [Sat, 23 Oct 2021 11:04:48 +0000 (13:04 +0200)] 
protodetect: fix int warnings

There is actually a real evasion with AppLayerProtoDetectPMGetProto
using u16 instead of u32 for buflen

2 years agoci: adds default warning flag about float conversions
Philippe Antoine [Sat, 23 Oct 2021 10:25:39 +0000 (12:25 +0200)] 
ci: adds default warning flag about float conversions

2 years agowarning: explicit casts to double
Philippe Antoine [Sat, 23 Oct 2021 10:23:14 +0000 (12:23 +0200)] 
warning: explicit casts to double

2 years agosource/pcap: remove unused code
Philippe Antoine [Sat, 23 Oct 2021 10:22:54 +0000 (12:22 +0200)] 
source/pcap: remove unused code

2 years agofuzz: restrict flags passed to AppLayerProtoDetectGetProto
Philippe Antoine [Mon, 22 Nov 2021 14:08:52 +0000 (15:08 +0100)] 
fuzz: restrict flags passed to AppLayerProtoDetectGetProto

So that rust does not panic with an unhandled value

2 years agoaf-packet: add send error counter
Victor Julien [Fri, 19 Nov 2021 06:03:10 +0000 (07:03 +0100)] 
af-packet: add send error counter

2 years agopacketpool: ReleasePacket callback check on getter
Victor Julien [Fri, 5 Nov 2021 19:09:17 +0000 (20:09 +0100)] 
packetpool: ReleasePacket callback check on getter

Any packet coming from the pool should have `PacketPoolReturnPacket`
as its callback. Check that this is the case.

2 years agoaf-packet: only ref mpeer if needed in tpacket v2
Victor Julien [Fri, 5 Nov 2021 12:50:18 +0000 (13:50 +0100)] 
af-packet: only ref mpeer if needed in tpacket v2

We only use it in autofp mode, for reference counting purposes.

Removes 2 atomic operations per packet in the more common workers
runmode.

2 years agoaf-packet: minor output updates
Victor Julien [Fri, 5 Nov 2021 11:23:48 +0000 (12:23 +0100)] 
af-packet: minor output updates

2 years agoaf-packet: optimize packet setup
Victor Julien [Fri, 5 Nov 2021 10:21:02 +0000 (11:21 +0100)] 
af-packet: optimize packet setup

Don't set fields we don't use in V3.

2 years agoaf-packet: add counters on how poll() works
Victor Julien [Thu, 4 Nov 2021 12:25:03 +0000 (13:25 +0100)] 
af-packet: add counters on how poll() works

Use `capture.afpacket.*` counter name space.

2 years agoaf-packet: don't check ifstate per send call in IPS
Victor Julien [Thu, 4 Nov 2021 16:38:58 +0000 (17:38 +0100)] 
af-packet: don't check ifstate per send call in IPS

Instead just accept that the socket state leads to `sendto` errors.
So print at most one error per socket.

2 years agoaf-packet: simplify AFPWritePacket
Victor Julien [Thu, 4 Nov 2021 09:39:36 +0000 (10:39 +0100)] 
af-packet: simplify AFPWritePacket

Since return code was ignored by all callers, we can just turn it into a
void function and slightly simplify the logic.

2 years agoaf-packet: use BUG_ON for 'impossible' condition
Victor Julien [Thu, 4 Nov 2021 09:05:54 +0000 (10:05 +0100)] 
af-packet: use BUG_ON for 'impossible' condition

2 years agoaf-packet: refactor VLAN hdr handling
Victor Julien [Thu, 4 Nov 2021 09:00:17 +0000 (10:00 +0100)] 
af-packet: refactor VLAN hdr handling

Update the packet payload after decode, instead of during IPS send.

This means the updates happen in the capture thread, and the VLAN header
is available to logging as well.

Ticket: #4805.

2 years agoaf-packet: remove tpacket-v1 support
Victor Julien [Sun, 31 Oct 2021 20:27:49 +0000 (21:27 +0100)] 
af-packet: remove tpacket-v1 support

Ticket: #4796.

V2 (for IDS and IPS) and V3 (for IDS) are widely supported. V2 was introduced
in 2008, so we can safely assume that all systems can run V2+.

2 years agoapp-layer/template: don't always enable if unittests built
Jason Ish [Fri, 12 Nov 2021 16:53:52 +0000 (10:53 -0600)] 
app-layer/template: don't always enable if unittests built

314ec77f88325a4e8989e898991b9af493cad3dc had the unintended side affect
of enabling the template parser and detection buffer if unittests were
enabled.

Fix this by using the new `Default` method for registering parsers.
However, the buffer still needs an explicit configuration check.

Also convert Notice debug messages to Debug to reduce output when in
unittest mode.  If we feel stronly this should still be Notice in the
template, that is a conversion we can make in the generation script when
generating a new parser.

2 years agotftp: Change references to echo
Jeff Lucovsky [Wed, 10 Nov 2021 14:43:56 +0000 (09:43 -0500)] 
tftp: Change references to echo

This commit changes the references to the "echo" protocol to tftp. The
references to echo are part of the template parser code.

2 years agoftp: Remove diagnostic print
Jeff Lucovsky [Wed, 10 Nov 2021 14:20:30 +0000 (09:20 -0500)] 
ftp: Remove diagnostic print

This commit removes a diagnostic message displayed during extraction of
the EPSV port.

2 years agonetmap: V14 API changes
Jeff Lucovsky [Fri, 20 Aug 2021 13:10:26 +0000 (09:10 -0400)] 
netmap: V14 API changes

This commit modifies the Netmap packet handling to use API version 14.

@bmeeks8 contributed many changes instrumental to this effort.

2 years agoutil: Add sys/ioctl.h to common include
Jeff Lucovsky [Mon, 23 Aug 2021 12:46:10 +0000 (08:46 -0400)] 
util: Add sys/ioctl.h to common include

This commit adds another system include file based on autoconf to the
common Suricata include file for convenience.

2 years agoutil/log: Include device name with thread count
Jeff Lucovsky [Sat, 11 Sep 2021 13:03:33 +0000 (09:03 -0400)] 
util/log: Include device name with thread count

2 years agoconfig/netmap: Check for latest API version
Jeff Lucovsky [Sat, 21 Aug 2021 12:57:18 +0000 (08:57 -0400)] 
config/netmap: Check for latest API version

This commit checks for the latest Netmap API version.

2 years agorange: prevents memory leak of file from HTTP2
Philippe Antoine [Mon, 8 Nov 2021 12:33:27 +0000 (13:33 +0100)] 
range: prevents memory leak of file from HTTP2

If a HTTP2 transaction gets freed before the end of the range
request, we need to have the files container which is in
the state, to transfer owernship of this file to the files
container.

Ticket: 4811

2 years agoconf: avoid quadratic complexity
Philippe Antoine [Mon, 8 Nov 2021 13:18:30 +0000 (14:18 +0100)] 
conf: avoid quadratic complexity

Ticket: 4812

When adding many sequence nodes

2 years agorust/nfs: convert parser to nom7 functions (NFS v2 records)
Pierre Chifflier [Tue, 9 Nov 2021 19:17:27 +0000 (20:17 +0100)] 
rust/nfs: convert parser to nom7 functions (NFS v2 records)

2 years agorust/nfs: add a maximum number of operations per compound
Pierre Chifflier [Mon, 8 Nov 2021 22:11:24 +0000 (23:11 +0100)] 
rust/nfs: add a maximum number of operations per compound

The `count` combinator preallocates a number of bytes. Since the value
is untrusted, this can result in an Out Of Memory allocation.
Use a maximum value, large enough to cover all current implementations.

2 years agorust/nfs: convert parser to nom7 functions (NFS v3 and v4 records)
Pierre Chifflier [Mon, 8 Nov 2021 15:38:17 +0000 (16:38 +0100)] 
rust/nfs: convert parser to nom7 functions (NFS v3 and v4 records)

2 years agodetect-fragoffset: convert unittests to FAIL/PASS APIs
Modupe Falodun [Wed, 10 Nov 2021 01:05:05 +0000 (02:05 +0100)] 
detect-fragoffset: convert unittests to FAIL/PASS APIs

Bug: #4040

2 years agoci: add fedora 35 to builds
Corey Thomas [Wed, 10 Nov 2021 13:21:38 +0000 (08:21 -0500)] 
ci: add fedora 35 to builds

2 years agosmtp: log transaction even if no email present
Jason Ish [Wed, 10 Nov 2021 22:38:35 +0000 (16:38 -0600)] 
smtp: log transaction even if no email present

The SMTP transaction logger was not writing the log if the email
portion of the logger failed, such as in the case of STARTTLS
where this is no email decoded.

Ticket #4817

2 years agodetect/proto: convert unittests to FAIL/PASS APIs
Sam Muhammed [Fri, 12 Nov 2021 12:17:50 +0000 (14:17 +0200)] 
detect/proto: convert unittests to FAIL/PASS APIs

Task #4027

2 years agodetect-icode: convert unittests to FAIL/PASS APIs
Modupe Falodun [Sun, 21 Nov 2021 02:34:41 +0000 (03:34 +0100)] 
detect-icode: convert unittests to FAIL/PASS APIs

Bug: #4045

2 years agodetect-id: convert unittests to FAIL/PASS APIs
Modupe Falodun [Sun, 21 Nov 2021 01:25:15 +0000 (02:25 +0100)] 
detect-id: convert unittests to FAIL/PASS APIs

Bug: #4046

2 years agodetect/siggroup: convert unittests to FAIL/PASS APIs
Sam Muhammed [Sat, 13 Nov 2021 17:35:43 +0000 (19:35 +0200)] 
detect/siggroup: convert unittests to FAIL/PASS APIs

Task #4028

2 years agolua: Fix SCRule functions for match scripts
Benjamin Wilkins [Wed, 20 Oct 2021 20:21:08 +0000 (16:21 -0400)] 
lua: Fix SCRule functions for match scripts

Save Signature structure to lua register so SCRule functions can work
in match scripts, where no PacketAlert is present

Resolves Feature #2450

2 years agomodbus: free eve thread context on deinit
Jason Ish [Wed, 17 Nov 2021 05:15:13 +0000 (23:15 -0600)] 
modbus: free eve thread context on deinit

Was triggering ASAN leak detection.

2 years agodhcp: fix url in comment
Jason Ish [Wed, 17 Nov 2021 01:34:11 +0000 (19:34 -0600)] 
dhcp: fix url in comment

rustdoc was complaining about the format of the URL in a comment
while trying to generate documentation. Convert the comment to a
non-rustdoc comment for now to satisfy rustdoc.

2 years agoapp-layer: remove IsTxEventAware: never used
Jason Ish [Tue, 16 Nov 2021 22:35:29 +0000 (16:35 -0600)] 
app-layer: remove IsTxEventAware: never used

The function AppLayerParserProtocolIsTxEventAware is not used so
remove.

2 years agordp: fix transaction id
Jason Ish [Tue, 16 Nov 2021 23:52:58 +0000 (17:52 -0600)] 
rdp: fix transaction id

By our convention the transaction ID is incremented then applied
to the new transaction. And the generic transaction iterator
requires this behaviour.

2 years agoapp-layer: remove tx detect state setter and getter
Jason Ish [Wed, 10 Nov 2021 15:51:15 +0000 (09:51 -0600)] 
app-layer: remove tx detect state setter and getter

Instead access detect state through AppLayerParserGetTxData.

2 years agoapp-layer: include DetectEngineState in AppLayerTxData
Jason Ish [Tue, 9 Nov 2021 23:14:20 +0000 (17:14 -0600)] 
app-layer: include DetectEngineState in AppLayerTxData

Every transaction has an existing mandatory field, tx_data. As
DetectEngineState is also mandatory, include it in tx_data.

This allows us to remove the boilerplate every app-layer has
for managing detect engine state.

2 years agordp: add tx iterator
Jason Ish [Wed, 10 Nov 2021 19:34:10 +0000 (13:34 -0600)] 
rdp: add tx iterator

2 years agokrb5: use tx iterator
Jason Ish [Wed, 10 Nov 2021 19:38:22 +0000 (13:38 -0600)] 
krb5: use tx iterator

2 years agontp: add tx iterator
Jason Ish [Wed, 10 Nov 2021 19:31:54 +0000 (13:31 -0600)] 
ntp: add tx iterator

2 years agosip: add tx iterator
Jason Ish [Wed, 10 Nov 2021 19:30:04 +0000 (13:30 -0600)] 
sip: add tx iterator

2 years agoike: add tx iterator
Jason Ish [Wed, 10 Nov 2021 19:25:23 +0000 (13:25 -0600)] 
ike: add tx iterator

For IKE the manual iterator functions were there, but never
registered. So this commit does add a tx iterator to ike.

2 years agosnmp: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 19:22:15 +0000 (13:22 -0600)] 
snmp: use generic tx iterator

2 years agodhcp: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 18:03:53 +0000 (12:03 -0600)] 
dhcp: use generic tx iterator

2 years agohttp2: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 18:00:50 +0000 (12:00 -0600)] 
http2: use generic tx iterator

2 years agotemplate: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 17:58:19 +0000 (11:58 -0600)] 
template: use generic tx iterator

2 years agonfs: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 17:54:23 +0000 (11:54 -0600)] 
nfs: use generic tx iterator

2 years agorfb: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 17:24:14 +0000 (11:24 -0600)] 
rfb: use generic tx iterator

2 years agomqtt: use generic tx iterator
Jason Ish [Wed, 10 Nov 2021 17:20:13 +0000 (11:20 -0600)] 
mqtt: use generic tx iterator

2 years agomodbus: use generic tx iterator
Jason Ish [Mon, 25 Oct 2021 23:18:59 +0000 (17:18 -0600)] 
modbus: use generic tx iterator

2 years agosmb: use generic tx iterator
Jason Ish [Mon, 25 Oct 2021 23:01:20 +0000 (17:01 -0600)] 
smb: use generic tx iterator

2 years agorust/app-layer: provide generic implementation of iterator
Jason Ish [Thu, 14 Oct 2021 18:37:03 +0000 (12:37 -0600)] 
rust/app-layer: provide generic implementation of iterator

Create traits for app-layer State and Transaction that allow
a generic implementation of a transaction iterator that parser
can use when the follow the common pattern for iterating
transactions.

Also convert DNS to use the generic for testing purposes.

2 years agoprofiling: fix profiling with sample rate
Eric Leblond [Wed, 17 Nov 2021 15:43:23 +0000 (16:43 +0100)] 
profiling: fix profiling with sample rate

Rules profiling was returning invalid results when used with sample
rate. The problem was that the sample condition was run twice in the
packet flow. As a result, the second pass was not initializing the
variable storing the initial CPU ticks and the resulting performance
counters were reporting invalid values.

Bug: #4836.

2 years agodetect: file_data keyword works on nfs protocol
Philippe Antoine [Fri, 19 Nov 2021 11:33:06 +0000 (12:33 +0100)] 
detect: file_data keyword works on nfs protocol

Ticket: #4839

2 years agohttp2: remove needless borrows
Shivani Bhardwaj [Wed, 8 Sep 2021 01:44:25 +0000 (07:14 +0530)] 
http2: remove needless borrows

2 years agocore: Remove unneeded consts
Shivani Bhardwaj [Thu, 12 Aug 2021 16:43:31 +0000 (22:13 +0530)] 
core: Remove unneeded consts

2 years agossh: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 16:41:38 +0000 (22:11 +0530)] 
ssh: use Direction enum

2 years agosnmp: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 16:36:09 +0000 (22:06 +0530)] 
snmp: use Direction enum

2 years agosmb: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 16:29:53 +0000 (21:59 +0530)] 
smb: use Direction enum

2 years agosip: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 13:22:13 +0000 (18:52 +0530)] 
sip: use Direction enum

2 years agonfs: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 13:11:12 +0000 (18:41 +0530)] 
nfs: use Direction enum

2 years agomqtt: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 12:41:42 +0000 (18:11 +0530)] 
mqtt: use Direction enum

2 years agokrb: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 12:39:15 +0000 (18:09 +0530)] 
krb: use Direction enum

2 years agoike: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 12:30:53 +0000 (18:00 +0530)] 
ike: use Direction enum

2 years agohttp2: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 11:57:53 +0000 (17:27 +0530)] 
http2: use Direction enum

2 years agofiles: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 12:21:07 +0000 (17:51 +0530)] 
files: use Direction enum

2 years agodns: use Direction enum
Shivani Bhardwaj [Thu, 12 Aug 2021 09:54:51 +0000 (15:24 +0530)] 
dns: use Direction enum

2 years agodcerpc: use Direction enum
Shivani Bhardwaj [Wed, 11 Aug 2021 11:29:48 +0000 (16:59 +0530)] 
dcerpc: use Direction enum

2 years agocore: add Direction enum
Shivani Bhardwaj [Fri, 11 Sep 2020 18:48:21 +0000 (00:18 +0530)] 
core: add Direction enum

Ticket: 3832

2 years agodoc: Fix typo in documentation of rule keyword flow
Andreas Dolp [Thu, 28 Oct 2021 04:56:27 +0000 (06:56 +0200)] 
doc: Fix typo in documentation of rule keyword flow

2 years agotcp: rejects FIN+SYN packets as invalid
Philippe Antoine [Thu, 16 Sep 2021 14:54:37 +0000 (16:54 +0200)] 
tcp: rejects FIN+SYN packets as invalid

Ticket: #4569

If a FIN+SYN packet is sent, the destination may keep the
connection alive instead of starting to close it.
In this case, a later SYN packet will be ignored by the
destination.

Previously, Suricata considered this a session reuse, and thus
used the sequence number of the last SYN packet, instead of
using the one of the live connection, leading to evasion.

This commit errors on FIN+SYN so that they do not get
processed as regular FIN packets.

2 years agostream/tcp: handle RST with MD5 or AO header
Victor Julien [Tue, 5 Oct 2021 12:48:27 +0000 (14:48 +0200)] 
stream/tcp: handle RST with MD5 or AO header

Special handling for RST packets if they have an TCP MD5 or AO header option.
The options hash can't be validated. The end host might be able to validate
it, as it can have a key/password that was communicated out of band.

The sender could use this to move the TCP state to 'CLOSED', leading to
a desync of the TCP session.

This patch builds on top of
843d0b7a10bb ("stream: support RST getting lost/ignored")

It flags the receiver as having received an RST and moves the TCP state
into the CLOSED state. It then reverts this if the sender continues to
send traffic. In this case it sets the following event:

    stream-event:suspected_rst_inject;

Bug: #4710.

2 years agontp: fixes leak of de_state
Philippe Antoine [Tue, 12 Oct 2021 11:29:39 +0000 (13:29 +0200)] 
ntp: fixes leak of de_state

Bug: #4752.

2 years agosnmp: fixes leak of de_state
Philippe Antoine [Tue, 12 Oct 2021 11:29:25 +0000 (13:29 +0200)] 
snmp: fixes leak of de_state

Bug: #4752.

2 years agosmb: midstream probing checks for netbios message type
Philippe Antoine [Mon, 23 Aug 2021 15:31:51 +0000 (17:31 +0200)] 
smb: midstream probing checks for netbios message type

If it is available

Bug: #4620.

2 years agoprotodetect: opposing side cannot change protocol
Philippe Antoine [Fri, 16 Jul 2021 12:22:28 +0000 (14:22 +0200)] 
protodetect: opposing side cannot change protocol

Ticket: #4562

As the data which triggered the opposing side
was the same protocol and not another one,
that means the protocol change failed.

Prevents a memory leak in later call of AppLayerParserParse
which would allocate a new state and leak the old one

2 years agosmtp: completes RSET transaction on last multiline
Philippe Antoine [Wed, 14 Jul 2021 17:40:42 +0000 (19:40 +0200)] 
smtp: completes RSET transaction on last multiline

Bug: #4561.

2 years agoswf: right input length for decompression
Philippe Antoine [Thu, 1 Jul 2021 13:04:58 +0000 (15:04 +0200)] 
swf: right input length for decompression

Also when compress_depth reaches buffer_len

Bug: #4536.

2 years agorust: right condition for both uint to be zero
Philippe Antoine [Mon, 13 Sep 2021 09:22:36 +0000 (11:22 +0200)] 
rust: right condition for both uint to be zero

Theay can overflow leading to their addition to be zero

If a NFS read reply indicates a count of 0xFFFFFFFF

Bug: #4680.

2 years agoinspect: debug validation to ensure correct argument
Philippe Antoine [Mon, 13 Sep 2021 10:27:51 +0000 (12:27 +0200)] 
inspect: debug validation to ensure correct argument

2 years agodetect: fixes InspectionBuffer id with transforms
Philippe Antoine [Mon, 13 Sep 2021 10:18:34 +0000 (12:18 +0200)] 
detect: fixes InspectionBuffer id with transforms

When InspectionBufferGet gets called with base_id
Later InspectionBufferSetup must also be called with base_id

In case there were transforms, we had base_id != list_id

Not calling InspectionBufferSetup with the right id
resulted in leaving a dangling pointer,
because it was not added to det_ctx->inspect.to_clear_queue

Bug: #4681.

2 years agoflow/manager: fix flows not evicted & freed in time
Victor Julien [Sun, 7 Nov 2021 05:25:31 +0000 (06:25 +0100)] 
flow/manager: fix flows not evicted & freed in time

Flows have been shown to linger for a long time w/o giving up their
resources. This would lead to higher memory use and memcaps getting
reached.

Three main causes have been identified:

Slow passes hash passes. By default the flow manager will scan the
flow hash slowly. It is based on the flow timeout settings, and with
the default config it will take 4 minutes for a full scan to be
complete. This leaves a window for flows that are timed out to linger
for minutes longer than expected.

Flow Manager yields under pressure. The per row TryLock causes work
to be delayed more. The Flow manager will use trylock on a hash row
and will yield immediately if the row is busy. This means that it will
take a full pass before the row is revisited again. If the row holds
busy flows, this could happen many times in a row.

Flow Manager favors evicted flows over active flows. The Flow Manager
will only process the evicted flows if they are present. These flows
have been evicted by workers. The active flows on that hash row will
have to wait until the next hash pass. Of course by then there could
be more evicted flows.

Combined these factors could lead to flows not being considered for
freeing and logging for a very long time, potentially even indefinitly.

The patch addresses the latter two flow manager issues by no longer
using TryLock. It will now simply wait for the lock to be released and
then do its work on it. Additionally for each row both the evicted list
and the active flow list will be processed.

Bug: #4650.

2 years agoaf-packet: simplify tpacket-v2 setup code
Victor Julien [Fri, 5 Nov 2021 10:31:58 +0000 (11:31 +0100)] 
af-packet: simplify tpacket-v2 setup code

Setup can no longer fail, so make the function void and remove dead
error checking code.