Commit graph

6667 commits

Author SHA1 Message Date
Vern Paxson
8782894d7d comments for factored-out index slice functions 2021-03-24 15:03:03 -07:00
Vern Paxson
78f18b4fa6 support for subclassing ScriptFunc's, esp. for alternate lambda closures 2021-03-24 15:03:03 -07:00
Vern Paxson
91c2e05099 factor out record coercion; modernize management of coercion "map" 2021-03-24 15:03:00 -07:00
Vern Paxson
5f5ba3881c lower-level method for adding fields to records 2021-03-24 15:01:33 -07:00
Vern Paxson
22776167bb factor out "print" statement's execution functionality 2021-03-24 15:01:33 -07:00
Vern Paxson
b792feccab functions for indexing slices and strings 2021-03-24 15:01:19 -07:00
Vern Paxson
8f2637decb new function for getting the location, if any, associated with the current call 2021-03-24 09:36:21 -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
Jon Siwek
fd7402e8d6 Merge remote-tracking branch 'origin/topic/timw/analyzer-iterators'
- During merge, simplified the API docs for Analyzer::DeleteChild()
  (found it unclear/unnecessary to refer to any `std` container types)

* origin/topic/timw/analyzer-iterators:
  Clean up iterator usage in Analyzer
2021-03-23 16:33:17 -07:00
Vern Paxson
d5b523cd2c whitespace tweaks 2021-03-22 21:23:15 -07:00
Vern Paxson
46e303b000 resolved some TODO comments 2021-03-22 21:20:52 -07:00
Vern Paxson
9e4c87b112 option for deterministic descriptions of sets & tables 2021-03-18 16:18:32 -07:00
Vern Paxson
245108e86e remove unnecessary casts, and change necessary ones to use static_cast<> 2021-03-18 13:24:25 -07:00
Tim Wojtulewicz
4f24c02cd5 Merge remote-tracking branch 'origin/topic/vern/cpp-prep-fixes'
* origin/topic/vern/cpp-prep-fixes:
  fix for associating current scope with the name of enums; name tidying
  avoid infinite recursion in same_type() if it is analyzing recursive types
  remove iffy reliance on type punning that relies on interpreter's behavior
  fixes for propagating optimization options, and pruning script function analysis
2021-03-18 12:53:14 -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
ef3eaed3fb disambiguate descriptions of enums; include attributes when describing records 2021-03-18 10:53:36 -07:00
Vern Paxson
d5e6d8e249 more liberal view of attribute equality; allow suppressing attr type-checking 2021-03-18 10:42:49 -07:00
Vern Paxson
6898c36c51 support for operations on sets that return new values 2021-03-18 10:38:38 -07:00
Vern Paxson
b242430bd1 low-level addition of enum values 2021-03-18 10:36:52 -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
17affdb858 convenience functions for comparing IP addresses 2021-03-18 10:28:32 -07:00
Vern Paxson
e407d8ab51 fix for associating current scope with the name of enums; name tidying 2021-03-18 08:58:03 -07:00
Vern Paxson
b3ee7ec675 avoid infinite recursion in same_type() if it is analyzing recursive types 2021-03-18 08:56:58 -07:00
Vern Paxson
b473bc48e1 remove iffy reliance on type punning that relies on interpreter's behavior 2021-03-18 08:46:18 -07:00
Vern Paxson
7294bb34be fixes for propagating optimization options, and pruning script function analysis 2021-03-18 08:40:48 -07:00
Vern Paxson
cde212ac18 tidying with respect to "const", and streamlining OuterIDBindingFinder 2021-03-18 08:24:14 -07:00
Vern Paxson
01bf4b8484 making Exec methods non-const, so execution can manage side-information 2021-03-18 08:22:55 -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
5a8ba8c3e5 lint fixes: ensuring functions return values, robustness to nil Val's 2021-03-18 08:21:19 -07:00
Vern Paxson
e21c0f1115 correcting some simple typos 2021-03-18 08:19:46 -07:00
Tim Wojtulewicz
44f558df7b Clean up iterator usage in Analyzer 2021-03-17 13:40:37 -07:00
Tim Wojtulewicz
f53fb9a22e Merge remote-tracking branch 'olaldiko/master'
* olaldiko/master:
  Add tests for ERSPAN Type I patch
  Add ERSPAN Type I patch
2021-03-17 10:37:14 -07:00
Gorka Olalde Mendia
fcc866567c Add 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 11:43:53 +01:00
Jon Siwek
6a0eae28a2 Merge remote-tracking branch 'origin/topic/jsiwek/gh-1432-file-extraction-buffered-io'
* origin/topic/jsiwek/gh-1432-file-extraction-buffered-io:
  GH-1432: Use buffered IO for file extraction
2021-03-10 12:29:35 -08:00
Jon Siwek
04f7259e97 Merge remote-tracking branch 'origin/topic/jsiwek/faster-plugin-search'
* origin/topic/jsiwek/faster-plugin-search:
  Avoid searching a directory for dynamic plugins multiple times
2021-03-10 12:06:05 -08:00
Johanna Amann
fa4d654a01 Fix potential mime type detection bug in IRC/FTP file_transferred event
The files framework uses strncpy to copy data into the buffer that is
used for IRC/FTP mime type detection. From all I can tell that means
that, in these cases, currently mime type detection will be messed up if
the data being passed in contains zero bytes.
2021-03-10 12:57:01 +00:00
Jon Siwek
1c58a2d86b GH-1432: Use buffered IO for file extraction
This can improve performance significantly: ~3.5x faster when tested on
a large file passing data to the file analysis framework in small chunks
of 20 bytes.
2021-03-09 18:26:48 -08:00
Jon Siwek
36099c5553 Avoid searching a directory for dynamic plugins multiple times 2021-03-09 15:00:27 -08:00
Jon Siwek
f2d3bf3037 Merge remote-tracking branch 'origin/topic/vern/ast-opt'
- Removed a stray `printf()` from script-opt Reduce code

* origin/topic/vern/ast-opt: (23 commits)
  Tweak minor const-ref/std::move things in script-opt code
  Add alternative 'xform' baseline for test: broker.store.create-failure
  Add explicit return value to Reducer::SameOp()
  fixed AST transformation logic for boolean expressions
  don't know how I overlooked these minor test suite updates
  "opt" btest baseline updates due to AST optimizations changing printed code
  "opt" baseline exceptions due to incompatibility with optimize-AST and -u
  new "opt" btest alternative
  update to "xform" test suite baseline due to recent line number changes
  logic for driving AST optimization when requested
  methods implementing AST optimization (aliasing, constant propagation, CSE)
  helper class checking if common-subexpression elimination opportunity is valid
  helper function for comparing collections of definition points
  track more information about temporary variables
  simplify and tidy up some interfaces
  enable setting "-O optimize-AST" option
  fix for reducing operations on boolean vectors
  control whether checking for type-equivalence generates warnings
  remove unneeded virtual method (same as inherited method)
  accessors for additional Expr subclasses
  ...
2021-03-08 18:33:04 -08:00
Jon Siwek
b66f4ad500 Tweak minor const-ref/std::move things in script-opt code 2021-03-08 15:50:04 -08:00
Jon Siwek
0ef315d143 Add explicit return value to Reducer::SameOp()
Helps tools that don't realize the implications of [[noreturn]] on
the Reporter::InternalError() in this case.
2021-03-08 12:39:39 -08:00
Jon Siwek
75d3cbda4b Merge branch 'master' into topic/vern/ast-opt 2021-03-08 12:35:04 -08:00
Jon Siwek
285aaa53d7 Merge remote-tracking branch 'origin/topic/jsiwek/improve-broker-store-creation'
* origin/topic/jsiwek/improve-broker-store-creation:
  GH-1426: Improve handling of Broker data store creation failures
2021-03-08 12:29:56 -08:00
Johanna Amann
358d82eb38 Merge branch 'topic/keithjjones/openvpn' of https://github.com/keithjjones/zeek
* 'topic/keithjjones/openvpn' of https://github.com/keithjjones/zeek:
  Replace assert with if statement so OpenVPN can use this over UDP.  And fix spelling.
2021-03-08 11:25:32 +00: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
Jon Siwek
6946cffde2 Simplify some copy_string() usages in threading::Field 2021-03-05 17:38:36 -08:00
Jon Siwek
ff90236df3 Merge remote-tracking branch 'origin/topic/timw/lgtm'
- Fixed leak in threading::Field copy-assignment operator

* origin/topic/timw/lgtm:
  Use const-reference in plugin::Manager::MetaHookPost for minor performance gain
  Fix missing assigmnent operator/copy constructor pairings reported by LGTM
  Fix variable shadowing issues reported by LGTM
  Update binpac and broker submodules to fix LGTM findings
2021-03-05 17:28:05 -08:00
Keith Jones
6fa02a7db4 Replace assert with if statement so OpenVPN can use this over UDP. And fix spelling. 2021-03-05 10:53:46 -05:00