Commit graph

3507 commits

Author SHA1 Message Date
Jon Siwek
d3ace9b7ac GH-1506: Fix Broker unserialization of set/table function indices
Zeek function types are serialized as a broker::vector, but the
unserialization logic for Zeek set/table types that use a function for
as an index incorrectly identified it as a composite-index, which also
use broker::vector, rather than a singleton-index, and makes such
unserialization fail.

A general example where this failure can happen in practice is when
trying to unserialize a connection record for which there's a
Conn::RemovalHook, since that's a set[function], and a specific case of
that is use of the Intel Framework in a Zeek cluster.
2021-04-15 01:13:51 -07:00
Jon Siwek
cd8f19328a Merge remote-tracking branch 'origin/topic/neverlord/gh-1408'
- Minor adjustments to header includes, whitespace, and a
  compiler warning fix during merge

* origin/topic/neverlord/gh-1408:
  Add new Timer class to the telemetry API
  Fix build with latest VectorVal API
  Update baselines
  Prefix telemetry BIFs with __
  Expose telemetry API to scripting land
  Add handle types for histogram metrics
  Move duplicated code to detail header
  Adhere to Zeek coding style
  Apply suggestions from code review
  Add telemetry Manager to Zeek setup / teardown
  Add missing whitespaces for Zeek coding style
  Add gauge metric types
  Add scaffold for new metrics API with counters
2021-04-05 14:21:44 -07:00
Jon Siwek
e6955d55dd Increase timeout of plugins.reader btest 2021-04-03 09:40:45 -07:00
Jon Siwek
3e9ac00f21 Separate stdout from stderr in btest baselines
Redirecting both to the same file can show platform-specific differences
(e.g. Alpine), likely due to different buffering defaults.
2021-03-30 16:23:23 -07:00
Jon Siwek
8e47494dff Remove newline-eof canonification attempt in diff-remove-timestamps
On Alpine (BusyBox `sed`), the previous `sed -e '$a\'` invocation always
added a newline, breaking most every diff.  There doesn't seem to be a
need to attempt normalizing EOF newlines at the moment and doing it that
way doesn't seem to be portable anyway.  If canonifiers need to be
portable, `sed` should be treated as a text-processing tool and POSIX
definition of text-file is zero or more newline-terminated
character-sequences, so if canonification of Baselines via `sed` is
required, those Baselines should always end with a newline to be
considered text files.  I.e. that's not the job of this canonifier, and
changing it also doesn't necessarily generalize since it could be
considered coincidental that diff-remove-timestamps in particular is the
default canonifier that's commonly used while there's still others that
also make use of `sed`.
2021-03-30 16:04:34 -07:00
Jon Siwek
c033bd20aa Merge remote-tracking branch 'origin/topic/vern/global-stmts'
* origin/topic/vern/global-stmts:
  whitespace adjustment
  "balance" tests with multiple Zeek scripts to load the same elements
  put global statements into a quasi-function to support script optimization
2021-03-29 15:42:43 -07:00
Dominik Charousset
600d1118cd Update baselines 2021-03-29 10:47:32 +02:00
Dominik Charousset
e476911075 Prefix telemetry BIFs with __ 2021-03-29 10:47:32 +02:00
Dominik Charousset
2bac354e43 Expose telemetry API to scripting land 2021-03-29 10:47:32 +02:00
Jon Siwek
a0859276bf Merge remote-tracking branch 'origin/topic/timw/analyzer-crash'
* origin/topic/timw/analyzer-crash:
  Fix crash in Analyzer::ForwardPacket due to recursive analyzer calls.
2021-03-26 16:40:12 -07:00
Tim Wojtulewicz
4015beb732 Fix crash in Analyzer::ForwardPacket due to recursive analyzer calls.
The change in 44f558df7b that made analyzer_list
a std::vector instead of a std::list doesn't take into account that in some
cases an analyzer may chain back into itself, such as with UDP-in-UDP tunnels.
In these cases, the second call to ForwardPacket may cause iterator
invalidation, leading to a crash.
2021-03-25 08:45:38 -07:00
Vern Paxson
3139cf2594 "balance" tests with multiple Zeek scripts to load the same elements 2021-03-24 21:37:26 -07:00
Vern Paxson
a288800b41 test suite update due to factoring out coerce_to_record() 2021-03-24 15:16:03 -07:00
Vern Paxson
91c2e05099 factor out record coercion; modernize management of coercion "map" 2021-03-24 15:03:00 -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
569830526f Increase timeout of openflow.log-cluster btest 2021-03-23 19:34:34 -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
a808e166a4 determinism for concurrent Zeek test suite invocations; split out deprecations 2021-03-18 16:17:25 -07:00
Vern Paxson
ef3eaed3fb disambiguate descriptions of enums; include attributes when describing records 2021-03-18 10:53:36 -07:00
Vern Paxson
e21c0f1115 correcting some simple typos 2021-03-18 08:19:46 -07:00
Gorka Olalde Mendia
ec8c5f6c07 Add tests for ERSPAN Type I patch
Co-authored-by: Markel Elorza Alvarez <melorzaalvarez@gmail.com>
Co-authored-by: Ivan Arrizabalaga Cupido <ivanarrcup@gmail.com>
2021-03-17 14:41:29 +01:00
Jon Siwek
07bad2d40e Merge remote-tracking branch 'origin/topic/seth/fix-smb-ts-fields'
* origin/topic/seth/fix-smb-ts-fields:
  Updating external test commit pointers
  ts fields in SMB logs now default to network_time()
2021-03-11 12:44:04 -08:00
Seth Hall
87950cb833 Updating external test commit pointers 2021-03-10 18:23:15 +00:00
Jon Siwek
4b6369a333 Add alternative 'xform' baseline for test: broker.store.create-failure 2021-03-08 12:59:30 -08:00
Jon Siwek
75d3cbda4b Merge branch 'master' into topic/vern/ast-opt 2021-03-08 12:35:04 -08:00
Jon Siwek
6af436aad3 GH-1426: Improve handling of Broker data store creation failures
Broker::create_master() and Broker::create_clone() now return
a valid value even when there's a failure to open the backend database
(e.g. SQLite filesystem error).  In that case, the returned value can
still be passed into other data store operations, but they'll fail
immediately with an error.  Broker::is_closed() can now also be used to
determine whether the data store creation calls failed.
2021-03-06 02:32:29 -08:00
Vern Paxson
9496379b95 don't know how I overlooked these minor test suite updates 2021-02-27 13:47:49 -08:00
Vern Paxson
9953961569 "opt" btest baseline updates due to AST optimizations changing printed code 2021-02-27 11:43:17 -08:00
Vern Paxson
4847c357ca "opt" baseline exceptions due to incompatibility with optimize-AST and -u 2021-02-27 11:42:24 -08:00
Vern Paxson
8f21432f76 new "opt" btest alternative 2021-02-27 11:41:23 -08:00
Vern Paxson
42d59203a1 update to "xform" test suite baseline due to recent line number changes 2021-02-27 11:40:33 -08:00
Jon Siwek
6ac499882c Teach Zeekygen to produce source-code-range information
Related to https://github.com/zeek/zeek-docs/issues/56
2021-02-26 14:55:59 -08:00
Vern Paxson
5084584020 test suite update for Smith-Waterman now using 0-based vectors 2021-02-25 17:13:56 -08:00
Vern Paxson
98ada4e419 test suite updates for expanded sort() BiF semantics (bools, doubles) 2021-02-25 17:13:50 -08:00
Vern Paxson
ab0b773522 test suite updates reflecting that vectors no longer support arbitrary "holes" 2021-02-25 17:00:36 -08:00
Vern Paxson
e64805430b fix off-by-one assumption regarding vector indexing dating to 2011 2021-02-24 16:31:07 -08:00
Jon Siwek
737d2c390b Support explicit disabling of file analyzers 2021-02-23 15:50:18 -08:00
Jon Siwek
80221cb958 Merge remote-tracking branch 'origin/topic/vern/use-defs'
- Added explicit test case of "unused assignement" warning and
  &is_used suppression during merge.

* origin/topic/vern/use-defs:
  activate &is_used
  removed unnecessary statement flagged by Coverity (thanks, Jon!)
  Adjust reference/move nitpicks in use-def/reduce code
  Adjust some whitespace in UseDefs.cc
  updates to "usage" test suite alternative now that more warnings are generated
  suppress usage warning in baseline script
  "xform" alternative baseline update, needed for recent change to master
  baseline update due to shift in number of lines in base intel framework script
  environment variable (which has precedence) not flags for baseline usage test
  splitting out "usage" test suite alternative into -u/-uu versions
  adding &is_used attribute for base scripts - not actually needed yet, but will be once optimization is added
  removing unused assignments from base scripts
  driver glue for invoking use-def construction
  classes for managing and propagating use-defs
  enhancements/changes to the Reduce class in preparation for use-defs
  some tidying with smart pointers
  flag/environment variable for dumping use-defs
  &is_used attribute to suppress set-but-not-used usage warnings
  whitespace micro-preening
2021-02-23 12:11:24 -08:00
Vern Paxson
86709c5992 activate &is_used 2021-02-23 08:32:14 -08:00
Johanna Amann
6c554ddde3 Ascii reader test with 0-bytes
Add a second test, which contains actual 0-bytes.
2021-02-12 14:49:33 +00:00
Johanna Amann
61290fc19c Fix buffer overread in ascii formatter
When a text with an (escaped) zero byte was passed to ParseValue, only
the part of the string up to the zero byte was copied, but the length of
the full string was passed to the input framework.

This leads to the input manager reading over the end of the buffer.

Fixes zeek/zeek#1398
2021-02-12 14:24:36 +00:00
Tim Wojtulewicz
a05356eb79 Add a script to cleanup the file listing before sending to Coveralls
GCC has a "feature" where it doesn't realize that files in the
src/zeek/... tree are the same as files in the normal 'src/' tree. This
leads the coverage script to send duplicates to Coveralls and pollute
the display with them. The new script scrapes the intermediate output
from lcov and de-duplicates anything in src/zeek/ to be just from src/.
2021-02-09 23:07:47 +00:00
Vern Paxson
b714fde456 updates to "usage" test suite alternative now that more warnings are generated 2021-02-06 11:07:26 -08:00
Vern Paxson
1605b57dec suppress usage warning in baseline script 2021-02-06 11:05:53 -08:00
Vern Paxson
991bd51430 "xform" alternative baseline update, needed for recent change to master 2021-02-06 11:04:53 -08:00
Vern Paxson
6838ef66b4 baseline update due to shift in number of lines in base intel framework script 2021-02-06 11:04:17 -08:00
Vern Paxson
da40c580b2 environment variable (which has precedence) not flags for baseline usage test 2021-02-06 11:01:30 -08:00
Vern Paxson
0a6270365f splitting out "usage" test suite alternative into -u/-uu versions 2021-02-06 11:01:04 -08:00
Jon Siwek
ac0b09d1a4 Allow --parse-only to work with --usage-issues flag
Use of --parse-only would previously exit before --usage-issues had a
chance to analyze scripts and report any discovered issues and it can be
useful to combine both flags for checking scripts for mistakes without
actually executing any code.

This also improves the behavior of --parse-only in combination with
reporting problems in signature files (previously, it exited before
even reading them).
2021-02-05 14:46:47 -08:00
Jon Siwek
03f74958f3 Merge remote-tracking branch 'origin/topic/vern/reaching-defs'
* origin/topic/vern/reaching-defs: (36 commits)
  added &is_assigned test case for variable rather than record field
  Speedup ReachingDefs logic by ~15%
  Simplify ReachingDefs::RDMap() accessor
  test for -uu correctly tracking $?, and not misled by conditional assignments
  &is_set => &is_assigned
  remove pending maybe-reconsider-this comment
  fixes for ?$ operator - always track it, and assume subrecords are initialized
  speedup (and more coherent memory management) for tracking RDs
  fixes for generating and evaluating RDs associate with ?$ expressions
  fix for failure to reduce InlineExpr's to CatchReturnStmt's
  inlining fix: propagate identifier attributes (such as &is_set)
  tidier memory management
  fix for an ancient bug - surprising that this hasn't caused problems previously
  Fix IntrusivePtr release leaks in reaching-def logic
  Change dynamic_cast in reaching-def logic to static_cast
  Adjust some reaching-def memory management
  Update a couple baselines for "xform" alternative
  Adjust various reaching-def move/reference semantics
  Change LambdaExpr::OuterIDs() accessor to return const-reference
  Simplify declaration of DefPointType enum
  ...
2021-02-05 11:02:01 -08:00