Commit graph

16055 commits

Author SHA1 Message Date
Vern Paxson
f866252e5e remove redundant record coercions 2023-04-10 11:42:48 -07:00
zeek-bot
aaefdcca55 Update doc submodule [nomail] [skip ci] 2023-04-09 00:19:52 +00:00
Tim Wojtulewicz
51ca741d92 Merge remote-tracking branch 'origin/topic/timw/continue-processing-math'
* origin/topic/timw/continue-processing-math:
  Fix a long-standing bug in the math around continue_processing
  Add is_processing_suspended BIF
2023-04-08 11:23:06 -07:00
zeek-bot
6d9a452136 Update doc submodule [nomail] [skip ci] 2023-04-07 00:20:15 +00:00
Tim Wojtulewicz
e3a25f1458 Merge remote-tracking branch 'origin/topic/timw/1280-packet-filtered-stats'
* origin/topic/timw/1280-packet-filtered-stats:
  Add NEWS entries for filtered packet statistics and telemetry
  Report packet statistics via the telemetry framework
  Add optional packet filtered statistics for packet sources
2023-04-06 13:46:42 -07:00
Tim Wojtulewicz
50c3d0f474 Add NEWS entries for filtered packet statistics and telemetry 2023-04-06 13:41:09 -07:00
Tim Wojtulewicz
67802e711a Report packet statistics via the telemetry framework 2023-04-06 13:41:09 -07:00
Tim Wojtulewicz
95b6069c6e Fix a long-standing bug in the math around continue_processing 2023-04-06 10:49:05 -07:00
Tim Wojtulewicz
adcaa459c9 Add is_processing_suspended BIF 2023-04-06 10:36:21 -07:00
Tim Wojtulewicz
ae3d6a4df0 Add optional packet filtered statistics for packet sources 2023-04-06 09:47:04 -07:00
Arne Welzel
8a23671b21 Merge remote-tracking branch 'origin/topic/awelzel/add-debian-bookworm'
* origin/topic/awelzel/add-debian-bookworm:
  ci: Add debian-12 / bookworm
2023-04-06 12:55:44 +02:00
Arne Welzel
c390c0203d iosource/Manager: Fix poll_interval updating using not-yet valid IsLive()
Testing io_poll_interval_live tweaks with @dopheide-esnet on a Myricom based
system to reduce CPU usage showed no visible effect.

It turns out, the pkt_src->IsLive() call used to update poll_interval is only
valid *after* calling ->Register() with the source. The conditional updating
of the poll_interval introduced in 4fa3e4b9b4
never worked out how it was intended to.

The fix ensures that

* we actually use a poll_interval of 10 in the live case
* changing io_poll_interval_live does have an effect

This is a bit of a major change due to lowering the default poll_interval
by a magnitude, but that seemed to have been the intention always. It's also
tunable via redef, so worst case it can be adapted via configuration.

As reference, with the default a Pcap::non_fd_timeout of 20usec *and* a
poll_interval of 100, theoretically we'd be trying to ask a non-selectable
packet source 500000 per second for a new packet. This is not a likely packet
rate that a single worker would currently observe or manage to process.
2023-04-06 11:44:50 +02:00
Arne Welzel
49e964d711 ci: Add debian-12 / bookworm
The next version of Debian (bookworm) had a hard-freeze on
2023-03-16. Seems reasonable to have it in CI now.
2023-04-05 12:57:22 +02:00
Arne Welzel
d5739982f8 Merge remote-tracking branch 'origin/topic/awelzel/reporter-generic-message-deprecation'
* origin/topic/awelzel/reporter-generic-message-deprecation:
  scan.l: Support @pragma, specifically push/pop ignore-deprecations
  Switch deprecations to reporter->Deprecation()
  Reporter: Add dedicated Deprecation() method
  Desc: Add obj_desc_short()
2023-04-05 10:39:42 +02:00
Arne Welzel
d9611132e8 scan.l: Support @pragma, specifically push/pop ignore-deprecations
This allows to ignore-deprecations as follows:

    @pragma push ignore-deprecations
    print r$deprecated;
    @pragma pop

A bit of infrastructure is put in place for the push and pop, but
nothing overly generalized for future pragmas.
2023-04-05 10:24:30 +02:00
Tim Wojtulewicz
cfd726afbd Merge remote-tracking branch 'origin/topic/timw/gen-zam-warnings'
* origin/topic/timw/gen-zam-warnings:
  Update gen-zam submodule for std::move warnings
2023-04-04 09:05:46 -07:00
Tim Wojtulewicz
0d4f842190 Update gen-zam submodule for std::move warnings 2023-04-04 09:02:05 -07:00
Arne Welzel
384b4de764 Switch deprecations to reporter->Deprecation()
Removes a bit of reliance around the magic DoLog() rendering at the
cost of needing to open-code some of it. The new obj_desc_short()
helper makes that acceptable, though.
2023-04-04 16:05:08 +02:00
Arne Welzel
2f93592c6f Reporter: Add dedicated Deprecation() method
Minimally, provide a way to funnel all deprecations through
reporter->Deprecation() instead of various Warning() invocations.
2023-04-04 16:05:08 +02:00
Arne Welzel
c18366eacf Desc: Add obj_desc_short()
Same as obj_desc() but use the short version and do not include the
location information by default. New method instead of bool parameters
for readability.
2023-04-04 16:05:08 +02:00
Arne Welzel
92f09f0db7 Merge remote-tracking branch 'origin/topic/vern/when-cleanup'
* origin/topic/vern/when-cleanup:
  test suite update for minor change in "when" error messages
  removed skeletal (non-functioning) "when" support from ZAM
  simplify WhenInfo and Trigger classes given removal of old capture semantics
  introduced notion of light-weight Frame clones
  changed function_ingredients struct to FunctionIngredients class with accessors

Renamed Frame::LightClone() to Frame::CloneForTrigger() during merge.
2023-04-04 10:02:01 +02:00
zeek-bot
5ab86131fa Update doc submodule [nomail] [skip ci] 2023-04-04 00:20:19 +00:00
Arne Welzel
fbdc433386 file_analysis/File: Report overflowing chunks as weird and discard/truncate
This is one level above the Reassembler where we still have information
about the file and source. A weird entry may looks as follows:

    1679759398.237353  ... file_offset_overflow    FXPLGt4SeMmlMKahJc: offset=fffffffffffffff7 len=10      F       zeek    HTTP
2023-04-03 16:45:29 +02:00
Arne Welzel
ea80f21e1d Reassem: Reject blocks overflowing 64bit upper
The reassembler logic isn't wrap around safe, so just truncate or
reject such blocks. For files specifically, a byte offset in the
2**64 bytes represents 16EiB which is the maximum size supported
by BTRFS or NTFS (and probably nothing we'd ever see in practice).
2023-04-03 16:45:03 +02:00
Arne Welzel
1858c6b0c2 Merge remote-tracking branch 'origin/topic/vern/CPP-Apr23-maint'
* origin/topic/vern/CPP-Apr23-maint:
  addressed static analysis concern about possible null pointer
  tweaks for "-O C++" of BTest's with conditional code

Backed out changes from at-if-lambda during merge and instead skip
test when running with ZEEK_USE_CPP.
2023-04-03 16:42:18 +02:00
Arne Welzel
7665e808a2 ftp/main: Special case for intermediate reply lines
The medium.trace in the private external test suite contains one
session/server that violates the multi-line reply protocol and
happened to work out fairly well regardless due to how we looked
up the pending commands unconditionally before.

Continue to match up reply lines that "look like they contain status codes"
even if cont_resp = T. This still improves runtime for the OSS-Fuzz
generated test case and keeps the external baselines valid.

The affected session can be extracted as follows:

    zcat Traces/medium.trace.gz | tcpdump -r  - 'port 1491 and port 21'

We could push this into the analyzer, too, minimally the RFC says:

    > If an intermediary line begins with a 3-digit number, the Server
    > must pad the front  to avoid confusion.
2023-04-03 14:05:13 +02:00
Arne Welzel
a12d1e1bc2 Merge remote-tracking branch 'origin/topic/vern/ZAM-Apr23-maint'
* origin/topic/vern/ZAM-Apr23-maint:
  minor ZAM BTest baseline updates
  fixed type mismatch for ssl_certificate_request event
  skip ZAM optimization of invalid scripts
  extended script validation to be call-able on a per-function basis
2023-04-03 13:33:09 +02:00
Arne Welzel
daa6fff154 Merge remote-tracking branch 'origin/topic/awelzel/pkt-src-timeout-setting'
* origin/topic/awelzel/pkt-src-timeout-setting:
  PktSrc: Introduce Pcap::non_fd_timeout
2023-04-03 13:24:30 +02:00
Vern Paxson
910b50ef0d test suite update for minor change in "when" error messages 2023-04-02 11:38:30 -07:00
Vern Paxson
61891e615a removed skeletal (non-functioning) "when" support from ZAM 2023-04-02 11:37:36 -07:00
Vern Paxson
84906171ba simplify WhenInfo and Trigger classes given removal of old capture semantics 2023-04-02 11:36:39 -07:00
Vern Paxson
4af6b52876 introduced notion of light-weight Frame clones 2023-04-02 11:35:15 -07:00
Vern Paxson
0c434ca4f8 changed function_ingredients struct to FunctionIngredients class with accessors 2023-04-02 11:34:16 -07:00
Vern Paxson
b5603fe5bf addressed static analysis concern about possible null pointer 2023-04-01 21:06:42 -07:00
Vern Paxson
2f9272f2d5 tweaks for "-O C++" of BTest's with conditional code 2023-04-01 20:26:55 -07:00
Vern Paxson
da643add2e minor ZAM BTest baseline updates 2023-04-01 12:57:21 -07:00
Vern Paxson
9560e38784 fixed type mismatch for ssl_certificate_request event 2023-04-01 12:56:54 -07:00
Vern Paxson
b16195d130 skip ZAM optimization of invalid scripts 2023-04-01 12:56:23 -07:00
Vern Paxson
3a99e60d1c extended script validation to be call-able on a per-function basis 2023-04-01 12:55:29 -07:00
Arne Welzel
f00d6198af PktSrc: Introduce Pcap::non_fd_timeout
Increasing this value 10x has lowered CPU usage on a Myricom based
deployment significantly with reportedly no adverse side-effects.

After reviewing the Zeek 3 IO loop, my hunch is that previously when
no packets were available, we'd sleep 20usec every loop iteration after
calling ->Process() on the packet source. With current master ->Process()
is called 10 times on a packet source before going to sleep just once
for 20 usec. Likely this explains the increased CPU usage reported.

It's probably too risky to increase the current value, so introduce
a const &redef value for advanced users to tweak it. A middle ground
might be to lower ``io_poll_interval_live`` to 5 and increase the new
``Pcap::non_fd_timeout`` setting to 100usec.

While this doesn't really fix #2296, we now have enough knobs for tweaking.

Closes #2296.
2023-03-31 18:48:08 +02:00
Arne Welzel
5718046b96 Merge branch 'topic/jgras/tunnel-fwd-fix' of https://github.com/J-Gras/zeek
* 'topic/jgras/tunnel-fwd-fix' of https://github.com/J-Gras/zeek:
  Add test cases for Geneve.
  Fix forwarding of tunnelled packets.
2023-03-31 10:39:42 +02:00
Arne Welzel
c1215ca47a Merge remote-tracking branch 'origin/topic/awelzel/val-mgr-list-val-type-list-caching'
* origin/topic/awelzel/val-mgr-list-val-type-list-caching:
  Type: Add TypeManager->TypeList() and use for ListVal()
2023-03-31 10:34:05 +02:00
Jan Grashoefer
65f0a09a83 Add test cases for Geneve. 2023-03-30 22:58:54 +02:00
Tim Wojtulewicz
bcb7bbd129 Merge remote-tracking branch 'origin/topic/timw/packet-analyzer-override-test'
* origin/topic/timw/packet-analyzer-override-test:
  Add reporter framework to core.packet-analyzer-override btest
2023-03-30 13:09:30 -07:00
Jan Grashoefer
073a8a6082 Fix forwarding of tunnelled packets.
This fixes a bug for AYIYA, Geneve and VXLAN forwarding encapsulated
content only if it's longer than their header. A new weird is introduced
to indicate empty tunnels.
2023-03-30 22:07:41 +02:00
Tim Wojtulewicz
d2eaced96a Add reporter framework to core.packet-analyzer-override btest 2023-03-30 12:28:39 -07:00
Arne Welzel
24c606b4df Type: Add TypeManager->TypeList() and use for ListVal()
It turns out that for every ListVal we construct, we also allocate
and construct a new TypeList instance, even though they are all the
same. Pre-create and cache the type instances in a new TypeManager.

The following script runs ~10% faster for me after this change.

    global tbl: table[string] of string;
    global i = 0;
    while ( ++i < 10000000 )
        tbl["a"] = "a";
2023-03-30 21:15:46 +02:00
Tim Wojtulewicz
69b6443ddb Merge remote-tracking branch 'jgras/topic/jgras/packet-fwd-fix'
* jgras/topic/jgras/packet-fwd-fix:
  Consider cap len when forwarding into packet analysis.
2023-03-30 09:52:33 -07:00
Tim Wojtulewicz
67335d92cd Merge remote-tracking branch 'jgras/topic/jgras/packet-analyzer-override-info'
* jgras/topic/jgras/packet-analyzer-override-info:
  Reintroduce info when overriding packet analyzer mappings.
2023-03-30 09:51:12 -07:00
Jan Grashoefer
bfa466f2eb Reintroduce info when overriding packet analyzer mappings.
In #2464 the warning when overriding a packet analyzer mapping was
removed. While a warning seems indeed excessive, some info would still
be nice to have.
2023-03-30 16:19:39 +02:00