Commit graph

389 commits

Author SHA1 Message Date
Vern Paxson
edf276520a make including count of container elements non-optional 2022-04-29 09:03:35 -07:00
Vern Paxson
16c37034de added value_footprint() and global_container_footprints() BiFs 2022-04-28 16:42:14 -07:00
Tim Wojtulewicz
e6e9144da6 Add unit testing for DNS_Mgr and related classes 2022-04-22 13:10:37 -07:00
Vern Paxson
18fe9d84f6 bug fix for empty table constructors with &default attributes (plus a typo) 2022-03-31 19:28:23 -07:00
Tim Wojtulewicz
fe935a572f Merge remote-tracking branch 'origin/topic/vern/event-trace'
* origin/topic/vern/event-trace:
  low-level style tweaks
  --event-trace / -E option to generate event trace
  hooks to support event tracing
  classes providing event-tracing/dumping functionality
  provide access to Val internals for event tracing purposes
  set_network_time() BiF in support of event replaying
  low-level naming tweaks / comments / const-ified accessor
2022-03-25 15:31:42 -07:00
Vern Paxson
c3e2871a5e simplification of Val classes now that they don't have to support initialization 2022-03-23 15:36:35 -07:00
Vern Paxson
cde677bd97 provide access to Val internals for event tracing purposes 2022-03-23 10:03:13 -07:00
Tim Wojtulewicz
4f470c24ed String/StringVal: Replace char*/string constructors with string_view 2022-02-04 13:52:04 -07:00
Vern Paxson
d758585e42 updated Bro->Zeek in comments in the source tree 2022-01-24 14:26:20 -08:00
Tim Wojtulewicz
3d9d6e953b Merge remote-tracking branch 'origin/topic/vern/when-lambda'
* origin/topic/vern/when-lambda:
  explicitly provide the frame for evaluating a "when" timeout expression
  attempt to make "when" btest deterministic
  tests for new "when" semantics/errors
  update existing test suite usage of "when" statements to include captures
  update uses of "when" in base scripts to include captures
  captures for "when" statements update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*"
  logic (other than in profiling) for assignments that yield separate values
  option for internal use to mark a function type as allowing non-expression returns
  removed some now-obsolete profiling functionality
  minor commenting clarifications
2022-01-14 14:41:42 -07:00
Johanna Amann
3a3f9af40d Make some StringVal functions const
I noticed these while working on the TLS changes - I do not see a good
reason why they should not be const.
2022-01-14 11:04:11 +00:00
Vern Paxson
f895008c34 captures for "when" statements
update Triggers to IntrusivePtr's and simpler AST traversal
introduce IDSet type, migrate associated "ID*" types to "const ID*"
2022-01-07 14:50:35 -08:00
Tim Wojtulewicz
edf90a51e4 GH-1624: Migrate check_and_promote and a few Expr methods to IntrusivePtr 2022-01-07 12:33:54 -07:00
Tim Wojtulewicz
9af6b2f48d clang-format: Set penalty for breaking after assignment operator 2021-09-27 10:49:48 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Vern Paxson
a67897135e factoring out logic to check for overflows during coercions 2021-09-08 10:23:39 -07:00
Johanna Amann
509b501e1b Merge remote-tracking branch 'origin/master' into topic/johanna/gh-859 2021-06-30 10:36:54 +01:00
Vern Paxson
d1334b7bca made RecordVal::AppendField protected: it's low-level & requires knowledge of internals 2021-06-29 10:24:20 -07:00
Johanna Amann
e4b2fa50a9 Merge remote-tracking branch 'origin/master' into topic/johanna/gh-859 2021-06-29 15:09:56 +01:00
Johanna Amann
833168090a Add ability to check if hostname is valid for a specific cert
This commit adds two new bifs, x509_check_hostname and
x509_check_cert_hostname. These bifs can be used to check if a given
hostname which can, e.g., be sent in a SNI is valid for a specific
certificate.

This PR furthermore modifies the ssl logs again, and adds information
about this to the log-file. Furthermore we now by default remove the
server certificate information from ssl.log - I doubt that this is often
looked at, it is not present in TLS 1.3, we do still have the SNI, and
if you need it you have the information in x509.log.

This also fixes a small potential problem in X509.cc assuming there
might be SAN-entries that contain null-bytes.

Baseline update will follow in another commit.
2021-06-29 15:00:48 +01:00
Tim Wojtulewicz
a7fd34375f GH-572: Mark MemoryAllocation() and related methods deprecated 2021-06-28 11:07:58 -07:00
Tim Wojtulewicz
98a9ae9572 Check for -1 return from FieldOffset() in Val::HasField()
Fixes Coverity 1457804
2021-06-28 11:06:16 -07:00
Tim Wojtulewicz
67b45bc502 Merge remote-tracking branch 'origin/topic/vern/ZAM-prep'
* origin/topic/vern/ZAM-prep: (45 commits)
  whoops overlooked the need to canonicalize filenames
  another set of tweaks per review comments
  addressed a number of code review comments
  baseline updates for merge
  support "any" coercions for "-O gen-C++"
  better descriptions for named record constructors
  test suite baseline updates for "-a opt" optimize-AST alternative
  test suite baseline updates for "-a xform" alternative / AST transformation
  error propagation fix for AST reduction
  updates to "-a inline" test suite alternative baseline
  updates for the main test suite baseline
  updates to test suite tests for compatibility with upcoming ZAM functionality
  "-O compile-all" option to specify compilation of inlined functions
  compile inlined functions if they're also used indirectly
  provide ZAM-generated code with low-level access to record fields
  fix for cloning records with fields of type "any"
  direct access for ZAM to VectorVal internal vector
  ZVal constructors, accessors & methods in support of ZAM
  switch ZVal representation of types from Type objects to TypeVal's
  revised error-reporting interface for ZVal's, to accommodate ZAM inner loop
  ...
2021-06-28 11:03:13 -07:00
Luke Cesarz
d29a43fb79 Fix segfault with incomplete connection
Add required HasField check before GetFieldAs call
2021-06-20 07:51:46 -07:00
Vern Paxson
5f4956bf24 provide ZAM-generated code with low-level access to record fields 2021-06-01 08:57:16 -07:00
Vern Paxson
099dc99d2b fix for cloning records with fields of type "any" 2021-06-01 08:52:24 -07:00
Vern Paxson
cd8e16e090 direct access for ZAM to VectorVal internal vector 2021-05-30 19:35:54 -07:00
Vern Paxson
e06d988bfd support for constructing VectorVal's directly from underlying ZVal vectors 2021-05-30 17:58:53 -07:00
Vern Paxson
fb01f6fdef support for ensuring that a vector can be treated as having a homogeneous type 2021-05-30 17:55:03 -07:00
Vern Paxson
f2f041b63b various accessors used by ZAM compiler 2021-05-30 17:16:03 -07:00
Vern Paxson
1f15f53f4b VectorVal methods to leverage ZVal representation 2021-05-05 16:54:58 -07:00
Vern Paxson
1ede6a8424 accessors / friends needed for compiling-to-C++ 2021-05-05 16:50:54 -07:00
Vern Paxson
09dc074a26 switched RecordVal's to use std::optional for tracking missing fields 2021-05-02 12:33:20 -07:00
Vern Paxson
c1903afb3b restore support for vectors with holes
remove vestigial comment
2021-04-14 18:16:46 -07:00
Jon Siwek
c0b8fc4d60 Change TableVal::ToMap() to return ValPtr-indexed maps 2021-04-03 10:08:02 -07:00
Vern Paxson
6e8baafeb9 Added TableVal::ToMap to retrieve a table's entire contents as a unordered_map 2021-04-01 17:33:37 -07:00
Jon Siwek
7047eb92d8 Change RecordVal::GetFieldAs() to use std::vector::operator[]
Since the method claims it's up to the user to ensure the field exists
before calling, the extra bounds-checking done by std::vector::at()
isn't needed.
2021-03-26 19:02:24 -07:00
Jon Siwek
2855df63ce Add RecordVal::AssignField() and use it in supervisor code
This is a convenience method to assign a known record field value by
field name.  May also be useful to reduce warnings from static analysis
(e.g. Coverity) about not checking for negative return values before
assigning since that now flows through a [[noreturn]] error path.
2021-03-26 18:57:42 -07:00
Tim Wojtulewicz
f45df63cd0 Merge remote-tracking branch 'origin/topic/vern/zval'
* origin/topic/vern/zval: (42 commits)
  whitespace tweaks
  resolved some TODO comments
  remove unnecessary casts, and change necessary ones to use static_cast<>
  explain cmp_func default
  change functions for ZVal type management to static members
  fix some unsigned/signed integer warnings
  address lint concern about uninitialized variable
  Remove use of obsolete forward-declaration macros
  fix #include's that lack zeek/ prefixes
  explicitly populate holes created in vectors
  fixes for now-incorrect assumption that GetField always returns an existing ValPtr
  memory management for assignment to vector elements
  memory management for assignment to record fields
  destructor cleanup from ZAM_vector/ZAM_record
  fix #include's that lack zeek/ prefixes
  overlooked another way in which vector holes can be created
  initialize vector holes to the correct corresponding type
  explicitly populate holes created in vectors
  fix other instances of GetField().get() assuming long-lived ValPtr's
  fix for now-incorrect assumption that GetField always returns an existing ValPtr
  ...
2021-03-23 20:44:19 -07:00
Jon Siwek
f46d3dec8f Merge remote-tracking branch 'origin/topic/vern/cpp-new-func'
- Removed a couple of dead statements during merge

* origin/topic/vern/cpp-new-func:
  option for deterministic descriptions of sets & tables
  determinism for concurrent Zeek test suite invocations; split out deprecations
  disambiguate descriptions of enums; include attributes when describing records
  more liberal view of attribute equality; allow suppressing attr type-checking
  support for operations on sets that return new values
  low-level addition of enum values
  sundry accessors/cast-ers; RE_Matcher's track their construction values
  convenience functions for comparing IP addresses
2021-03-23 19:27:11 -07:00
Vern Paxson
46e303b000 resolved some TODO comments 2021-03-22 21:20:52 -07:00
Vern Paxson
245108e86e remove unnecessary casts, and change necessary ones to use static_cast<> 2021-03-18 13:24:25 -07:00
Vern Paxson
2faaccf10a explain cmp_func default 2021-03-18 11:32:34 -07:00
Vern Paxson
efe40204e0 change functions for ZVal type management to static members 2021-03-18 11:31:31 -07:00
Vern Paxson
6898c36c51 support for operations on sets that return new values 2021-03-18 10:38:38 -07:00
Vern Paxson
d53d2ac755 sundry accessors/cast-ers; RE_Matcher's track their construction values 2021-03-18 10:33:10 -07:00
Vern Paxson
c6830193f3 removing unneeded BoolVal constructor that can cause overload ambiguity issues 2021-03-18 08:21:52 -07:00
Vern Paxson
6aab151d97 explicitly populate holes created in vectors 2021-02-28 07:23:06 -08:00
Vern Paxson
3a59bc1a37 memory management for assignment to vector elements 2021-02-28 07:22:40 -08:00
Vern Paxson
7adcd1b27b memory management for assignment to record fields 2021-02-28 07:22:31 -08:00