Commit graph

36 commits

Author SHA1 Message Date
Tim Wojtulewicz
f6e31107e1 Move old TCP analyzer into analyzer adapter in packet analysis tree 2021-06-02 13:20:10 -07:00
Tim Wojtulewicz
4ad08172d0 Remove obsolete ZEEK_FORWARD_DECLARE_NAMESPACED macros 2021-02-24 14:35:44 -07:00
Tim Wojtulewicz
0618be792f Remove all of the random single-file deprecations
These are the changes that don't require a ton of changes to other files outside
of the original removal.
2021-01-27 10:52:40 -07:00
Tim Wojtulewicz
96d9115360 GH-1079: Use full paths starting with zeek/ when including files 2020-11-12 12:15:26 -07:00
Tim Wojtulewicz
70c2397f69 Plugins: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the plugin classes.
2020-08-24 12:07:03 -07:00
Tim Wojtulewicz
046eb58b75 Merge remote-tracking branch 'origin/topic/timw/266-namespaces-part4'
* origin/topic/timw/266-namespaces-part4: (34 commits)
  Add missing namespace to usage of get_exe_path in fuzzer
  Rename methods in RunState to remove 'net' from their names
  Move zeek::net namespace to zeek::run_state namespace.
  Move ScannedFile class and associated globals into ScannedFile.h and out of Net.h and scan.l
  Rename types in ZeekList.h to be consistent with the style guide
  Move NetVar from zeek to zeek::detail namespace
  Remove PRI_PTR_COMPAT macros
  Fix indentation of namespaced aliases
  Move zeek-setup code into namespaces
  Move ZeekList types to zeek namespace
  Move __RegisterBif from zeek::detail::plugin to zeek::plugin::detail
  Remove unimplemented zeek_magic_path/bro_magic_path method
  Move all plugin classes into zeek::plugin::detail namespaces
  Rename BroList.h to ZeekList.h
  Move a few smaller files to zeek namespaces
  Tag the end of some namespaces for consistency
  Move a few of the zeek::util methods and variables to zeek::util::detail
  Move zeekygen code to zeek::zeekygen::detail namespace
  Mark zeek::util::pad_size as constexpr, which provides a small performance improvement
  Move everything in util.h to zeek::util namespace.
  ...
2020-08-21 08:37:38 -07:00
Tim Wojtulewicz
4b61d60e80 Fix indentation of namespaced aliases 2020-08-20 16:11:46 -07:00
Tim Wojtulewicz
914ffcadae Move arp, tcp, udp, pia, and stepping stone analyzers 2020-08-20 15:55:17 -07:00
Tim Wojtulewicz
f597e925aa Remove a few protected or private no-op constructors 2020-08-19 15:19:01 -07:00
Tim Wojtulewicz
7fefdd97af Move Conn and related types to zeek namespace 2020-07-31 16:25:54 -04:00
Tim Wojtulewicz
0355d13099 Move reassembler code to namespaces 2020-07-31 16:25:54 -04:00
Tim Wojtulewicz
910aa77d95 Move BroFile to zeek namespace, rename to File 2020-07-31 16:22:56 -04:00
Tim Wojtulewicz
9400b863ea Move all base analyzer classes to zeek::analyzer namespace 2020-07-31 16:21:46 -04:00
Tim Wojtulewicz
ec9eff0bd5 Use type aliases for IntrusivePtr definitions 2020-06-30 20:37:30 -07:00
Tim Wojtulewicz
9364e6a5b7 Move IntrusivePtr and utility methods to the zeek namespace 2020-06-30 20:19:12 -07:00
Jon Siwek
0f5bb4b83d Change {Get,Set}ContentsFile() to use IntrusivePtr 2020-05-15 17:45:39 -07:00
Tim Wojtulewicz
485d9d5458 Mark the majority of the analyzer classes as final, where appropriate.
Most of these came from use of the -Wsuggest-final-types flag for gcc.
2020-04-03 18:44:09 -04: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
Max Kellermann
0db61f3094 include cleanup
The Zeek code base has very inconsistent #includes.  Many sources
included a few headers, and those headers included other headers, and
in the end, nearly everything is included everywhere, so missing
#includes were never noticed.  Another side effect was a lot of header
bloat which slows down the build.

First step to fix it: in each source file, its own header should be
included first to verify that each header's includes are correct, and
none is missing.

After adding the missing #includes, I replaced lots of #includes
inside headers with class forward declarations.  In most headers,
object pointers are never referenced, so declaring the function
prototypes with forward-declared classes is just fine.

This patch speeds up the build by 19%, because each compilation unit
gets smaller.  Here are the "time" numbers for a fresh build (with a
warm page cache but without ccache):

Before this patch:

 3144.94user 161.63system 3:02.87elapsed 1808%CPU (0avgtext+0avgdata 2168608maxresident)k
 760inputs+12008400outputs (1511major+57747204minor)pagefaults 0swaps

After this patch:

 2565.17user 141.83system 2:25.46elapsed 1860%CPU (0avgtext+0avgdata 1489076maxresident)k
 72576inputs+9130920outputs (1667major+49400430minor)pagefaults 0swaps
2020-02-04 20:51:02 +01:00
Tim Wojtulewicz
0f8f53808e Use bools instead of single-bit bitfields in Ident and TCP protocol analyzers 2020-01-07 12:07:58 -07:00
Robin Sommer
c23764483d Merge remote-tracking branch 'origin/topic/jsiwek/reassembly-improvements-map'
* origin/topic/jsiwek/reassembly-improvements-map:
  Rename a reassembly DataBlockList function
  Add comments to reassembly classes
  Use DataBlock value instead of pointer in reassembly map
  Remove linked list from reassembly data structures
  Use an std::map for reassembly DataBlock searches
  Refactor Reassembler/DataBlock bookkeeping
  Reorganize reassembly data structures
  Remove a superfluous reassembler DataBlock member
2019-09-24 09:16:51 +00:00
Dominik Charousset
c1f3fe7829 Switch from header guards to pragma once 2019-09-17 14:10:30 +02:00
Jon Siwek
0caa30076f Add comments to reassembly classes 2019-09-13 15:23:03 -07:00
Jon Siwek
69d1620374 Use DataBlock value instead of pointer in reassembly map 2019-09-13 14:17:41 -07:00
Jon Siwek
e1e779e90b Remove linked list from reassembly data structures
Everything, including iteration is now done via an std::map
2019-09-13 13:57:32 -07:00
Jon Siwek
b19c8fad7a Reorganize reassembly data structures
Started by factoring some details into a new DataBlockList class to at
least make it more clear where modifications occur.  More abstractions
likely to happen later as I experiment with alternate data structures
aimed at improving worse-case scenarios.
2019-09-11 16:25:34 -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
Johanna Amann
474efe9e69 Remove value serialization.
Note - this compiles, but you cannot run Bro anymore - it crashes
immediately with a 0-pointer access. The reason behind it is that the
required clone functionality does not work anymore.
2019-05-09 11:54:38 -07:00
Johanna Amann
6d612ced3d Mark one-parameter constructors as explicit & use override where possible
This commit marks (hopefully) ever one-parameter constructor as explicit.

It also uses override in (hopefully) all circumstances where a virtual
method is overridden.

There are a very few other minor changes - most of them were necessary
to get everything to compile (like one additional constructor). In one
case I changed an implicit operation to an explicit string conversion -
I think the automatically chosen conversion was much more convoluted.

This took longer than I want to admit but not as long as I feared :)
2018-03-27 07:17:32 -07:00
Seth Hall
a58c308427 Adding override/final to overridden virtual methods.
C++11 compilers complain about overridden virtual methods
not being specified as either final or overridden.
2016-01-16 23:35:31 -05:00
Robin Sommer
a83d97937e Extending rexmit_inconsistency() event to receive an additional
parameter with the packet's TCP flags, if available.
2015-10-26 14:16:08 -07:00
Jon Siwek
cbbe7b52dc Review/fix/change file reassembly functionality.
- Re-arrange how some fa_file fields (e.g. source, connection info, mime
  type) get updated/set for consistency.

- Add more robust mechanisms for flushing the reassembly buffer.
  The goal being to report all gaps and deliveries to file analyzers
  regardless of the state of the reassembly buffer at the time it has to
  be flushed.
2014-12-16 14:05:15 -06:00
Jon Siwek
f1cef9d2a9 Fix issue w/ TCP reassembler not delivering some segments.
For example, if we have a connection between TCP "A" and TCP "B" and "A"
sends segments "1" and "2", but we don't see the first and then the next
acknowledgement from "B" is for everything up to, and including, "2",
the gap would be reported to include both segments instead of just the
first and then delivering the second.  Put generally: any segments that
weren't yet delivered because they're waiting for an earlier gap to be
filled would be dropped when an ACK comes in that includes the gap as
well as those pending segments.  (If a distinct ACK was seen for just
the gap, that situation would have worked).

Addresses BIT-1246.
2014-09-11 10:47:56 -05:00
Jon Siwek
2b3c2bd394 Fix reassembly of data w/ sizes beyond 32-bit capacities (BIT-348).
The main change is that reassembly code (e.g. for TCP) now uses
int64/uint64 (signedness is situational) data types in place of int
types in order to support delivering data to analyzers that pass 2GB
thresholds.  There's also changes in logic that accompany the change in
data types, e.g. to fix TCP sequence space arithmetic inconsistencies.

Another significant change is in the Analyzer API: the *Packet and
*Undelivered methods now use a uint64 in place of an int for the
relative sequence space offset parameter.
2014-04-09 13:03:24 -05:00
Jon Siwek
066473b1f1 Improve analysis of TCP SYN/SYN-ACK reversal situations.
- Since it's just the handshake packets out of order, they're no
  longer treated as partial connections, which some protocol analyzers
  immediately refuse to look at.

- The TCP_Reassembler "is_orig" state failed to change, which led to
  protocol analyzers sometimes using the wrong value for that.

- Add a unit test which exercises the Connection::FlipRoles() code
  path (i.e. the SYN/SYN-ACK reversal situation).

Addresses BIT-1148.
2014-03-11 17:03:59 -05:00
Robin Sommer
4bc2ba60c9 Rename analyzer/protocols -> analyzer/protocol 2013-04-19 15:50:57 -07:00
Renamed from src/analyzer/protocols/tcp/TCP_Reassembler.h (Browse further)