Commit Graph

18177 Commits (e5994deb23296254e285471103065bf875bfbf1e)
 

Author SHA1 Message Date
Jeff Lucovsky 0af7793410 output: Display ethertype properly
Ethertype values are now converted from network format to host format
before display occurs. Displayed values are now in hex instead of
integers.

Without this change, ethertype values such as 0xfbb7 are
displayed in decimal as: 47099 (0xb7fb).

The actual value is 64439 (0xfbb7); all logged ether_type values
will be displayed in host order in decimal format. This example
will log the ether type as 64439

Issue: 7855
10 months ago
Victor Julien f0121d8bc2 stats: improve wait loops
Check bail condition before entering conditional wait.

CID 1554236: (#1 of 1): Indefinite wait (BAD_CHECK_OF_WAIT_COND)
dead_wait: A wait is performed without ensuring that the condition is not already satisfied while holding lock ThreadVars_.ctrl_mutex. This can cause unnecessary waiting if the notification happens before the lock is acquired.

CID 1554238: (#1 of 1): Indefinite wait (BAD_CHECK_OF_WAIT_COND)
dead_wait: A wait is performed without ensuring that the condition is not already satisfied while holding lock ThreadVars_.ctrl_mutex. This can cause unnecessary waiting if the notification happens before the lock is acquired.
10 months ago
Juliana Fajardini ff96c52541 doc/install: fix minor typo 10 months ago
Juliana Fajardini a3bd4ec324 doc: remove outdated GITGUIDE 10 months ago
Victor Julien acef961645 pop3: improve parsing
Improve multiline commands and SASL auth.

Work around missing support in crate for empty server challenge and SASL base64 data.

Ticket: #7709.
10 months ago
Lukas Sismis 7ca95eeec0 github-ci: build-test DPDK v23.11.x and v24.11.x
Ticket: 6382
10 months ago
Lukas Sismis ee0b08692c github-ci: stop testing obsolete DPDK versions, bump up the rest 10 months ago
Philippe Antoine c99e159341 detect/files: support protocols only over udp
Ticket: 7973

Files were supported on both TCP and UDP. But file detection keywords
such as file.data made signatures loading fail if the signature
was using an app-layer protocol that enabled on udp only, even
if the signatures could run smoothly.
10 months ago
Jason Ish 5e2dc9ace3 ike: don't log empty server objects 10 months ago
Jason Ish 2848061d0d scripts/evedoc.py: handle union types in schema
Update EVE documentation script to handle union types like:

    "type": ["string", "number"]
10 months ago
Jason Ish ced0c2c466 doc: upgrade notes for changes to ike output 10 months ago
Jason Ish 2d86412f46 ike: log attributes as objects
IKE attributes are an array of TLV style objects, this means there can
be duplicate types seen on the wire. However, Suricata logs these as a
mapping with the type as the key. This can result in the JSON
containing duplicate keys.

To address this, log the attributes as an array of objects, allow
duplicates to exist, for example:

  "client": {
    "proposals": [
      {
        "sa_life_duration": "Unknown",
        "sa_life_duration_raw": 86400,
      }
    }
  }

is now logged as:

  "client": {
    "proposals": [
      {"key": "sa_life_duration", "value": "Unknown", "raw": 86400}
    ]
  }

Also adds `"version": 2` to each IKE record to note the change of
format from previous versions.

Ticket: #7902
10 months ago
Jason Ish b543e28402 ike/detect: info log message should be debug 10 months ago
Lukas Sismis 27383f878d dpdk: supress a warning of the bond function
DPDK Bonding API has been changed in DPDK version 23.11 where
the old *slave* API was marked as deprecated and the new *member*
API was marked as experimental.
This was unfortunately executed by marking both API variants
at the same time. The deprecated version is removed from the follow
up versions while the experimental version will become stable
in the next DPDK releases. This is based on a policy in DPDK where
an API change needs to merged in main for 1 stable release before
removing the experimental flag.

In DPDK 24.11 this has been fixed and warning supression is not
added.

Ticket: 7009
10 months ago
Lukas Sismis 8f63094744 dpdk: fix the CPU exclude logic
The exclude function incorrectly performs a XOR operation. While it
works when the worker cores occupy all cores, it is not the correct
operation. For example, when a core is affined to only management
and not worker threads, the XOR operation affines it to the worker set.
(1 XOR 0 -> 1, where in fact the desired outcome is 0)

Ticket: 7975
10 months ago
Philippe Antoine a393147415 rust: restrict visibility of reexported suricata_sys structs 10 months ago
Philippe Antoine fa322e3dc2 rust: remove unneeded cbindgen exclusions 10 months ago
Philippe Antoine 958344787f rust: bindgen FileAppendData
Ticket: 7667
10 months ago
Philippe Antoine 811d28cc6b rust: bindgen util-spm-bs.h
for SCBasicSearchNocaseIndex

Ticket: 7667
10 months ago
dependabot[bot] 3efab2bb7e github-actions: bump github/codeql-action from 3.30.3 to 3.30.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.3 to 3.30.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.30.3...v3.30.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
10 months ago
dependabot[bot] a714ba8522 github-actions: bump ossf/scorecard-action from 2.4.2 to 2.4.3
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](05b42c6244...4eaacf0543)

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

Signed-off-by: dependabot[bot] <support@github.com>
10 months ago
Juliana Fajardini b6283ad05f decode/ipv6: apply clang-format changes 10 months ago
Juliana Fajardini a247801743 decode/ipv6: minor clean-ups
Remove unused debug-like statements (commented out 'printf's).
10 months ago
Juliana Fajardini ee7f01c83f decode/ipv6: flag invalid pkt w/ wrong ip ver event
When the decoder finds a packet with wrong IP version for
IPv4|IPv6-in-IPv6 tunnels, it would set an event, but wouldn't flag the
packet invalid. This fixes that.

Bug #7964
10 months ago
Jeff Lucovsky 0e547b9519 rust/conf: Accept xiB unit suffixes
Update the memval to recognize
- kb and kib
- mb and mib
- gb and gib
as equivalent.
10 months ago
Philippe Antoine 56e08c9134 mime: retain some stateful data for quoted-printable
In case a sequence like =3D is split over 2 calls to SCSmtpMimeParseLine

Ticket: 7950
10 months ago
Jason Ish 5c921507af ci/codeql: rename codeql python test
To differentiate from other CodeQL workflows.
10 months ago
Jason Ish 14448ecb0f ci/codeql: enable for rust, enable unittests
Unit tests need to be enabled for the src/tests files to be scanned.

Also rename, to differentiate from the Python CodeQL workflow.
10 months ago
Juliana Fajardini 6f441ee435 decode/ipv4: minor clean-ups
Remove unused debug-like statements (commented out 'printf's).
10 months ago
Juliana Fajardini 426955782c schema: add descriptions to capture stats counters
Task #6434
10 months ago
Juliana Fajardini 3642594e14 schema: add descriptions to decoder stats counters
Continuation of
Task #7793
10 months ago
Juliana Fajardini 42d563f83e schema: fix typos s/ERPSAN/ERSPAN 10 months ago
Jeff Lucovsky 846eb44a9d ci/mt: Include MT tests in CI workflows
Add the MT live tests to the CI workflow.
10 months ago
Jeff Lucovsky 51c9609c7c mt/ci: Add MT live test
Add MT live test capability:
- multi-tenant.sh: harness that sets up and steps through MT steps
- suricata-mt.yaml: Adds MT capability to Suricata
- tenant-1.yaml: Per-tenant configuration file
10 months ago
Victor Julien 4764152567 output/filestore: reformat 10 months ago
Victor Julien d5f9261ef5 output/filestore: fix coverity issue 1427652
Fix PathMerge error handling bringing back CID 1427652.

The result doesn't need to be checked as we're already in an error state
and the path is only used to print to the user.
10 months ago
Victor Julien 81c348e4ed output/filestore: minor comment fixup 10 months ago
Victor Julien 6d8fc10b8f output/filestore: improve path handling
** CID 1666422:       Error handling issues  (CHECKED_RETURN)
/src/output-filestore.c: 350           in GetLogDirectory()

_____________________________________________________________________________________________
*** CID 1666422:         Error handling issues  (CHECKED_RETURN)
/src/output-filestore.c: 350             in GetLogDirectory()
344             log_base_dir = default_log_dir;
345         }
346         if (PathIsAbsolute(log_base_dir)) {
347             strlcpy(out, log_base_dir, out_size);
348         } else {
349             const char *default_log_prefix = SCConfigGetLogDirectory();
>>>     CID 1666422:         Error handling issues  (CHECKED_RETURN)
>>>     Calling "PathMerge" without checking return value (as is done elsewhere 19 out of 21 times).
350             PathMerge(out, out_size, default_log_prefix, log_base_dir);
351         }
352     }
353
354     static bool InitFilestoreDirectory(const char *dir)
355     {
10 months ago
Victor Julien 178f3baf4a detect: improve path handling for tenants
** CID 1666423:       Error handling issues  (CHECKED_RETURN)
/src/detect-engine.c: 4413           in DetectEngineMultiTenantSetup()

_____________________________________________________________________________________________
*** CID 1666423:         Error handling issues  (CHECKED_RETURN)
/src/detect-engine.c: 4413             in DetectEngineMultiTenantSetup()
4407                         goto bad_tenant;
4408                     }
4409                     SCLogDebug("tenant id: %u, %s", tenant_id, yaml_node->val);
4410
4411                     char yaml_path[PATH_MAX] = "";
4412                     if (path) {
>>>     CID 1666423:         Error handling issues  (CHECKED_RETURN)
>>>     Calling "PathMerge" without checking return value (as is done elsewhere 19 out of 21 times).
4413                         PathMerge(yaml_path, PATH_MAX, path, yaml_node->val);
4414                     } else {
4415                         strlcpy(yaml_path, yaml_node->val, sizeof(yaml_path));
4416                     }
4417                     SCLogDebug("tenant path: %s", yaml_path);
4418
10 months ago
Juliana Fajardini 21b13c5d2f decode/ipv6: actually set ipv6 pkt too small event
The event exists, but it was never set.
Disabled the existing rule, to avoid flooding.

Bug #7963
10 months ago
Victor Julien 0948a32470 runmodes: limit thread count consistently
Limit to 1024 like with worker threads.

General minor cleanups.
11 months ago
Victor Julien f6b67a8d50 napatech: update thread count callback to match API change 11 months ago
Victor Julien 7807b47ca0 pfring: update thread count callback to match API change
Use uint16_t internally and in parsing as well.
11 months ago
Victor Julien b633887d83 runmodes: adapt to uint16_t thread count 11 months ago
Victor Julien fbf75f2e7d runmodes: let thread count callback return uint16_t
It will be a long time before we need more than 64k threads.

Update capture methods.
11 months ago
Victor Julien 5817afa356 runmodes: work around format truncation warnings
util-runmodes.c: In function 'RunModeSetLiveCaptureAutoFp':
util-runmodes.c:167:30: warning: '%02d' directive output may be truncated writing between 2 and 11 bytes into a region of size between 3 and 4 [-Wformat-truncation=]
  167 |                          "%s#%02d-%s", thread_name, thread+1,
      |                              ^~~~
util-runmodes.c:167:26: note: directive argument in the range [-2147483647, 2147483647]
  167 |                          "%s#%02d-%s", thread_name, thread+1,
      |                          ^~~~~~~~~~~~
util-runmodes.c:167:26: note: assuming directive output of 1 byte
util-runmodes.c:166:17: note: 'snprintf' output 5 or more bytes (assuming 16) into a destination of size 5
  166 |                 snprintf(printable_threadname, strlen(thread_name)+5+strlen(dev),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167 |                          "%s#%02d-%s", thread_name, thread+1,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  168 |                          dev);
      |                          ~~~~
util-runmodes.c: In function 'RunModeSetLiveCaptureWorkersForDevice':
util-runmodes.c:280:88: warning: '%02d' directive output may be truncated writing between 2 and 10 bytes into a region of size between 3 and 4 [-Wformat-truncation=]
  280 |             snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev), "%s#%02d-%s",
      |                                                                                        ^~~~
util-runmodes.c:280:84: note: directive argument in the range [1, 2147483647]
  280 |             snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev), "%s#%02d-%s",
      |                                                                                    ^~~~~~~~~~~~
util-runmodes.c:280:84: note: assuming directive output of 1 byte
util-runmodes.c:280:13: note: 'snprintf' output 5 or more bytes (assuming 15) into a destination of size 5
  280 |             snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev), "%s#%02d-%s",
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  281 |                      thread_name, thread+1, live_dev);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util-runmodes.c:275:91: warning: '%s' directive output may be truncated writing likely 1 or more bytes into a region of size between 0 and 1 [-Wformat-truncation=]
  275 |             snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev), "%s#01-%s",
      |                                                                                           ^~
util-runmodes.c:275:84: note: assuming directive output of 1 byte
  275 |             snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev), "%s#01-%s",
      |                                                                                    ^~~~~~~~~~
util-runmodes.c:275:13: note: 'snprintf' output 5 or more bytes (assuming 7) into a destination of size 5
  275 |             snprintf(printable_threadname, strlen(thread_name)+5+strlen(live_dev), "%s#01-%s",
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  276 |                      thread_name, live_dev);
      |                      ~~~~~~~~~~~~~~~~~~~~~~

Ticket: #7905.
11 months ago
Victor Julien 1f46e2ba09 nfq: work around format truncation warning
Ticket: #7905.
11 months ago
Victor Julien 7bab39d447 output/lua: work around format truncation warnings
Use PathMerge to improve path handling and address these warnings:

output-lua.c: In function 'OutputLuaLogInitSub':
output-lua.c:657:48: warning: '%s' directive output may be truncated writing likely 1 or more bytes into a region of size between 0 and 4096 [-Wformat-truncation=]
  657 |     int ret = snprintf(path, sizeof(path),"%s%s%s", dir, strlen(dir) ? "/" : "", conf->val);
      |                                                ^~
output-lua.c:657:43: note: assuming directive output of 1 byte
  657 |     int ret = snprintf(path, sizeof(path),"%s%s%s", dir, strlen(dir) ? "/" : "", conf->val);
      |                                           ^~~~~~~~
output-lua.c:657:15: note: 'snprintf' output 1 or more bytes (assuming 4098) into a destination of size 4096
  657 |     int ret = snprintf(path, sizeof(path),"%s%s%s", dir, strlen(dir) ? "/" : "", conf->val);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ticket: #7905.
11 months ago
Victor Julien 99a79b595f eve/stats: work around format truncation warnings
This appears to be a FP. Work around it to allow for using this warning
as an error.

output-json-stats.c: In function 'StatsToJSON':
output-json-stats.c:253:65: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
  253 |                     snprintf(deltaname, sizeof(deltaname), "%s%s", stat_name, delta_suffix);
      |                                                                 ^
output-json-stats.c:253:21: note: 'snprintf' output 1 or more bytes (assuming 8) into a destination of size 7
  253 |                     snprintf(deltaname, sizeof(deltaname), "%s%s", stat_name, delta_suffix);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
output-json-stats.c:314:69: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
  314 |                         snprintf(deltaname, sizeof(deltaname), "%s%s", stat_name, delta_suffix);
      |                                                                     ^
output-json-stats.c:314:25: note: 'snprintf' output 1 or more bytes (assuming 8) into a destination of size 7
  314 |                         snprintf(deltaname, sizeof(deltaname), "%s%s", stat_name, delta_suffix);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ticket: #7905.
11 months ago
Victor Julien a57643c70b eve/alert: work around format truncation warning
This appears to be a FP. Work around it to allow for using this warning
as an error.

output-json-alert.c: In function 'AlertJsonReference':
output-json-alert.c:188:44: warning: '%s' directive output may be truncated writing likely 1 or more bytes into a region of size between 0 and 1 [-Wformat-truncation=]
  188 |         snprintf(kv_store, size_needed, "%s%s", kv->key, kv->reference);
      |                                            ^~
output-json-alert.c:188:41: note: assuming directive output of 1 byte
  188 |         snprintf(kv_store, size_needed, "%s%s", kv->key, kv->reference);
      |                                         ^~~~~~
output-json-alert.c:188:9: note: 'snprintf' output 1 or more bytes (assuming 3) into a destination of size 1
  188 |         snprintf(kv_store, size_needed, "%s%s", kv->key, kv->reference);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ticket: #7905.
11 months ago