Commit graph

114 commits

Author SHA1 Message Date
Johanna Amann
876c803d75 Merge remote-tracking branch 'origin/topic/timw/776-using-statements'
* origin/topic/timw/776-using-statements:
  Remove 'using namespace std' from SerialTypes.h
  Remove other using statements from headers
  GH-776: Remove using statements added by PR 770

Includes small fixes in files that changed since the merge request was
made.

Also includes a few small indentation fixes.
2020-04-09 13:31:07 -07:00
Tim Wojtulewicz
0a47588d0b The remaining nulls 2020-04-07 16:08:34 -07:00
Tim Wojtulewicz
d53c1454c0 Remove 'using namespace std' from SerialTypes.h
This unfortunately cuases a ton of flow-down changes because a lot of other
code was depending on that definition existing. This has a fairly large chance
to break builds of external plugins, considering how many internal ones it broke.
2020-04-07 15:59:59 -07:00
Jon Siwek
da56cd44d9 Fix using patterns stored as table/set indices
Pattern values used as table/set indices are stored in serialized form
using just the pattern text, but re-creating the value from that didn't
fully initialize/compile the regex matcher after (re-)creating it from
that pattern text.
2020-04-06 17:12:33 -07:00
Tim Wojtulewicz
fd5e15b116 The Great Embooleanating
A large number of functions had return values and/or arguments changed
to use ``bool`` types instead of ``int``.
2020-03-31 06:41:54 +00:00
Jon Siwek
b045ce4bb3 Change TableVal::RecoverIndex() to return IntrusivePtr 2020-03-23 22:01:03 -07:00
Jon Siwek
b62727a7fa Merge branch 'intrusive_ptr' of https://github.com/MaxKellermann/zeek
* 'intrusive_ptr' of https://github.com/MaxKellermann/zeek: (32 commits)
  Scope: store IntrusivePtr in `local`
  Scope: pass IntrusivePtr to AddInit()
  DNS_Mgr: use class IntrusivePtr
  Scope: use class IntrusivePtr
  Attr: use class IntrusivePtr
  Expr: check_and_promote_expr() returns IntrusivePtr
  Frame: use class IntrusivePtr
  Val: RecordVal::LookupWithDefault() returns IntrusivePtr
  Type: RecordType::FieldDefault() returns IntrusivePtr
  Val: TableVal::Delete() returns IntrusivePtr
  Type: base_type() returns IntrusivePtr
  Type: init_type() returns IntrusivePtr
  Type: merge_types() returns IntrusivePtr
  Type: use class IntrusivePtr in VectorType
  Type: use class IntrusivePtr in EnumType
  Type: use class IntrusivePtr in FileType
  Type: use class IntrusivePtr in TypeDecl
  Type: make TypeDecl `final` and the dtor non-`virtual`
  Type: use class IntrusivePtr in TypeType
  Type: use class IntrusivePtr in FuncType
  ...
2020-03-17 22:51:46 -07:00
Max Kellermann
43af5f8349 Type: use class IntrusivePtr in TypeDecl 2020-03-06 09:06:38 +01:00
Max Kellermann
674e141a15 Val: use class IntrusivePtr in class TableVal 2020-03-06 09:06:38 +01:00
Max Kellermann
7924e948b9 CompHash: return IntrusivePtr 2020-03-06 09:06:38 +01:00
Max Kellermann
ba35ebec4c Type: return IntrusivePtr 2020-03-06 09:06:38 +01:00
Tim Wojtulewicz
822567b3f9 Merge remote-tracking branch 'origin/topic/jsiwek/32bit-compat'
* origin/topic/jsiwek/32bit-compat:
  Improve formatting of doubles that are close to integers
  Improve HTTP version number comparisons
  Add a 32-bit task to Cirrus CI config
  Replace va_list fmt() overload with vfmt()
  Format tables indexed by patterns consistently across 32-bit/64-bit
  Format interval values consistently across 32-bit/64-bit platforms
2020-02-24 18:49:33 -07:00
Jon Siwek
38b25cf38d Merge branch 'smart_ptr' of https://github.com/MaxKellermann/zeek
Minor whitespace fixes during merge.

* 'smart_ptr' of https://github.com/MaxKellermann/zeek:
  OpaqueVal: remove misplaced `virtual` keywords
  CompHash: use class IntrusivePtr for the `type` field
  IntrusivePtr: replace the "add_ref" parameter with tag structs
  IntrusivePtr: remove reset(), nobody uses it
  IntrusivePtr: remove ordering operators
  IntrusivePtr: rename detach() to release()
  IntrusivePtr: move nullptr initializer to field declaration
2020-02-21 10:15:24 -08:00
Max Kellermann
53f49e0057 CompHash: use class IntrusivePtr for the type field 2020-02-20 15:57:39 +01:00
Jon Siwek
8e353aafe5 Format tables indexed by patterns consistently across 32-bit/64-bit
Uses a full 64 bit integer for length values regardless of actual size_t
to get consistent results between either 32-bit and 64-bit platforms.
2020-02-14 21:40:36 -08:00
Max Kellermann
c78fa4bcf9 Val: eliminate the "RE.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
e98cf0a4a0 Val: eliminate the "BroString.h" include 2020-02-13 09:13:59 +01:00
Max Kellermann
4aac78cf29 Val: forward-declare class PDict, reduce includes 2020-02-12 10:10:26 +01:00
Tim Wojtulewicz
3572e38ec2 Mark a few clang-tidy findings as false-positive 2020-02-11 14:11:22 -08:00
Jon Siwek
d581aa76aa Merge remote-tracking branch 'origin/topic/dev/patterns-in-sets'
Fixes in merge:
- Memory leak in HashKey ctor
- Minor whitespace/style changes

* origin/topic/dev/patterns-in-sets:
  Enable Patterns as Table index in non singleton cases
  Added support to create a Hashkey for PatternVals using their Pattern Texts
2020-01-06 14:15:30 -08:00
Dev Bali
4002a1124e Enable Patterns as Table index in non singleton cases 2019-12-19 19:32:55 -08:00
Dev Bali
a907732e25 Added support to create a Hashkey for PatternVals using their Pattern Texts 2019-12-19 19:32:55 -08:00
Tim Wojtulewicz
40d4004453 Add null check when getting key size for List types. Fixes coverity finding 1058242 2019-09-16 10:56:41 -07:00
Tim Wojtulewicz
54752ef9a1 Deprecate the internal int/uint types in favor of the cstdint types they were based on 2019-08-12 13:50:07 -07:00
Tim Wojtulewicz
e51f02737b Convert uses of loop_over_list to ranged-for loops 2019-07-15 19:00:24 -07:00
Jon Siwek
b3c4b986ef Fix maybe-uninitialized compiler warning 2019-05-14 19:01:41 -07:00
Robin Sommer
789cb376fd GH-239: Rename bro to zeek, bro-config to zeek-config, and bro-path-dev to zeek-path-dev.
This also installs symlinks from "zeek" and "bro-config" to a wrapper
script that prints a deprecation warning.

The btests pass, but this is still WIP. broctl renaming is still
missing.

#239
2019-05-01 21:43:45 +00:00
Johanna Amann
7c892ef7d4 Merge remote-tracking branch 'origin/topic/jsiwek/gh-151'
* origin/topic/jsiwek/gh-151:
  GH-151: fix hash calculation for nested sets
2019-01-22 09:08:14 -08:00
Jon Siwek
d86fb9f87a GH-151: fix hash calculation for nested sets
Hash key construction of nested sets depended on the order in
which their elements are iterated, which varied even between sets
containing equivalent elements.  The iteration order is now sorted
by each element's hash value (or, on collision, by full key) such
that equivalent sets no longer hash differently.
2019-01-18 20:54:22 -06:00
Johanna Amann
d4f7dae768 Merge remote-tracking branch 'origin/topic/jsiwek/val_mgr'
* origin/topic/jsiwek/val_mgr:
  Pre-allocate and re-use Vals for bool, int, count, enum and empty string
  Preallocate booleans and small counts

I added a tiny change to CompHash to make sure that nothing messes this
up in the future.
2019-01-18 15:17:34 -08:00
Jon Siwek
2982765128 Pre-allocate and re-use Vals for bool, int, count, enum and empty string 2019-01-09 18:29:23 -06:00
Jon Siwek
1e4964de77 Preallocate all possible PortVals.
The performance benefit is small (maybe ~1% at most), however, it's a
trivial change without downsides.
2017-12-11 15:29:28 -06:00
Robin Sommer
3957091e1b Renaming config.h to bro-config.h.
A couple times now I had this conflicting with files of the same name
in other projects.
2015-07-28 11:57:04 -07:00
Jon Siwek
775ec6795e Fix uninitialized (or unused) fields. 2013-09-27 10:13:52 -05:00
Jon Siwek
e4e7c78925 Remove unused variable assignments, dead code. 2013-09-23 16:57:31 -05:00
Robin Sommer
e8c9c2ee0b Fixing more memory leaks. 2013-04-29 21:14:11 -07:00
Robin Sommer
95cf662ff5 Fixing memory leak in CompHash.
Amazing what code still has memory leaks ...

Closes #987.
2013-04-29 21:14:11 -07:00
Bernhard Amann
8f259f866d change vector assignment operator and remove unnecessary argument (expr) 2013-03-06 14:08:06 -08:00
Jon Siwek
624980b98d Add a null value check in CompositeHash::ComputeHash.
Because I guess aborting is nicer than segfaulting.

Addresses #930.
2013-01-18 12:56:23 -06:00
Robin Sommer
edc9bb14af Making exchange of addresses between threads thread-safe.
As we can't use the IPAddr class (because it's not thread-safe), this
involved a bit manual address manipulation and also shuffling some
things around a bit.

Not fully working yet, the tests for remote logging still fail.
2012-02-28 15:57:43 -08:00
Jon Siwek
d7dafe2fe2 Refactoring various usages of new IPAddr class.
Reducing number of places that internal representation was exposed
via GetBytes/CopyIPv6.

Also fixed a bug in remask_addr bif.
2012-02-22 14:45:44 -06:00
Robin Sommer
94b9644da7 Working on merging the v6-addr branch. This is checkpoint, tests don't
pass yet.

Changes:

- Gave IPAddress/IPPrefix methods AsString() so that one doesn't need
  to cast to get a string represenation.

- Val::AsAddr()/AsSubnet() return references rather than pointers. I
  find that more intuitive.

- ODesc/Serializer/SerializationFormat get methods to support
  IPAddress/IPPrefix directly.

- Reformatted the comments in IPAddr.h from /// to /** style.

- Given IPPrefix a Contains() method.

- A bit of cleanup.
2012-02-16 20:39:16 -08:00
Robin Sommer
7458ebf385 Checkpoint after pass. 2012-02-15 13:07:08 -08:00
Jon Siwek
1f58ac875b Fix some hashing bugs resulting from adaptation of new IPAddr class. 2012-02-06 13:05:52 -06:00
Jon Siwek
2e2f8f5d06 Merge branch 'master' into topic/v6-addr
Conflicts:
	src/bro.bif
2012-02-06 11:06:55 -06:00
Jon Siwek
b3f1f45082 Remove --enable-brov6 flag, IPv6 now supported by default.
Internally, all BROv6 preprocessor switches were removed and
addr/subnet representations wrapped in the new IPAddr/IPPrefix classes.

Some script-layer changes of note:

- dns_AAAA_reply event signature changed: the string representation
  of an IPv6 addr is easily derived from the addr value, it doesn't
  need to be another parameter.  This event also now generated directly
  by the DNS analyzer instead of being "faked" into a dns_A_reply event.

- removed addr_to_count BIF.  It used to return the host-order
  count representation of IPv4 addresses only.  To make it more
  generic, we might later add a BIF to return a vector of counts
  in order to support IPv6.

- changed the result of enclosing addr variables in vertical pipes
  (e.g. |my_addr|) to return the bit-width of the address type which
  is 128 for IPv6 and 32 for IPv4.  It used to function the same
  way as addr_to_count mentioned above.

- remove bro_has_ipv6 BIF
2012-02-03 16:46:58 -06:00
Robin Sommer
27ce62077f Merge remote-tracking branch 'origin/topic/jsiwek/complex-record-indices'
* origin/topic/jsiwek/complex-record-indices:
  Teach CompHash to allow indexing by records with vector/table/set fields.

Closes #464
2012-01-25 13:38:36 -08:00
Jon Siwek
1e4c3d8ea2 Teach CompHash to allow indexing by records with vector/table/set fields.
Addresses #464.
2012-01-20 16:54:48 -06:00
Jon Siwek
cec4600d2e Fixing compiler warnings (addresses #388) 2011-11-01 14:44:38 -05:00
Robin Sommer
63b46a0ae2 Fixing a bunch of format strings.
Also leveraging GCC if available to check format specificier.

Closes #567.
2011-10-18 17:39:40 -07:00