Commit graph

15875 commits

Author SHA1 Message Date
Johanna Amann
f31e39efe2 Merge remote-tracking branch 'origin/master' into topic/johanna/spicy-tls
* origin/master: (73 commits)
  Spicy: allow providing file id in zeek::file_begin
  Spicy: allow providing file id in zeek::file_begin
  Update doc submodule [nomail] [skip ci]
  Spicy: allow providing file id in zeek::file_begin
  Spicy: allow providing file id in zeek::file_begin
  Bump cmake submodule for INCLUDE_DIRS fix
  Update doc submodule [nomail] [skip ci]
  Integrate review feedback
  Add jq to final.Dockerfile
  TableVal: Replace raw subnets/pattern_matcher with unique_ptr
  TablePatternMatcher: Drop Insert()/Remove(), use Clear()
  TableType: Simplify and inline Is...Index tests
  NEWS: Add small table[pattern] section
  Expr/Val: Add support for in set[pattern]
  zeek.bif: Implement table_pattern_matcher_stats() bif for introspection
  DFA: Extract inner Stats struct from DFA_State_Cache
  Expr: Implement string in table[pattern] of X
  RE: Remove RE_DisjunctiveMatcher and re-use MatchAll()
  TablePatternMatcher: Use const StringValPtr& instead of const StringVal*
  Val: Move TablePatternMatcher into detail namespace
  ...
2023-11-27 14:55:57 +00:00
Johanna Amann
5baa2841e8 Merge remote-tracking branch 'origin/topic/johanna/spicy-allow-providing-file-ids'
* origin/topic/johanna/spicy-allow-providing-file-ids:
  Spicy: allow providing file id in zeek::file_begin
2023-11-23 17:20:30 +00:00
Johanna Amann
9a4de4e9fc Spicy: allow providing file id in zeek::file_begin
Minor update of testcase
2023-11-23 17:17:48 +00:00
Johanna Amann
883190207a Spicy: allow providing file id in zeek::file_begin
Address more review feedback; skip hashing in cases where a file id is
already provided.
2023-11-23 15:54:19 +00:00
zeek-bot
cc646f625f Update doc submodule [nomail] [skip ci] 2023-11-23 00:12:41 +00:00
Johanna Amann
45c558af1e Spicy: allow providing file id in zeek::file_begin
Address feedback of GH-3470:
 minor changes of C++ code, unify test cases
2023-11-22 16:31:40 +00:00
Johanna Amann
ae0b328826 Spicy: allow providing file id in zeek::file_begin
Allow spicy parsers to generate their own file IDs and provide them to
Zeek. This duplicates functionality that is currently possible (and
used) by some binpac-based analyzers. One example for an analyzer
creating its own file IDs is the SSL analyzer.
2023-11-22 14:51:53 +00:00
Arne Welzel
a092fe6a8a Bump cmake submodule for INCLUDE_DIRS fix 2023-11-22 11:29:00 +01:00
Arne Welzel
e0cf206732 Merge remote-tracking branch 'origin/topic/neverlord/avoid-openssl-header-deps'
* origin/topic/neverlord/avoid-openssl-header-deps:
  Integrate review feedback
  Avoid OpenSSL header dependencies

Added NEWS during merge and removed never set OPENSSL_INCLUDE_DIR reference
in main CMakeLists.txt.
2023-11-22 10:35:27 +01:00
zeek-bot
6d6a95e761 Update doc submodule [nomail] [skip ci] 2023-11-22 00:22:12 +00:00
Dominik Charousset
d0d543ec3d Integrate review feedback 2023-11-21 17:56:18 +01:00
Arne Welzel
5ef5733fcc Merge remote-tracking branch 'matti/topic/matti/docker-jq'
* matti/topic/matti/docker-jq:
  Add jq to final.Dockerfile
2023-11-21 14:32:40 +01:00
Matti Bispham
5d7cc06e3a Add jq to final.Dockerfile 2023-11-21 22:23:37 +09:00
Arne Welzel
f95ec84d77 Merge remote-tracking branch 'origin/topic/awelzel/pattern-tables-reuse-compile-set'
* origin/topic/awelzel/pattern-tables-reuse-compile-set:
  TableVal: Replace raw subnets/pattern_matcher with unique_ptr
  TablePatternMatcher: Drop Insert()/Remove(), use Clear()
  TableType: Simplify and inline Is...Index tests
  NEWS: Add small table[pattern] section
  Expr/Val: Add support for in set[pattern]
  zeek.bif: Implement table_pattern_matcher_stats() bif for introspection
  DFA: Extract inner Stats struct from DFA_State_Cache
  Expr: Implement string in table[pattern] of X
  RE: Remove RE_DisjunctiveMatcher and re-use MatchAll()
  TablePatternMatcher: Use const StringValPtr& instead of const StringVal*
  Val: Move TablePatternMatcher into detail namespace
  TablePatternMatcher: Use unique_ptr
  IndexType: Add IsPatternIndex(), like IsSubNetIndex()
  btest: Add test for pattern tables and when
  Reuse CompileSet() instead of || string formatting
  script optimization support for using strings to index table[pattern] values
  BTests for indexing "table[pattern] of T" with strings
  support for indexing "table[pattern] of T" with strings to get multi-matches
2023-11-21 12:00:51 +01:00
Arne Welzel
cf9afd7b77 TableVal: Replace raw subnets/pattern_matcher with unique_ptr 2023-11-21 11:16:17 +01:00
Arne Welzel
36c43d2aa3 TablePatternMatcher: Drop Insert()/Remove(), use Clear()
Also move Clear() when assigning into more generic Assign() function.
2023-11-21 11:16:16 +01:00
Arne Welzel
e68194f2df TableType: Simplify and inline Is...Index tests 2023-11-21 11:15:58 +01:00
Arne Welzel
96a0312ad2 NEWS: Add small table[pattern] section 2023-11-21 10:34:17 +01:00
Arne Welzel
c113b9b297 Expr/Val: Add support for in set[pattern] 2023-11-21 10:34:17 +01:00
Arne Welzel
e39f280e3d zeek.bif: Implement table_pattern_matcher_stats() bif for introspection
Provide a script accessible way to introspect the DFA stats that can be
leveraged to gather runtime statistics of the underlying DFA. This
re-uses the existing MatcherStats used by ``get_matcher_stats()``.
2023-11-21 10:34:17 +01:00
Arne Welzel
3f240e0f0a DFA: Extract inner Stats struct from DFA_State_Cache
This makes it possible to forward declare the class in Val.h which
otherwise seems difficult.
2023-11-21 10:34:17 +01:00
Arne Welzel
c72d4a4427 Expr: Implement string in table[pattern] of X
Not sure how useful this is (and the implementation isn't optimized in
any way), but seems reasonable for consistency.

Vern suggested that set[pattern] can already be achieved via
set_to_regex(), so left out any set[pattern] variants.
2023-11-21 10:34:17 +01:00
Arne Welzel
9ae99cdc44 RE: Remove RE_DisjunctiveMatcher and re-use MatchAll()
Seems we can just open code the CompileSet() usage in the TablePatternMatcher
helper without indirecting through another class. Further, add the collection
of indices into MatchAll() rather than duplicating its code in
MatchDisjunction(). Doesn't seem like MatchAll() is used widely.
2023-11-21 10:34:16 +01:00
Arne Welzel
501b582bc7 TablePatternMatcher: Use const StringValPtr& instead of const StringVal* 2023-11-21 10:34:16 +01:00
Arne Welzel
c426304c27 Val: Move TablePatternMatcher into detail namespace
There's anyway only prototype in the headers, so detail seems better
than the public zeek namespace.
2023-11-21 10:34:16 +01:00
Arne Welzel
43a5473919 TablePatternMatcher: Use unique_ptr 2023-11-21 10:34:16 +01:00
Arne Welzel
c8bab6a0ec IndexType: Add IsPatternIndex(), like IsSubNetIndex() 2023-11-21 10:34:16 +01:00
Arne Welzel
074f51fc96 btest: Add test for pattern tables and when 2023-11-21 10:34:16 +01:00
Arne Welzel
b55e1a122e Reuse CompileSet() instead of || string formatting 2023-11-21 10:34:16 +01:00
Vern Paxson
61fcca8482 script optimization support for using strings to index table[pattern] values 2023-11-21 10:34:16 +01:00
Vern Paxson
fd1094a184 BTests for indexing "table[pattern] of T" with strings 2023-11-21 10:34:15 +01:00
Vern Paxson
699549eb45 support for indexing "table[pattern] of T" with strings to get multi-matches 2023-11-21 10:34:15 +01:00
Arne Welzel
a5a79d3f3a Merge remote-tracking branch 'origin/topic/awelzel/3453-dnssec-ed448-ed25519'
* origin/topic/awelzel/3453-dnssec-ed448-ed25519:
  DNS: Add Ed25519 and Ed448 enum values to parser
2023-11-21 10:08:34 +01:00
Arne Welzel
2dfbfdc4aa Merge remote-tracking branch 'origin/topic/awelzel/possible-re-fixes'
* origin/topic/awelzel/possible-re-fixes:
  RE_Match_State: Do not reset current_pos for every Match() call
2023-11-21 10:06:26 +01:00
Arne Welzel
c58f3149b3 Merge remote-tracking branch 'origin/topic/awelzel/3455-sub-gsub-anchors'
* origin/topic/awelzel/3455-sub-gsub-anchors:
  frameworks/software: Fix stale value used for stripping
  strings.bif/sub,gsub: Respect anchors in pattern
2023-11-21 10:04:49 +01:00
zeek-bot
1bfeb548db Update doc submodule [nomail] [skip ci] 2023-11-21 00:12:29 +00:00
Arne Welzel
81aa6b14fd DNS: Add Ed25519 and Ed448 enum values to parser
We already had these declared in dns/const.zeek, so extend the parser
as well to avoid raising weirds and add some test pcaps:

   $ dig @8.8.8.8 DNSKEY ed448.no
   $ dig @8.8.8.8 ed448.no +dnssec

And the same for the ed25519.no domain.

Closes #3453
2023-11-17 19:56:47 +01:00
Arne Welzel
56830948e3 RE_Match_State: Do not reset current_pos for every Match() call
This seems like a bug: If one feeds one byte at a time, current_pos
is being reset for every byte, possibly reporting the wrong offsets
in the accepted_matches map.
2023-11-17 18:16:20 +01:00
Arne Welzel
b0a200a5dc Merge remote-tracking branch 'origin/topic/vern/zam-EH-coalesce'
* origin/topic/vern/zam-EH-coalesce:
  BTest updates to accommodate event handler coalescence differences
  BTests for testing that event handler coalescence operates as expected
  coalescing of event handlers (ZAM optimization)

Minor fixups during merge as commented on the PR.
2023-11-17 18:05:32 +01:00
Tim Wojtulewicz
de77b034c2 Merge remote-tracking branch 'origin/topic/timw/opensuse-ci-fixes'
* origin/topic/timw/opensuse-ci-fixes:
  CI: Install missing packages on opensuse
2023-11-17 09:24:44 -07:00
Tim Wojtulewicz
a3ad1a24f1 CI: Install missing packages on opensuse 2023-11-17 09:24:15 -07:00
Arne Welzel
37113b4de6 frameworks/software: Fix stale value used for stripping
There was some confusion around which value was used subsequent to a strip(),
but sub not respecting anchors make it appear to work. Also seems that the
`\(?` part seems redundant.
2023-11-17 14:37:28 +01:00
Arne Welzel
e339e93e69 strings.bif/sub,gsub: Respect anchors in pattern
Anchors within pattern passed to sub() or gsub() were previously ignored,
replacing any occurrence of '<text>' even when '^<text>' was used as a
pattern.

This is a pretty user-visible change (and we even have anchored patterns
within the base scripts), but seems "the right thing to do".

Relates to #3455
2023-11-17 14:37:25 +01:00
Arne Welzel
d9b8154c4e Merge remote-tracking branch 'origin/topic/awelzel/3455-do-split-string-2'
* origin/topic/awelzel/3455-do-split-string-2:
  strings.bif/do_split_string: Pass bol and eol to MatchPrefix()
  RE_Matcher: Add MatchPrefix with bol/eol control
2023-11-17 13:01:47 +01:00
Vern Paxson
fc2796a5a4 BTest updates to accommodate event handler coalescence differences 2023-11-16 13:04:35 -08:00
Vern Paxson
39e1f71ebf BTests for testing that event handler coalescence operates as expected 2023-11-16 13:03:40 -08:00
Vern Paxson
3d21d80dac coalescing of event handlers (ZAM optimization) 2023-11-16 12:58:28 -08:00
Arne Welzel
98d9089a8f strings.bif/do_split_string: Pass bol and eol to MatchPrefix()
This allows better control of BOL and EOL. MatchPrefix() / LongestMatch()
always start with BOL.

Closes #3455
2023-11-16 08:36:08 +01:00
Arne Welzel
a3bd3e4c50 RE_Matcher: Add MatchPrefix with bol/eol control 2023-11-16 08:25:57 +01:00
zeek-bot
4751f6f31e Update doc submodule [nomail] [skip ci] 2023-11-15 00:10:11 +00:00