Commit graph

5077 commits

Author SHA1 Message Date
Arne Welzel
77465a90b5 Merge remote-tracking branch 'jgras/topic/jgras/fix-packet-lag'
* jgras/topic/jgras/fix-packet-lag:
  Introduce get_packet_lag()
  Add btest for get_current_packet_ts()
  Introduce get_current_packet_ts to fix packet lag
2024-12-10 18:26:54 +01:00
Arne Welzel
9034e135d1 Merge remote-tracking branch 'origin/topic/awelzel/fix-dns-binds-complte-typo'
* origin/topic/awelzel/fix-dns-binds-complte-typo:
  DNS/dns_binds_rr: Fix complte to complete typo, switch to count
2024-12-10 09:57:00 +01:00
Christian Kreibich
1c42bfc715 Merge branch 'topic/christian/disconnect-slow-peers'
* topic/christian/disconnect-slow-peers:
  Bump cluster testsuite to pull in Broker backpressure tests
  Expand documentation of Broker events.
  Add sleep() BiF.
  Add backpressure disconnect notification to cluster.log and via telemetry
  Remove unneeded @loads from base/misc/version.zeek
  Add Cluster::nodeid_to_node() helper function
  Support re-peering with Broker peers that fall behind
  Add Zeek-level configurability of Broker slow-peer disconnects
  Bump Broker to pull in disconnect feature and infinite-loop fix
  No need to namespace Cluster:: functions in their own namespace
2024-12-09 23:33:35 -08:00
Tim Wojtulewicz
6e75417032 Merge remote-tracking branch 'origin/topic/vern/CPP-streamlining'
* origin/topic/vern/CPP-streamlining:
  BTest baseline updates for compile-to-C++
  mark ZAM regression BTests as not suitable for compile-to-C++
  fix for -O gen-C++ maintenance helper to skip BTest intermediary files
  introduced simplified initialization for non-standalone -O gen-C++ code tied -O gen-standalone-C++ to use of --optimize-files
  streamline generated -O C++ code by relying on per-function profiles rather than aggregate profile
  when reporting available/unavailble C++ script bodies, flag those that are skipped
  modified AST profiling to mark (and fully skip) non-optimizable functions
  modified merge_types() to skip work if given identical types, which also preserves type names (useful for -O gen-C++)
2024-12-09 12:16:00 -07:00
Tim Wojtulewicz
832b9b6cf0 Merge remote-tracking branch 'origin/topic/timw/python-magic-numbers'
* origin/topic/timw/python-magic-numbers:
  Move python signatures to a separate file
  Add signatures for Python bytecode for 3.8-3.14
2024-12-09 12:09:20 -07:00
Tim Wojtulewicz
ccefd66d37 Move python signatures to a separate file 2024-12-09 11:08:30 -07:00
Arne Welzel
f6c44e3f7a DNS/dns_binds_rr: Fix complte to complete typo, switch to count
From my reading in the docs the complete_flag should only ever be a
single byte, so add a weird for when it is longer, but use count
as the new type.
2024-12-09 19:02:28 +01:00
Jan Grashoefer
6977c07a25 Add btest for get_current_packet_ts() 2024-12-09 16:39:38 +01:00
Arne Welzel
99989b8055 Disable CTU-SME test under TSAN 2024-12-09 09:26:42 +01:00
Christian Kreibich
83d16f9ef4 Bump cluster testsuite to pull in Broker backpressure tests 2024-12-07 00:36:45 -08:00
Christian Kreibich
e6d0c8aa04 Add sleep() BiF.
Yes, really. :-) We've hit the need for this on occasion in very specific
settings and always worked around it via ugly nested loops or similars.
This has ample warning that folks normally won't want to use this.

Not sure that ZAM btest should baseline the number of BiFs.
2024-12-07 00:36:45 -08:00
Vern Paxson
96305aa4aa BTest baseline updates for compile-to-C++ 2024-12-06 16:30:44 -08:00
Vern Paxson
2047ae980a mark ZAM regression BTests as not suitable for compile-to-C++ 2024-12-06 16:28:06 -08:00
Christian Kreibich
ead6134501 Add backpressure disconnect notification to cluster.log and via telemetry
This adds a Broker-specific script to the cluster framework, loaded only when
Zeek is running in cluster mode. It adds logging in cluster.log as well as
telemetry via a metrics counter for Broker-observed backpressure disconnects.

The new zeek_broker_backpressure_disconnects counter, labeled by the neighboring
peer that the reporting node has determined to be unresponsive, counts the
number of unpeerings for this reason.

Here the node "worker" has observed node "proxy" falling behind once:

# HELP zeek_broker_backpressure_disconnects_total Number of Broker peering drops due to a neighbor falling too far behind in message I/O
# TYPE zeek_broker_backpressure_disconnects_total counter
zeek_broker_backpressure_disconnects_total{endpoint="worker",peer="proxy"} 1

Includes small btest baseline update to reflect @load of a new script.
2024-12-06 15:18:05 -08:00
Christian Kreibich
d260a5b7a9 Remove unneeded @loads from base/misc/version.zeek
This module is loaded by the telemetry framework, which we're now loading via
the cluster framework, i.e. also in bare mode. The resulting additional
thread (for creating reporter.log) trips up a number of btest baselines.

version.zeek doesn't use any of the string helper functions.
2024-12-06 15:18:05 -08:00
Christian Kreibich
0010e65f6d Support re-peering with Broker peers that fall behind
This adds re-peering at the Broker level for peers that Broker decided to
unpeer. We keep this at the Broker level since this behavior is specific to
it (as opposed to other cluster backends).

Includes baseline updates for btests that pick up on the new script's @load.
2024-12-06 15:18:05 -08:00
Arne Welzel
079ae460a7 btest/http: Demo StreamEvent analyzer with HTTP::upgrade_analyzers
Relates to #4068
2024-12-06 16:12:40 +01:00
Arne Welzel
51836d08ae protocol: Add StreamEvent analyzer
This analyzer can be used to transport raw stream data for a given
connection to the script layer. For example, adding this analyzer into
the HTTP::upgrade_analyzer or using it to configure a child WebSocket
analyzer allows to get access to the raw stream data in script land
when no more appropriate protocol analyzer is available.
2024-12-06 16:12:40 +01:00
Vern Paxson
e6e31bc25a fix for ZAM "assert" statements potentially evaluating invalid expressions 2024-12-05 14:29:06 -08:00
Arne Welzel
93a3a11d36 Merge remote-tracking branch 'origin/topic/vern/script-opt-keep-asserts'
* origin/topic/vern/script-opt-keep-asserts:
  ZAM documentation updates for asserts and event handler run-time errors
  BTest updates for ZAM support of (optionally) keeping "assert" statements
  command-line options for controlling script optimization: keeping asserts, avoiding event handler coalescence
  ZAM support for option to not coalesce event handlers
  ZAM support for keeping "assert" statements
  internal support for script optimization options for keeping asserts, not consolidating event handlers
  ZAM operations to support asserts
  simplified "assert" by not trying to catch messages that themselves have errors

Fixed some TEST-REQUIRES "${ZEEK_ZAM}" == "1" to use "=" instead to
be /bin/sh compatible.
2024-12-05 21:45:07 +01:00
Tim Wojtulewicz
488ac7ddf0 Merge remote-tracking branch 'origin/topic/vern/zam-pattern-comparison'
* origin/topic/vern/zam-pattern-comparison:
  update of BTest that tracks number of (and validates) ZAM operations
  ZAM support for pattern equality/inequality operations
  expanded ZAM operations for bit-shifting to allow for int/count shift values
  added type coercion for bit-shifting expressions
2024-12-05 11:09:15 -07:00
Arne Welzel
6482a9a8c2 Merge remote-tracking branch 'origin/topic/awelzel/ctu-sme-11-vm-win7ad'
* origin/topic/awelzel/ctu-sme-11-vm-win7ad:
  zeek-testing: Add Experiment-VM-Microsoft-Windows7AD-1 PCAP and baselines
2024-12-05 14:52:14 +01:00
Vern Paxson
678db505fb update of BTest that tracks number of (and validates) ZAM operations 2024-12-04 15:26:13 -07:00
Arne Welzel
df5a6a1ea0 zeek-testing: Add Experiment-VM-Microsoft-Windows7AD-1 PCAP and baselines
The pcap comes from the following dataset [1]:

    CTU-SME-11: a labeled dataset with real benign and malicious network
    traffic mimicking a small medium-size enterprise environment

[1] https://zenodo.org/records/7958259
2024-12-04 20:12:30 +01:00
Arne Welzel
fdde1e9841 cluster/serializer: Add binary-serialization-format
This is a serializer for log records that is using SerialTypes
for serializing and un-serializing rather. Essentially, this is
similar to what broker does except for the envelope.
2024-12-04 12:40:35 +01:00
Arne Welzel
2c52e533b2 Merge remote-tracking branch 'origin/topic/awelzel/spicy-type-convert-asan-options'
* origin/topic/awelzel/spicy-type-convert-asan-options:
  btest/spicy.type-converter: Drop ASAN_OPTIONS from test
2024-12-04 11:14:10 +01:00
Arne Welzel
a2cf0d874a btest/spicy.type-converter: Drop ASAN_OPTIONS from test
...doesn't seem it's needed anymore.

Fixes #4077
2024-12-04 11:11:47 +01:00
Vern Paxson
47a555da87 BTest updates for ZAM support of (optionally) keeping "assert" statements 2024-12-03 10:40:41 -07:00
Tim Wojtulewicz
43e3de5c79 Add interval_as_double argument to control how intervals are converted to JSON 2024-12-03 09:26:08 -07:00
Tim Wojtulewicz
8ff10e4d21 Add btest for round-trip JSON conversion 2024-12-03 09:26:08 -07:00
Vern Paxson
05e913db1b simplified "assert" by not trying to catch messages that themselves have errors 2024-12-02 10:37:10 -08:00
Vern Paxson
2a9c1d900f added new Cluster:: BiFs to script optimization tracking 2024-11-30 08:36:39 -08:00
Johanna Amann
079581aa6b Add TEST-REQUIRES: which jq to two new tests that are using jq 2024-11-27 16:52:15 +00:00
Johanna Amann
3523d393bf Explain why modbus test does not work with the Spicy SSL analyzer
This took a _long_ time to figure out.
2024-11-27 14:51:26 +00:00
Johanna Amann
7b582bc345 Merge remote-tracking branch 'origin/topic/johanna/sqlite-pragmas'
* origin/topic/johanna/sqlite-pragmas:
  Options for SQLite log writer, eliminate duplicate definitions
  Test synchronous/journal mode options for SQLite log writer
  Added default options for synchronous and journal mode
  Support for synchronous and journal_mode
2024-11-27 08:32:08 +00:00
Arne Welzel
3ce41f1eff Merge remote-tracking branch 'origin/topic/awelzel/pluggable-cluster-backends-part2'
* origin/topic/awelzel/pluggable-cluster-backends-part2:
  ci/test.sh: Run doctest with TZ=UTC
  cluster/setup-connections: Switch to Cluster::subscribe(), short-circuit broker
  cluster/serializer: Add Broker based event serializers
  cluster: Add Cluster scoped bifs
  Reporter: Add ScriptLocationScope helper
  init-bare/zeek-setup: Add Cluster::backend const &redef
  broker: Implement cluster::Backend interface
  Broker: Fix some error messages
  broker: Remove MakeEvent(ArgsSpan)
2024-11-26 18:01:28 +01:00
Arne Welzel
c3b30b187e Merge remote-tracking branch 'origin/topic/vern/zam-exception-leaks'
* origin/topic/vern/zam-exception-leaks:
  More robust memory management for ZAM execution - fixes #4052
2024-11-26 17:17:10 +01:00
Vern Paxson
847fcc66d6 More robust memory management for ZAM execution - fixes #4052 2024-11-26 17:05:38 +01:00
Johanna Amann
d592942ccb Test synchronous/journal mode options for SQLite log writer
Also adds some small tweaks and adds the new feature to NEWS.
2024-11-26 12:26:38 +00:00
Arne Welzel
9ec872d161 cluster/serializer: Add Broker based event serializers
This adds the first event serializers that use
broker functionality. Binary and JSON formats.
2024-11-26 12:58:23 +01:00
Arne Welzel
ef04a199c8 cluster: Add Cluster scoped bifs
... and a broker based test using Cluster::publish() and
Cluster::subscribe().
2024-11-26 12:58:23 +01:00
Arne Welzel
40a780bb24 Merge remote-tracking branch 'origin/topic/awelzel/test-init-hooks-plugin'
* origin/topic/awelzel/test-init-hooks-plugin:
  btest/plugins: Add a plugin testing Init and Done hooks
2024-11-22 18:38:06 +01:00
Tim Wojtulewicz
24d913c0a9 Disable core.expr-execption btest under ZAM to fix CI builds
Relates to #4052.
2024-11-22 15:28:14 +01:00
Arne Welzel
39b43e8dd6 btest/plugins: Add a plugin testing Init and Done hooks
Follow-up for #4047.
2024-11-22 13:37:03 +01:00
Arne Welzel
97f05b2f8c Merge remote-tracking branch 'origin/topic/awelzel/pluggable-cluster-backends-part1'
* origin/topic/awelzel/pluggable-cluster-backends-part1:
  btest: Test Broker::make_event() together with Cluster::publish_hrw()
  btest: Add cluster dir, minimal test for enum value
  broker: Add shim plugin adding a backend component
  zeek-setup: Instantiate backend::manager
  cluster: Add to src/CMakeLists.txt
  cluster: Add Components and ComponentManager for new components
  cluster/Backend: Interface for cluster backends
  cluster/Serializer: Interface for event and log serializers
  logging: Introduce logging/Types.h
  SerialTypes/Field: Allow default construction and add move constructor
  DebugLogger: Add cluster debugging stream
  plugin: Add component enums for pluggable cluster backends
  broker: Pass frame to MakeEvent()
2024-11-22 12:53:23 +01:00
Arne Welzel
baca6ba769 btest: Test Broker::make_event() together with Cluster::publish_hrw() 2024-11-22 10:43:55 +01:00
Arne Welzel
de9d39cd01 btest: Add cluster dir, minimal test for enum value 2024-11-22 10:43:55 +01:00
Arne Welzel
6fb73aa9da broker: Add shim plugin adding a backend component
For broker, this isn't really functioning, but at least makes the
CLUSTER_BACKEND_BROKER enum available.
2024-11-22 10:43:55 +01:00
Arne Welzel
9883b3a917 Merge remote-tracking branch 'origin/topic/awelzel/sumstats-non-cluster-final-epoch'
* origin/topic/awelzel/sumstats-non-cluster-final-epoch:
  sumstat/non-cluster: Move last epoch processing to zeek_done()
2024-11-21 16:39:18 +01:00
Christian Kreibich
b24c5c0e46 Order rule traversal in RuleMatcher::Match() operations by Rule index
This ordering fixes a test failure we're seeing on Alpine for the
signatures/tcp-end-of-match btest, since discrepancies in rule match traversal
could lead to discrepancies in corresponding event ordering.

It looks safe to rely on across platforms since the index is driven by signature
load order, which shouldn't deviate. If this somehow doesn't hold in the future,
we'll only wind up with a test failure, not incorrect match behavior.

(Correction to 2e03fbb8b0, which I pushed
accidentally.)
2024-11-18 09:45:09 -08:00