Commit graph

71 commits

Author SHA1 Message Date
Tim Wojtulewicz
d6e25a2e22 Switch IPv6_Hdr_Chain to a vector of objects instead of pointers 2025-06-23 10:41:23 -07:00
Tim Wojtulewicz
e84c99fb14 Fix clang-tidy cppcoreguidelines-macro-usage warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
d327d6388c Fix clang-tidy bugprone-implicit-widening-of-multiplication-result warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
b27eba6533 Fix clang-tidy bugprone-branch-clone warnings in headers 2025-06-23 08:35:24 -07:00
Tim Wojtulewicz
d0896e81d6 Increase size of proto fields to uint16_t, add common default value 2024-11-13 11:25:46 -07:00
Benjamin Bannier
26d04fd9fc Bump pre-commit hooks 2023-10-30 09:41:12 +01:00
Benjamin Bannier
f5a76c1aed Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
2023-10-30 09:40:55 +01:00
Tim Wojtulewicz
7e66261fd9 IP_Hdr: take length value as uint64_t instead of int 2023-02-22 16:39:54 -07:00
Tim Wojtulewicz
d5a1eb162e Add additional length checking to IPv6::ToVal 2022-11-17 12:05:26 -07:00
Elad Solomon
3a80b79497 Compile Zeek with MSVC
Allow Zeek to be embedded in another project
2022-11-09 18:15:30 +02:00
Johanna Amann
a011b4cb70 Packets with TSO: address review feedback.
This addresses review feedback of GH-1831 and additionally fixes one
case in which PayloadLen was used in a way that would have given
problematic results when TSO is enabled.
2021-11-09 15:11:27 +00:00
Johanna Amann
e14b695497 Accept packets that use tcp segment offloading.
When checksum offloading is enabled, we now forward packets that
have 0 header lengths set - and assume that they have TSO enabled.

If checksum offloading is not enabled, we drop the packets.

Addresses GH-1829
2021-10-28 17:12:54 +02:00
Tim Wojtulewicz
e97c14add5 clang-format: Other include ordering changes 2021-09-27 10:49:48 -07:00
Tim Wojtulewicz
9cb54f5d44 clang-format: Force zeek-config.h to be earlier in the config ordering 2021-09-25 11:52:55 -07:00
Tim Wojtulewicz
30aa4621c5 Minor fixes for build problems after reformatting 2021-09-16 15:36:09 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Tim Wojtulewicz
f849f024e5 Redo how reassembled flag is accessed in IP_Hdr, filling in a memory hole 2021-07-14 14:59:49 -07:00
Tim Wojtulewicz
b14cd1ef16 GH-1216: Enable Mobile IPv6 support by default
This removes the ENABLE_MOBILE_IPV6 #define variable. It also marks the
--enable-mobile-ipv6 configure argument as deprecated.
2021-06-28 11:11:55 -07:00
Tim Wojtulewicz
4ad08172d0 Remove obsolete ZEEK_FORWARD_DECLARE_NAMESPACED macros 2021-02-24 14:35:44 -07:00
Jon Siwek
8a8a983c49 Add missing zeek/ to header includes
Related to https://github.com/zeek/zeek/pull/1377
2021-01-29 19:16:29 -08: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
b3eb63c48a GH-1186: Remove Packet::hdr_size and uses of it.
This change also removes Packet::IP(), since Packet now contains an ip_hdr member
that points at the IP header if it exists.
2020-11-09 10:49:57 -07:00
Tim Wojtulewicz
1cf251d1ca Move IP and IP tunnel code from Sessions into packet analyzers 2020-10-15 12:18:30 -07:00
Tim Wojtulewicz
fe0c22c789 Base: Clean up explicit uses of namespaces in places where they're not necessary.
This commit covers all of the common and base classes.
2020-08-24 12:07:00 -07:00
Tim Wojtulewicz
0355d13099 Move reassembler code to namespaces 2020-07-31 16:25:54 -04:00
Tim Wojtulewicz
25c0fc7ab2 Move IP Addr/Prefix/Header classes into namespaces 2020-07-31 16:22:04 -04:00
Tim Wojtulewicz
64332ca22c Move all Val classes to the zeek namespaces 2020-06-30 20:48:09 -07: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
8a3cd4c65b Fix build: some don't like IntrusivePtr default arg w/ incomplete type 2020-05-22 00:09:14 -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
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
a525f9532e Remove other using statements from headers 2020-04-07 15:47:44 -07:00
Tim Wojtulewicz
a312851d6e IP: Cleanup initialization, make a few functions consistent with others 2020-02-27 12:36:17 -07:00
Max Kellermann
6a815b4b06 UID, ..: un-inline methods to reduce header dependencies
Only 1% build time speedup, but still, it declutters the headers a bit.

Before this patch:

 2565.17user 141.83system 2:25.46elapsed 1860%CPU (0avgtext+0avgdata 1489076maxresident)k
 72576inputs+9130920outputs (1667major+49400430minor)pagefaults 0swaps

After this patch:

 2537.19user 142.94system 2:26.90elapsed 1824%CPU (0avgtext+0avgdata 1434268maxresident)k
 16240inputs+8887152outputs (1931major+48728888minor)pagefaults 0swaps
2020-02-04 20:51:02 +01: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
Dominik Charousset
c1f3fe7829 Switch from header guards to pragma once 2019-09-17 14:10:30 +02: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
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
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
Jeff Barber
30fdc37479 Refactor to make bro use a common Packet object.
Do a better job of parsing layer 2 and keeping track of layer 3 proto.
Add support for raw packet event, including Layer2 headers.
2015-05-29 10:37:39 -04:00
Jon Siwek
d31b556b85 Change IP_Hdr copy ctor/assign to explicit method
Addresses BIT-1298
2014-12-12 14:14:24 -06:00
Jon Siwek
c211a2c91a Fix PIA packet replay to deliver copy of IP header
This prevented one from writing a packet-wise analyzer that needs access
to IP headers and can be attached to a connection via signature match.

None of the analyzers currently shipping are affected.  And maybe it's
unlikely there will be many that ever would be, but it's awkward for the
API to omit IP headers in this special case (i.e. packets buffer for use
with DPD signature matching).

Addresses BIT-1298
2014-12-10 15:12:38 -06:00
Robin Sommer
d6855dc4eb Pass over the InternalError() changes. 2013-10-11 15:11:06 -07:00
Jon Siwek
b828a6ddc7 Review usage of Reporter::InternalError, addresses BIT-1045.
Replaced some with InternalWarning or InternalAnalyzerError, the later
being a new method which signals the analyzer to not process further
input.  Some usages I just removed if they didn't make sense or clearly
couldn't happen.  Also did some minor refactors of related code while
reviewing/exploring ways to get rid of InternalError usages.

Also, for TCP content file write failures there's a new event:
"contents_file_write_failure".
2013-10-10 14:45:06 -05:00
Jon Siwek
5312b21d7b Improve availability of IPv6 flow label in connection records.
Without this change, flow labeling of connections over IPv6 are
only available in the per-packet types of events (e.g. new_packet)
in which header fields can be inspected, but now minimal tracking
of the most recent flow label is done internally and that's available
per-connection for all events that use connection record arguments.

Specifically, this adds a "flow_label" field to the "endpoint" record
type, which is used for both the "orig" and "resp" fields of
"connection" records.  The new "connection_flow_label_changed" event
also allows tracking of changes in flow labels: it's raised each time
one direction of the connection starts using a different label.
2012-05-22 15:18:33 -05:00
Robin Sommer
5350cab371 Merge remote-tracking branch 'origin/topic/icmp6'
* origin/topic/icmp6:
  Fixes for IPv6 truncation and ICMP/ICMP6 analysis.
  Change ICMPv6 checksum calculation to use IP_Hdr wrapper.
  Update IPv6 atomic fragment unit test to filter output of ICMPv6.
  Add more data to icmp events
  More code cleanup
  Add more icmpv6 events, and general code cleanup
  Fix compile failure after merge from master
  Significant edit pass over ICMPv6 code.
  Porting Matti's branch to git.

Closes #808.
2012-04-17 19:02:59 -07:00
Jon Siwek
6aa4f00159 Add more support for <netinet/ip6.h>'s that lack some structure definitions. 2012-04-13 14:59:38 -05:00