Commit Graph

15250 Commits (fb497bfa7e275474e880727aa232aac0f09db1e9)
 

Author SHA1 Message Date
Victor Julien fb497bfa7e detect/bytejump: test cleanup
Just one used during debugging.
1 year ago
Victor Julien 101452056d detect/bytejump: don't reuse content flag
To avoid future problems with overlapping flag values, give bytejump
its own DETECT_BYTEJUMP_OFFSET_VAR flag.

The values are currently not overlapping, so this patch should have
no side effects.
1 year ago
Victor Julien de5b8ae0b4 detect/analyzer: print int keyword values correctly
To avoid negative values to be misrepresented.

Bug: #6615.
1 year ago
Victor Julien b8440a0917 jsonbuilder: add set_int for signed ints
Bug: #6615
1 year ago
Victor Julien 0ab32be355 eve/stream: add sb main region size; segment count
Gives more detail about memory use.
1 year ago
Jason Ish 7d95c4c017 output-json-dns: remove un-needed includes 1 year ago
Jason Ish 97744b7ea7 output-json-alert: remove un-needed includes 1 year ago
Jason Ish c1a8dbcb72 doc/userguide: document dns.query.name, dns.answer.name
With some other minor cleanups in the DNS keyword section.
1 year ago
Jason Ish f91122e0e8 dns: replace usage of rs_dns_tx_get_query_name with SCDnsTxGetQueryName
SCDnsTxGetQueryName was introduced to allow for getting the query name
in responses as well as requests, so covers the functionality of
rs_dns_tx_get_query_name.
1 year ago
Jason Ish 482325e28b dns: add dns.query.name sticky buffer
This buffer is much like dns.query_name but allows for detection in both
directions.

Feature: #6497
1 year ago
Jason Ish 5f99abb0cb dns: add dns.answer.name keyword
This sticky buffer will allow content matching on the answer names.
While ansers typically only occur in DNS responses, we allow the buffer
to be used in request context as well as the request message format
allows it.

Feature: #6496
1 year ago
Jason Ish 9464d0b14a dns: consolidate DNSRequest and DNSResponse to DNSMessage
DNS request and response messages follow the same format so there is
no reason not to use the same data structure for each. While its
unlikely to see fields like answers in a request, the message format
does not disallow them, so it might be interesting data to have the
ability to log.
1 year ago
Jason Ish e2d7a7f877 dns: rustfmt with latest stable 1 year ago
Jason Ish 4620776a30 rustfmt: replace deprecated fn_args_layout with fn_params_layout 1 year ago
Jason Ish 66ff23f9bf detect: rename InspectEngineFuncPtr2 to InspectEngineFuncPtr
Version 1 of the API no longer exists.
1 year ago
Jason Ish b11bb1c412 detect: rename DetectAppLayerInspectEngineRegister2
Rename DetectAppLayerInspectEngineRegister2 to
DetectAppLayerInspectEngineRegister as there is no other variant of
this function, and the versioning with lack of supporting
documentation can lead to confusion.
1 year ago
Jason Ish 50be098839 detect: rename DetectAppLayerMpmRegister2 to DetectAppLayerMpmRegister
The old DetectAppLayerMpmRegister has not been around since 4.1.x.
Rename the v2 of this function to a versionless function as there is no
documentation referring to what the 2 means.
1 year ago
Hadiqa Alamdar Bukhari 774f05d83d detect/analyzer: add details to flowbits keyword
Task #6309
1 year ago
Stephen Donnelly 879db3dbc3 endace: Fix source-dag timestamps
Bug: #6618.

Fix Endace ERF to SCTime_t timestamp conversion

Fix typo preventing compilation with --enable-dag
1 year ago
Victor Julien 3456dea276 doc/userguide: update guidance on 5 to 6 upgrading
TCP memory use can be higher than expected in certain configs.

Ticket: #6552.
1 year ago
Jason Ish 93071501b5 github-ci/formatting: update to Ubuntu 22.04
Update the formatting CI job to Ubuntu 22.04 to get a newer version of
clang-format, in this case clang-format-14.
1 year ago
Jason Ish 5ebae1e8ed clang-format.sh: prefer clang-format-14
Add clang-format-14 as the preferred version, this is the default on
Ubuntu 22.04.
1 year ago
Jeff Lucovsky 40e3514e7a cppcheck: Address cpcheck report of an FP
Issue: 6527

Address the FP raised by cppcheck -- note that although the code
corectly checks to ensure that `to_shift != &sb->reqion`, the logic was
detected as a FP. Rework the code to eliminate the FP.
1 year ago
Jeff Lucovsky 8b2fd434fc cppcheck/detect: Address cppcheck memory leak
Issue: 6527

Ensure that the `map->string` memory isn't leaked following an error
return from `HashListTableAdd`
1 year ago
Philippe Antoine 1b5e04bee3 http2: do not have leading space for response line
Ticket: 6547
1 year ago
Shivani Bhardwaj 75471dd69b detect/flowbits: remove DETECT_FLOWBITS_CMD_NOALERT
DETECT_FLOWBITS_CMD_NOALERT is misleading as it gives an impression that
noalert is a flowbit specific command that'll be used and dealt with at
some point but as soon as noalert is found in the rule lang, signature
flag for noalert is set and control is returned. It never gets added to
cmd of the flowbits object.
1 year ago
Shivani Bhardwaj 34858808c1 detect-engine: use flag SIG_FLAG_MPM_NEG
The flag SIG_FLAG_MPM_NEG is set before whitelisting the rules. Make it
better by checking for the flag in the beginning and return immediately.
1 year ago
Shivani Bhardwaj 47c9a14543 detect-engine: use bool return type 1 year ago
Shivani Bhardwaj bd41b31005 detect: rename SigAddressPrepare fns to SigPrepare
There is nothing Address specific going on in the preparations.
Stage 1: Preprocessing happens. Sigs classified as IP Only, Masks
applied, content specific limits applied, etc and sig array built.
Stage 2: Sigs grouped by IPOnly, ports and protocols.
Stage 3: Decoder Events SGH built.
Stage 4: File flags set, sig grouping done per prefilter, etc.
1 year ago
Shivani Bhardwaj b9540df5ad doc: clarify IP-only with iprep 1 year ago
Victor Julien c82d93490c github/action: fix Debian 12 intermittent failures
Parallel builds caused issues during `cargo vendor`. So do just a single
thread build.

 make[4]: Entering directory '/__w/suricata/suricata/rust'
cbindgen --config /__w/suricata/suricata/rust/cbindgen.toml \
	--quiet --output /__w/suricata/suricata/rust/dist/rust-bindings.h
CARGO_HOME="/github/home/.cargo"  /usr/bin/cargo vendor
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
ERROR: Couldn't execute `cargo metadata` with manifest "/__w/suricata/suricata/rust/Cargo.toml": Metadata(Output { status: ExitStatus(unix_wait_status(25856)), stdout: "", stderr: "    Blocking waiting for file lock on package cache\n    Blocking waiting for file lock on package cache\nerror: failed to download `adler v1.0.2`\n\nCaused by:\n  unable to get packages from source\n\nCaused by:\n  failed to parse manifest at `/github/home/.cargo/registry/src/github.com-1ecc6299db9ec823/adler-1.0.2/Cargo.toml`\n\nCaused by:\n  no targets specified in the manifest\n  either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n" })
ERROR: Couldn't generate bindings for /__w/suricata/suricata/rust.
make[4]: *** [Makefile:597: dist/rust-bindings.h] Error 1
make[4]: *** Waiting for unfinished jobs....
1 year ago
Victor Julien 332c2ea470 detect/content-inspect: improve header docs 1 year ago
Victor Julien 06c809573b detect/content-inspect: optimize struct layout
Move members used by DetectEngineContentInspection() to the same cache line.
1 year ago
Victor Julien 0014077a36 detect: optimize struct layout
Move reference count to top of DetectEngineThreadCtx, to move it to the
same cache line as the other members that are checked first in Detect().
1 year ago
Victor Julien 53591702aa detect/bytemath: pass match ctx directly
Adjust includes to enable this.
1 year ago
Victor Julien e2fbcf9654 detect/payload: remove unneeded pointer reset
DetectEngineThreadCtx::replist is managed elsewhere.
1 year ago
Victor Julien 6db02563f1 detect/isdataat: optimize recursion mismatches
Since recursive content matching goes through the buffer from left to
right, it is possible to bail early when isdataat is part of the
recursive checking. If `isdataat:50,relative` fails for offset 10, it
will surely also fail for offset 20. So break inspection in such cases.

The exception is for dynamic isdataat, where the value is determined
by a prior byte_extract that may be updated during the recursion.
1 year ago
Victor Julien c19d11ff0d detect/content-inspect: flatten branches
Flatten else branches after terminating ifs.
1 year ago
Victor Julien 4cce7ba48b detect/content-inspect: localize recursion counting
Use stack local var instead of DetectEngineThreadCtx member. Instead
setup a stack local struct that both counts and holds the limit. Make sure
the limit is a const so we can avoid rereading it.

This is part of an effort to reduce the size of the DetectEngineThreadCtx
structure and reduce the number of memory writes to it. Additionally, it
is part of an effect to reduce the number of places where detection
tracks various forms of state.
1 year ago
Victor Julien 97f78e1b49 detect/content-inspect: reduce scope of internal func 1 year ago
Victor Julien e9b33c48f0 detect/base64: move content inspection logic
Integrate with rest of content inspect code.
1 year ago
Victor Julien 6a01f40d40 detect/krb5.sname: use new content inspect entry 1 year ago
Victor Julien c9ab95cbe2 detect/dns.query: use new content inspect entry 1 year ago
Victor Julien d73cce478c detect/content-inspect: add entry for InspectionBuffer
This is a convinience addition to abstract away the internals of
the InspectionBuffer in keyword specific detection code.
1 year ago
Victor Julien b357532e7e detect/content-inspect: switch type of enum 1 year ago
Victor Julien 1f265d9d79 detect/content-inspect: assist branch prediction
Hitting the recursion limit should be rare.
1 year ago
Victor Julien b1fa975503 detect/content-inspect: remove const casting 1 year ago
Victor Julien 0ba4b297df detect/content-inspect: pass const to inspect func 1 year ago
Victor Julien a7c9028f01 detect/content-inspect: reduce scope of variables 1 year ago
Stephen Donnelly 0850e3d137 util/time: Improve usecs handling in time macros
Fix SCTIME_ADD_SECS zeroing subsecond part

When adding s seconds to SCtime_t ts, don't zero out the ts.usecs field.

Issue: 6584

Fix SCTIME_FROM_TIMESPEC garbage microseconds part

When converting nanosecond to microseconds divide by 1000 instead
of multiplying by 1000.

Issue: 6585
1 year ago