Commit graph

6667 commits

Author SHA1 Message Date
Tim Wojtulewicz
9cb54f5d44 clang-format: Force zeek-config.h to be earlier in the config ordering 2021-09-25 11:52:55 -07:00
Tim Wojtulewicz
e5b163290d Merge remote-tracking branch 'origin/topic/vern/remove-uu'
* origin/topic/vern/remove-uu:
  fix up for linking w/ doc update
  documentation update
  script simplification that removes an unnecessary &is_assigned
  removing -uu functionality and associated script analysis now no longer needed
2021-09-24 10:31:56 -07:00
Robin Sommer
dd5d6e1756 Merge branch 'topic/foxds/dcerpc_auth' of ssh://github.com/fox-ds/zeek
* 'topic/foxds/dcerpc_auth' of ssh://github.com/fox-ds/zeek:
  Fix protocol forwarding in dce_rpc-auth
  Fix protocol forwarding in dce_rpc-auth
2021-09-23 17:50:00 +02:00
Robin Sommer
c5ebe299b1 Merge remote-tracking branch 'origin/topic/justin/conn-remove-empty-string-allocation'
* origin/topic/justin/conn-remove-empty-string-allocation:
  Avoid allocation of 0 length strings on new conns
2021-09-23 12:32:42 +02:00
Tim Wojtulewicz
a49dcc8954 Merge remote-tracking branch 'origin/topic/johanna/dpd-packet-limit'
* origin/topic/johanna/dpd-packet-limit:
  PIA - switch size to int64_t
  Introduce dpd_max_packets
2021-09-22 12:16:56 -07:00
Vern Paxson
509428a9dc removing -uu functionality and associated script analysis now no longer needed 2021-09-22 11:17:28 -07:00
Justin Azoff
971808ba3f Avoid allocation of 0 length strings on new conns
New connections already do

    conn_val->Assign(6, val_mgr->EmptyString());

This second assignment was effectively doing

    conn_val->Assign(6, "")

for all new connections, causing a new empty ZeekString to be allocated.

On a pcap containing 100% syn packets this gives a noticeable perf improvement.

    Benchmark #1: zeek.orig -r /data/pcaps/scan.pcap
      Time (mean ± σ):     47.082 s ±  0.547 s    [User: 57.555 s, System: 9.114 s]
      Range (min … max):   46.516 s … 47.834 s    5 runs

    Benchmark #2: zeek -r /data/pcaps/scan.pcap
      Time (mean ± σ):     45.260 s ±  0.378 s    [User: 55.438 s, System: 8.537 s]
      Range (min … max):   44.783 s … 45.789 s    5 runs

    Summary
      'zeek -r /data/pcaps/scan.pcap' ran
        1.04 ± 0.01 times faster than 'zeek.orig -r /data/pcaps/scan.pcap'
2021-09-22 07:53:03 -04:00
Christian Kreibich
10e8d36340 Remove unused HashKey constructor and reorder for consistency
One of the HashKey constructors was only used in the old CompHash code.
This aso reorders some constructors and the destructor for readability.
2021-09-20 17:51:43 -07:00
Christian Kreibich
4d58b98c70 Refactor CompHash class to use new HashKey buffering features
This preserves the previous hash key buffer layout (so the testsuite still
passes) and overall approach but gets rid of the codepath for writing singleton
serializations. This code path required a fourth switch block over all types
(besides reads, writes, and size computation) and was inconsistent with the one
for writing non-atomic types.
2021-09-20 17:51:43 -07:00
Christian Kreibich
b6a11a69db Add debug string and ODesc support to HashKey class
This allows tracing of hash key buffer reservations, reads, and writes via a new
debug stream, and supports printing a summary of a HashKey object via
Describe(). The latter comes in handy e.g. in TableVal::Describe() (where
including the hash key is now available but commented out).
2021-09-20 17:51:43 -07:00
Christian Kreibich
82822b1e07 Refactor HashKey class to support read/write operations
This preserves the optimization of storing values directly in the key_u member
union when feasible, and using a variable size buffer otherwise. It also adds
bounds-checking for that buffer, moves size arguments to size_t, decouples
construction from hash computation, emulates the tagging feature found in
SerializationFormat to assist troubleshooting, and switches feasible
reinterpret_casts to static_casts.
2021-09-20 17:51:43 -07:00
Christian Kreibich
2585ccd873 Add unit tests for memory helpers 2021-09-20 17:51:43 -07:00
Christian Kreibich
c5cceaf5ad Add memory sizing/alignment helpers to util.cc/h
This functionality previously lived in the CompHash class, with one difference:
this removes a discrepancy between the offset aligner and the memory pointer
aligner/padder. The size aligner used to align the provided offset and then add an
additional alignment size (for example, 1 aligned to 4 wouldn't yield 4 but 8).
Like the memory aligners it now only rounds up as needed.

Includes unit tests.
2021-09-20 17:51:43 -07:00
Christian Kreibich
5fc8d89897 Ensure table/set HashKey buffer reservation and writes happen in same order
This takes the existing sorting for table index hashkeys we had in place during
hash key writes and applies it also during buffer size reservation. It changes
the approach slightly: the underlying map now points to the TableVal entry index
vals directly, rather than to the numerical index into an additional list that
gets built up to store those indexes. Doing so removes the need for that list.
2021-09-20 17:51:43 -07:00
Robin Sommer
31d3fb0f6c Merge https://github.com/gpotter2/zeek.
Changes during merge:
  - Add dedicated test (w/ trace "client_timestamp_enabled.pcapng" from Cloudshark)
  - Change types from signed to unsigned.
  - Add cast for bit-shifting operand.
  - clang-format run
2021-09-20 11:41:29 +02:00
gpotter2
d4db9bf6d0 Add TSval and TSecr to TCPSyn 2021-09-17 11:35:16 +02:00
Tim Wojtulewicz
30aa4621c5 Minor fixes for build problems after reformatting 2021-09-16 15:36:09 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Tim Wojtulewicz
194cb24547 Fixes for includes ahead of reformatting 2021-09-16 15:35:11 -07:00
Tim Wojtulewicz
a3ba7f638b GH-386: Add clang-format config and scripts 2021-09-16 15:35:11 -07:00
Vern Paxson
81e8354ada still more nit-squashing 2021-09-14 16:04:04 -07:00
Vern Paxson
10d8c2fe6b avoiding using back() for an empty std::string 2021-09-14 13:51:46 -07:00
Vern Paxson
57fdef573c additional tweaks to address some compiler warnings 2021-09-14 11:45:50 -07:00
FOX-DS
13960a98ad Fix protocol forwarding in dce_rpc-auth 2021-09-14 03:09:16 -04:00
Vern Paxson
693fc14eb2 tweaks to address some compiler warnings 2021-09-13 19:55:26 -07:00
Vern Paxson
7f3993ca0e tweaks to address concerns flagged by Coverity 2021-09-13 12:57:15 -07:00
Tim Wojtulewicz
8414d13030 Merge remote-tracking branch 'origin/topic/vern/vector-hole-loops'
* origin/topic/vern/vector-hole-loops:
  fix for looping over vectors with holes per https://github.com/zeek/zeek/issues/1763
  btest for https://github.com/zeek/zeek/issues/1763
2021-09-08 12:04:56 -07:00
Tim Wojtulewicz
b7e264f8ef Merge remote-tracking branch 'origin/topic/seth/tsv-logs-utf8-by-default'
* origin/topic/seth/tsv-logs-utf8-by-default:
  Fix mis-usage of string::append that leads to an overflow
  Use json_escape_utf8 for all utf8 data in ODesc
  Switch the TSV Zeek logs to be UTF8 by default.
2021-09-08 12:04:13 -07:00
Vern Paxson
196b8767e8 fixes for vector coercion overflows, typing, and holes 2021-09-08 10:23:39 -07:00
Vern Paxson
a67897135e factoring out logic to check for overflows during coercions 2021-09-08 10:23:39 -07:00
Vern Paxson
38578a2ea3 low-level cleanups found by code review 2021-09-08 10:23:39 -07:00
Vern Paxson
8bc04d3593 additional conversions of size() to empty() checks that were missed previously 2021-09-08 10:23:39 -07:00
Vern Paxson
9d38946a95 indentation nit 2021-09-08 10:23:39 -07:00
Vern Paxson
bd7edd27fd flag loop that has slightly subtle logic 2021-09-08 10:23:38 -07:00
Vern Paxson
d58573adb1 use ## to start major sections 2021-09-08 10:23:38 -07:00
Vern Paxson
b6daf14868 a number of low-level tweaks from code review 2021-09-08 10:23:38 -07:00
Vern Paxson
c10737d168 use std::find_if rather than explicit loop 2021-09-08 10:23:38 -07:00
Vern Paxson
d609a11312 switch simple loops that don't need indices to being iterator-based 2021-09-08 10:23:38 -07:00
Vern Paxson
ffd1905f90 use container empty() rather than size() where appropriate 2021-09-08 10:23:38 -07:00
Vern Paxson
f89ed411cf updates for usage issues: support for -uu, maybe/definitely distinctions 2021-09-08 10:23:38 -07:00
Vern Paxson
6726eaa0a9 enable reducer to track folding to enable constant propagation 2021-09-08 10:23:38 -07:00
Vern Paxson
da6ac0b521 switch to ID definition regions; reworked driver functions; more info for reporting uncompilable functions 2021-09-08 10:23:38 -07:00
Vern Paxson
83a0d89caf README for using ZAM 2021-09-08 10:23:38 -07:00
Vern Paxson
906d1fc1f2 the main ZAM code 2021-09-08 10:23:38 -07:00
Vern Paxson
ddac6e5f67 reworking of command-line options related to script optimization 2021-09-08 10:23:38 -07:00
Vern Paxson
4637da37a7 definitions of ZAM operations 2021-09-08 10:23:38 -07:00
Vern Paxson
df3c61120a standalone templator for ZAM operations 2021-09-08 10:23:38 -07:00
Vern Paxson
cffc954905 computing of identifier definition regions 2021-09-08 10:23:38 -07:00
Vern Paxson
16bd121ea0 for parse-only, only do script analysis if looking for usage issues 2021-09-08 10:23:38 -07:00
Vern Paxson
9a9995bdd1 tracking of optimization information associated with identifiers 2021-09-08 10:23:38 -07:00