Commit Graph

16826 Commits (master)
 

Author SHA1 Message Date
Jason Ish 32287c7694 output-lua: rename script directory variable
It had a rather generic name of "path", which in Lua usually means a
search path, which we'll be adding.
2 weeks ago
Jason Ish c6d038b8a4 doc/userguide: document Lua base64 library
Ticket: #7074
2 weeks ago
Jason Ish 018f274e2a lua: add base64 lib
Export our base64 decoding and encoding functions to Lua.

Ticket: #7074
2 weeks ago
Jason Ish 7a936cb486 base64: expose no padding and padding optional variants
A no padding option is provided as a mode, as its a variant suitable
for encoding and decoding.

A padding optional function is added that is indifferent to padding
when decoding. This can be useful when you're not sure if padding
exists, and don't really care.
2 weeks ago
Jason Ish ad6d9e0d93 base64: prefix base64 C API with "SC" 2 weeks ago
Jason Ish fd488170c4 lua: update lua to 5.4.7
This version of out Lua crate also supports cross compiling.
2 weeks ago
Victor Julien 38318438d1 doc/userguide: add lua packetlib docs 2 weeks ago
Victor Julien 7226a0b2e7 detect/lua: register built-in libs also for open setup
Register internal libs for the case where loading external modules is allowed.
2 weeks ago
Victor Julien cdd2f56cfe doc: remove old lua packet methods 2 weeks ago
Victor Julien 48ef7aab64 lua: remove old lua payload/packet calls
Moving forward the packetlib is to be used.

Ticket: #7488.
2 weeks ago
Victor Julien fbb6b0de61 lua: add initial suricata.packet lib
Example:

```
local packet = require "suricata.packet"

function init (args)
    local needs = {}
    return needs
end

function match (args)
    p = packet.get()
    payload = p:payload()
    ts = p:timestring()

    for line in payload:gmatch("([^\r\n]*)[\r\n]+") do
        if line == "GET /index.html HTTP/1.0" then
            ipver, srcip, dstip, proto, sp, dp = p:tuple()
            SCLogNotice(string.format("%s %s->%s %d->%d (pcap_cnt:%d) match! %s", ts, srcip, dstip, sp, dp, p:pcap_cnt(), line));
            return 1
        end
    end

    return 0
end
```

Methods:
`get` creates the packet object.
`payload` returns the packet payload as a buffer
`packet` returns the whole packet (includes headers)
`pcap_cnt` returns the `pcap_cnt` (pcap file mode only)
`tuple` returns various fields: srcip, dstip, proto, sp, dp
`sp` returns source port
`dp` returns destination port
`timestamp` returns time as 2 numbers: seconds and microseconds
`timestring_legacy` returns a timestamp as a string (like fastlog)
`timestring_iso8601` returns a iso8601 compat timestring (like eve)

Ticket: #7488.
2 weeks ago
Victor Julien 4dbd6ccd2c detect/lua: minor code cleanup 2 weeks ago
Victor Julien 3f53d657a9 detect/lua: remove unused tls flag 2 weeks ago
Victor Julien d545b4d860 threads: fix int as pointer warning for pthread_exit
clang-tidy:
        warning: integer to pointer cast pessimizes optimization opportunities

Since the returned code of -1 was never read, just return NULL.
2 weeks ago
Victor Julien 3d46c18474 commandline: fix undefined behavior in parsing list-keywords
Flagged by clang-tidy.
2 weeks ago
Victor Julien b285e433ef flow/queue: remove circular dependency
flow-queue.h included flow.h, but was also included by it.
2 weeks ago
Victor Julien f81e8f02c1 includes: explicitly check for and include mm_malloc.h
Helps code analyzers.
2 weeks ago
Victor Julien b6a610df26 build: pass LOCAL_STATE_DIR through autoconf.h
Helps tooling like cppcheck, clang-tidy.
2 weeks ago
Victor Julien 5928adc852 detect: remove unused arg from get detect tx 2 weeks ago
Victor Julien ce948040a1 detect: don't cast void on void func 2 weeks ago
Victor Julien 1b541c31cb detect: remove unused args from detect flag storing 2 weeks ago
Victor Julien 322d3a4021 detect/mpm: fix chop flag passed on incorrectly 2 weeks ago
Victor Julien 7b878a3805 autoconf: don't pretent we can build w/o autoconf.h
Helps tooling like cppcheck and clang-tidy.
2 weeks ago
Victor Julien a8ba1e9896 macros: provide fallbacks for common macros
These are set by our build-system, but some tools like cppcheck don't use that.
2 weeks ago
Eric Leblond 22a71e7317 af-packet: code cleaning
clang-tidy did detect the -1 return value was not compatible with
TmEcode enum.
2 weeks ago
Jason Ish 0165830c70 github-ci: update actions/cache
The version we have been using will be deprecated soon.

https://github.blog/changelog/2024-12-05-notice-of-upcoming-releases-and-breaking-changes-for-github-actions/#actions-cache-v1-v2-and-actions-toolkit-cache-package-closing-down
2 weeks ago
AlirezaPourchali 60dd0ec8a5 doc/userguide: fix typo
Issue: #7540

fixed doc/userguide/performance/hyperscan.rst
fixed doc/userguide/performance/runmodes.rst
2 weeks ago
Alice Akaki 73455179d7 detect/integers: add support for negated strings when enum is used
function detect_parse_uint_enum can parse strings like !bind_request

Ticket: #7513
2 weeks ago
Philippe Antoine ef044b208c dcerpc: prevent integer underflow
in case a fragment has a length lesser than DCERPC_HDR_LEN

Fixes: 9daf8528b7 ("dcerpc: tidy up code")

Ticket: 7548
3 weeks ago
Adam Kiripolsky d9a6d5dc46 dpdk/rss: add rte_flow rss support for mlx5
The configuration of this rule is the same as for ixgbe driver except
the hash function is not RTE_ETH_HASH_FUNCTION_DEFAULT but
RTE_ETH_HASH_FUNCTION_TOEPLITZ.

The syntax in dpdk-testpmd for this rule with attributes:
	port index == 0
	used rx queue indices == 0 1 2 3
	<hash_key> == 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6
end queues 0 1 2 3 end key <hash_key> key_len 40 func toeplitz / end"

Ticket: 7337
3 weeks ago
Adam Kiripolsky 97750bf5b5 dpdk/rss: add rte_flow rss support for ice
ice driver requires 2 rte_flow rules for matching and
redistributing incoming traffic with RSS.

The rules set up by iceDeviceSetRSSFlowIPv4() and
iceDeviceSetRSSFlowIPv6() are different only in the pattern
("pattern eth / ipv4 / end" or "pattern eth / ipv6 / end"
in dpdk-testpmd syntax) and in the hash type (ipv4 src dst / ipv6 src
dst). ice will match all ipv4 or ipv6 traffic independently of
following l4 protocol. The rules can not have queues configured,
implicitly they will use all queues available.
The hash function is set to RTE_ETH_HASH_FUNCTION_TOEPLITZ.
The hash key can not be set.

The syntax in dpdk-testpmd for rule to match all ipv4 traffic
with attributes:
	port index == 0
is as follows:
"flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4
end queues end func toeplitz / end"
(queues need to be set to NULL)

Ticket: 7337
3 weeks ago
Adam Kiripolsky 2296b3ba76 dpdk/rss: add rte_flow rss support for ixgbe
ixgbe driver requires different configuration of RSS rte_flow
rule than i40e, with just one generic rule matching all traffic.

The generic rule configured by DeviceCreateRSSFlowGeneric() has pattern
equivalent to "pattern eth / end" in dpdk-testpmd syntax. The rule must
have rx queues configured. The rule hashes traffic to different queues
based on ipv4 and ipv6 hash types (ipv4 src dst / ipv6 src dst).
The hash key is 40 bytes long  symmetric hash key. ixgbe does not
support any other hash function than RTE_ETH_HASH_FUNCTION_DEFAULT.

The syntax in dpdk-testpmd for this rule with attributes:
	port index == 0
	used rx queue indices == 0 1 2 3
	<hash_key> == 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6
end queues 0 1 2 3 end key <hash_key> key_len 40 func default / end"

Ticket: 7337
3 weeks ago
Adam Kiripolsky ffe0cf88e4 dpdk/rss: move and change rss rte_flow functions
Move and adjust the base of  RSS configuration from util-dpdk-i40e.c to
a new file that can be later utilized by other cards.

RSS configuration can be configured via rte_flow rules. This is useful
for possible future features such as specific header offload
(vxlan, nvgre) also implemented via rte_flow rules, as rte_flow
rules can be chained via groups and priorities.

i40e uses multiple different rte_flow rules to setup RSS. At first,
function DeviceSetRSSFlowQueues() is used to setup rx queues.
This rule matches all types of traffic, so the equivalent
to dpdk-testpmd pattern would be "pattern end"
This rule can not contain hash types (ipv4, ipv6 etc.) nor hash key.
The hash function used here is RTE_ETH_HASH_FUNCTION_DEFAULT.

The syntax in dpdk-testpmd for this rule with attributes:
	port index == 0
	used rx queue indices == 0 1 2 3
is as follows:
"flow create 0 ingress pattern end actions rss queues 0 1 2 3 end
func default / end"

The other rules configured by i40eDeviceSetRSSFlowIPv4() and
i40eDeviceSetRSSFlowIPv6() match specific type of traffic by l4 protocol
(none, TCP, UDP, SCTP). For example, pattern to match l3 ipv4 with l4
tcp traffic in dpdk-testpmd syntax would be equivalent of
"pattern eth / ipv4 / tcp / end".
These rules can not have rx queues configured, but have hash types
(l3 src and dst address). This means that the traffic distribution
is affected only by l3 addresses, independent of the l4 specifics.

Also these pattern matching rules have symmetric 6d5a
hash key configured. The length of the key is dependent on DPDK version.
The hash function (either RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ or
RTE_ETH_HASH_FUNCTION_TOEPLITZ, depending on DPKD version) used
in these rules hashes symmetricaly due to the symmetric hash key.

The syntax in dpdk-testpmd for rule to match ipv4-tcp traffic with
attributes:
	port index == 0
	<hash_key> == 52 bytes long 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types
ipv4-tcp l3-src-only l3-dst-only end queues end key <hash_key>
key_len 52 func toeplitz / end"
(queues need to be set to NULL)

Ticket: 7337
3 weeks ago
Philippe Antoine e47f4f997d fuzz: init reverse before calling AppLayerProtoDetectGetProto
Completes commit fec06f8ac3

The 2 callers in suricata itself already do that
3 weeks ago
Victor Julien a533f44915 af-packet: clean up IPS config check
Don't emmit generic error statements on things that are not errors. Instead,
for cases where (part of) the config is missing, use the defaults and log
only a more detailed explanation at the 'config' level.

Minor code cleanups.
3 weeks ago
dependabot[bot] d4330ef149 github-actions: bump actions/upload-artifact from 4.5.0 to 4.6.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](6f51ac03b9...65c4c4a1dd)

---
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>
4 weeks ago
dependabot[bot] 7692926036 github-actions: bump github/codeql-action from 3.28.0 to 3.28.8
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.0 to 3.28.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.0...v3.28.8)

---
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>
4 weeks ago
dependabot[bot] b6e59258be
github-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](1e68e06f1d...13ce06bfc6)

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

Signed-off-by: dependabot[bot] <support@github.com>
4 weeks ago
Jeff Lucovsky cbda276aeb output: Log ethernet type
Issue 7129

When configured with the existing "ethernet" switch, include the ether
type in the output.

This is most useful with anomaly records indicating unknown ethertypes.
4 weeks ago
Jeff Lucovsky beec1eac2f doc/decode-events: new: unknown event description
Issue: 7129

Document the unknown ethertype event.
4 weeks ago
Jeff Lucovsky e9128e66e6 doc/threshold: Threshold keyword clarifications
Issue: 7129
4 weeks ago
Jeff Lucovsky 123b36b9f5 decode/ethertype: Event on unknown ethertype
Issue: 7129

Create a decode/engine event if unknown ethertypes are observed.
4 weeks ago
Philippe Antoine d9ac7489db http: remove obsolete comment
In preparation of libhtp rust
4 weeks ago
Philippe Antoine 4d2a3c0057 http: minor cleanups for unit tests
In preparation of libhtp rust

Mainly adding some const
4 weeks ago
Philippe Antoine 0d4f2e1a09 http: minor cleanups for log
In preparation of libhtp rust

Mainly adding some const
4 weeks ago
Philippe Antoine 44a363f2f9 http: minor cleanups for lua
In preparation of libhtp rust

Mainly adding some const
4 weeks ago
Ilya Bakhtin fec06f8ac3 protodetect: simplify code since DCERPC UDP detection is improved
Protocol detection code is simplified. Removed dependency on explicit
alproto constants from the common part of code that must not be aware of
the each specific protocol features.

Ticket - 7111
4 weeks ago
Ilya Bakhtin 27f0db7526 protodetect/dcerpc: improve DCERPC UDP probing parser
Several additional checks are added to the probing parser to avoid false
detection of DNS as DCERPC

Ticket - 7111
4 weeks ago
Victor Julien dc44f5e1d2 detect: remove unused SignatureInitData member 4 weeks ago
Victor Julien 022941d780 detect/prefilter: fix prefilter setup
If `prefilter` is used it should override automatic fast pattern
selection.

Fixes: d6b56929d3 ("detect: set mpm/prefilter during signature parsing")

Ticket: #7523.
4 weeks ago