Commit graph

6667 commits

Author SHA1 Message Date
Jon Siwek
455fc29b1a Migrate TypeList to store IntrusivePtrs
This changes return types of TypeList::Types() and
IndexType::IndexTypes() to return std::vector instead of type_list*
2020-05-14 17:18:00 -07:00
Jon Siwek
011866a908 Deprecate TypeList::PureType(), replace with TypeList::GetPureType() 2020-05-14 17:18:00 -07:00
Jon Siwek
9ab7150883 Deprecate SetType::SetElements(), replace with SetType::Elements() 2020-05-14 17:18:00 -07:00
Jon Siwek
0f59b80d66 Remove unused TableType::ExpandRecordIndex() 2020-05-14 17:18:00 -07:00
Jon Siwek
6a1e4d61d1 Add cast_intrusive() and make use of it in two spots 2020-05-14 17:18:00 -07:00
Jon Siwek
c6f2e35af0 Give make_intrusive() access to protected EnumVal ctor 2020-05-14 17:18:00 -07:00
Jon Siwek
f512ae023e Remove two superfluous IntrusivePtr NewRefs in Type.cc 2020-05-14 17:18:00 -07:00
Jon Siwek
89dd668aff Change BroType::ShallowClone() to return IntrusivePtr 2020-05-14 17:18:00 -07:00
Jon Siwek
b05e5c7686 Migrate IP.cc to use IntrusivePtr 2020-05-14 17:18:00 -07:00
Jon Siwek
a60e5e9582 Migrate SMB analyzer to use IntrusivePtr
Deprecates the utf16_bytestring_to_utf8_val() function with replacement
being utf16_to_utf8_val().
2020-05-14 17:18:00 -07:00
Jon Siwek
ad6dbada71 Migrate ARP analyzer to use IntrusivePtr 2020-05-14 17:18:00 -07:00
Jon Siwek
61b75ddd02 Migrate HTTP/MIME analyzers to use IntrusivePtr 2020-05-14 17:18:00 -07:00
Jon Siwek
46e27bbf7d Migrate ICMP analyzer to use IntrusivePtr 2020-05-14 17:18:00 -07:00
Jon Siwek
0f2b176f75 Migrate DNS analyzer to use IntrusivePtr 2020-05-14 17:18:00 -07:00
Jon Siwek
1abed4fd4c Migrate Tag classes to use IntrusivePtr
Deprecates various methods that previously took raw pointers
2020-05-14 17:18:00 -07:00
Jon Siwek
b096e552d3 Deprecate TableVal::ConvertToList() and TableVal::ConvertToPureList()
Replaced with ToListVal() and ToPureListVal() that return IntrusivePtr
2020-05-14 17:18:00 -07:00
Jon Siwek
5f57ceb70a Switch ListVal to store IntrusivePtrs
* Deprecates ListVal::Index() methods and replaces with ListVal::Idx()

* Replaces ListVal::Vals() method with one that returns
  std::vector<IntrusivePtr<Val>> rather than val_list
2020-05-14 17:18:00 -07:00
Jon Siwek
b422f68b88 Deprecant ListVal::Append(Val*) and add IntrusivePtr version 2020-05-14 17:18:00 -07:00
Jon Siwek
df65d1e829 Deprecate ListVal::ConvertToSet(), add ListVal::ToSetVal() 2020-05-14 17:18:00 -07:00
Jon Siwek
2cfbbd8cdb Deprecate TunnelEncapsulation BuildRecordVal/BuildVectorVal methods
Replaced with ToVal methods that return IntrusivePtr
2020-05-14 17:18:00 -07:00
Jon Siwek
61649d5da7 Deprecate various IP/packet header Val-building methods
And supply new alternatives that use IntrusivePtr
2020-05-14 17:18:00 -07:00
Noah Treuhaft
2e5f96f5a9 Replace bzero() with memset() 2020-05-14 16:57:27 -07:00
Johanna Amann
892023ed9a Merge remote-tracking branch 'origin/master' into topic/johanna/hash-unification
* origin/master:
  Use zeek::detail namespace for fuzzer utils
  Set terminating flag during fuzzer cleanup
  Add missing include to standalone fuzzer driver
  Improve standalone fuzzer driver error messages
  Test fuzzers against seed corpus under CI ASan build
  Update fuzzing README with OSS-Fuzz integration notes
  Link fuzzers against shared library to reduce executable sizes
  Improve FuzzBuffer chunking
  Fix compiler warning in standalone fuzzer driver
  Adjust minor fuzzing documentation
  Exit immediately after running unit tests
  Add OSS-Fuzz Zeek script search path to fuzzers
  Assume libFuzzer when LIB_FUZZING_ENGINE file doesn't exist
  Change handling of LIB_FUZZING_ENGINE
  Change --enable-fuzzing to --enable-fuzzers
  Add standalone driver for fuzz targets
  Add basic structure for fuzzing targets
2020-05-13 14:19:44 +00:00
Johanna Amann
ce8b121e12 Hash unification: address PR feedback 2020-05-13 14:07:59 +00:00
Tim Wojtulewicz
82978a8860 Merge remote-tracking branch 'origin/topic/jsiwek/fuzzing'
* origin/topic/jsiwek/fuzzing:
  Use zeek::detail namespace for fuzzer utils
  Set terminating flag during fuzzer cleanup
  Add missing include to standalone fuzzer driver
  Improve standalone fuzzer driver error messages
  Test fuzzers against seed corpus under CI ASan build
  Update fuzzing README with OSS-Fuzz integration notes
  Link fuzzers against shared library to reduce executable sizes
  Improve FuzzBuffer chunking
  Fix compiler warning in standalone fuzzer driver
  Adjust minor fuzzing documentation
  Exit immediately after running unit tests
  Add OSS-Fuzz Zeek script search path to fuzzers
  Assume libFuzzer when LIB_FUZZING_ENGINE file doesn't exist
  Change handling of LIB_FUZZING_ENGINE
  Change --enable-fuzzing to --enable-fuzzers
  Add standalone driver for fuzz targets
  Add basic structure for fuzzing targets
2020-05-12 18:53:06 -07:00
Johanna Amann
7f137b7d50 Update architecture checks for highwayhash
Now we use cmake to determine which compiler flags are set to
determine which implementation of highwayhash to compile. This should
be much more robust.

Also - fix missing include on old ubuntus.
2020-05-12 12:03:10 -07:00
Johanna Amann
fd5e1ae42a Highwayhas: unbreak 32 bit compiles 2020-05-11 22:12:55 -07:00
Johanna Amann
27d87919a1 Hashing: Remove unnecessary include 2020-05-12 00:30:33 +00:00
Johanna Amann
a259e8bbda Merge remote-tracking branch 'origin/master' into topic/johanna/hash-unification 2020-05-12 00:29:02 +00:00
Johanna Amann
330b997e3a Add highwayhash in a more cmake-y way 2020-05-11 17:19:31 -07:00
Jon Siwek
61ce1b18fb Limit rate at which MMDB error/status messages are emitted
If there's some bad state we can be in where MMDB lookup/open operations
consistently fail, then the volume of associated reporter messages can
get overwhelmingly large especially if a lookup operation is being done
for each network connection.

This adds a limit of an arbitrary 20 messages every 5 minutes, which
should be enough information to understand the overall
open/close/lookup-failure pattern.
2020-05-08 13:05:24 -07:00
Jon Siwek
73a57335db Merge remote-tracking branch 'origin/topic/timw/unordered-lists'
* origin/topic/timw/unordered-lists:
  Review fixups
  Change timer_list in BroList to be an unordered list.
  Add ability for List to be ordered/unordered
  Add unit testing for List
  Fix bug with List where replace() doesn't work with non-pointer types
2020-05-08 11:52:03 -07:00
Tim Wojtulewicz
690061b01c Review fixups 2020-05-08 10:46:03 -07:00
Johanna Amann
695457fe44 Unbreak build on Fedora 32 (gcc 10.0.1)
It requires cstdint in a few more headers.
2020-05-07 22:18:04 -07:00
Jon Siwek
9babb7d39f Merge remote-tracking branch 'origin/topic/johanna/958'
- Extended the improved error to cover miss-typed identifiers, too

* origin/topic/johanna/958:
  Fix crash when trying to redef non-existing enum
2020-05-07 17:15:53 -07:00
Johanna Amann
9c44403c62 Fix crash when trying to redef non-existing enum
Fixes GH-958
2020-05-07 14:57:03 -07:00
Johanna Amann
04ed125941 Merge remote-tracking branch 'origin/master' into topic/johanna/hash-unification 2020-05-06 23:18:33 +00:00
Tim Wojtulewicz
8ac591c9f5 Revert addition of final modifier to JSON formatter 2020-05-06 10:40:48 -07:00
Jon Siwek
280bf56786 Fix global buffer over-read in POP3 analyzer
Report and patch by Justin Azoff
2020-05-06 10:00:58 -07:00
Jon Siwek
eff11c5ef4 Merge branch 'network-time-init' of https://github.com/J-Gras/zeek
- Minor whitespace/format adjustments

* 'network-time-init' of https://github.com/J-Gras/zeek:
  Fix documentation for network_time_init.
  Improve network_time_init() test and add baseline.
  Add network_time_init() event.
  Add test for network_time behavior.
2020-05-04 17:51:39 -07:00
Jon Siwek
2d0b8c0b8e Use zeek::detail namespace for fuzzer utils 2020-05-04 17:37:11 -07:00
Jon Siwek
5a2d25c954 Set terminating flag during fuzzer cleanup 2020-05-04 17:29:21 -07:00
Jon Siwek
62ec60b96f Merge remote-tracking branch 'origin/topic/jazoff/avoid-redundant-inactivity-timers'
- Changed the logic significantly to just guarantee there's only ever a
  single inactivity timer per connection

- Updated language.expire_subnet btest which is unduly sensitive to
  timer-related changes

* origin/topic/jazoff/avoid-redundant-inactivity-timers:
  avoid scheduling redundant inactivity timers
2020-05-04 17:12:36 -07:00
Jon Siwek
a2f2f7a0dd Prevent IP fragment reassembly on packets without minimal IP header
The IP fragment reassembly process assumes a packet contains at least
the minimum IP header, but such a check did not previously occur,
resulting in a heap buffer over-read.  For example, a self-reported
IPv4 IHL field with a value less than minimum IPv4 header length of
20 bytes.  Such packets likely aren't routable on their own, but one
can create an artifical pcap like that or possibly encapsulate it
within another protocol to trigger this bug.
2020-05-04 12:41:53 -07:00
Jan Grashoefer
0c47b6098b Fix documentation for network_time_init. 2020-05-02 18:29:19 +02:00
Jon Siwek
d449682ff0 Add missing include to standalone fuzzer driver 2020-05-01 13:47:36 -07:00
Tim Wojtulewicz
2c8d0f60da Ensure time continues moving forward if a pcap source is suspended 2020-05-01 12:36:57 -07:00
Justin Azoff
751ea5edd7 avoid scheduling redundant inactivity timers
When setting the inactivity timeout, don't schedule a new timer if the
new one would be redundant.
2020-05-01 09:36:50 -04:00
Jon Siwek
1b190906c7 GH-938: fix IO loop iterations sometimes skipping offline pcap sources 2020-04-30 16:19:30 -07:00
Tim Wojtulewicz
499a3353b5 Change timer_list in BroList to be an unordered list.
This type is used by Conn and Analyzer to hold onto timers being added and removed. We
don't expect the elements in those lists to maintain an order as the list is being
modified.
2020-04-30 15:23:48 -07:00