Commit graph

338 commits

Author SHA1 Message Date
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Christian Kreibich
cd066f09bf Fix perftools-enabled build 2021-06-24 16:02:45 -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
Jon Siwek
faf6d4ec1a Rename a 'do_net_run' variable to 'do_run_loop'
For clarity, since the net_run() function was renamed to run_loop().
2020-12-14 13:07:47 -08: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
54215ab9cd Rename methods in RunState to remove 'net' from their names 2020-08-20 16:11:47 -07:00
Tim Wojtulewicz
0ac3fafe13 Move zeek::net namespace to zeek::run_state namespace.
This also moves all of the code from Net.{h,cc} to RunState.{h,cc} and marks Net.h as deprecated
2020-08-20 16:11:47 -07:00
Tim Wojtulewicz
8d2d867a65 Move everything in util.h to zeek::util namespace.
This commit includes renaming a number of methods prefixed with bro_ to be prefixed with zeek_.
2020-08-20 16:00:33 -07:00
Tim Wojtulewicz
e7c6d51ae7 Move the functions and variables in Net.h to the zeek::net namespace. This includes moving network_time out of util.h. 2020-08-20 15:55:17 -07:00
Tim Wojtulewicz
be92bd536f Move iosource code to zeek namespaces 2020-08-20 15:55:17 -07:00
Tim Wojtulewicz
fdcb2760b2 Move Stats and related classes to zeek::detail 2020-07-31 16:25:53 -04:00
Tim Wojtulewicz
1c17700c48 Move Timer and PriorityQueue classes to namespaces 2020-07-31 16:23:02 -04:00
Jon Siwek
d00b3a8daa Move ParentProcessCheckTimer to detail namespace 2020-07-07 18:38:38 -07:00
Jon Siwek
0db5c920f2 Deprecate names in BifConst, replace with zeek::BifConst
Some Val* types are also replaced with IntrusivePtr at the new location
2020-05-14 17:26:00 -07:00
Jon Siwek
2d0b8c0b8e Use zeek::detail namespace for fuzzer utils 2020-05-04 17:37:11 -07:00
Jon Siwek
8f1b34b915 Add basic structure for fuzzing targets
General changes:

* Add -D/--deterministic command line option as
  convenience/alternative to -G/--load-seeds (i.e. no file needed, it just
  uses zero-initialized random seeds).  It also changes Broker data
  stores over to using deterministic timing rather than real time.

* Add option to make Reporter abort on runtime scripting errors
2020-04-23 12:51:25 -07:00
Tim Wojtulewicz
0a47588d0b The remaining nulls 2020-04-07 16:08:34 -07:00
Jon Siwek
6980f63a91 Deprecate EventMgr::QueueEventFast() and update usages to Enqueue() 2020-03-25 16:09:33 -07:00
Jon Siwek
4e1ac4e124 Use vector<IntrusivePtr<Val>> for Func::Call and Event queuing args
This change may break BIFs that use @ARGS@, @ARG@, or @ARGC@ since their
types have changed.
2020-03-24 16:50:18 -07:00
Jon Siwek
71b82595ba GH-857: fix redefining record types used to index tables
This change tracks all TableVals created at parse-time whose index
depends on a given RecordType.  Should that RecordType be redef'd, those
TableVals are immediately rebuilt such that they are valid to
subsequently use in either parse-time initializations or eventually in
any arbitrary run-time expression.
2020-03-12 18:25:48 -07:00
Jon Siwek
a61ad9ea5c Change RecordVals to get resized at time of RecordType redef
Opposed to unconditionally checking all RecordVals whether they need to
be resized after parsing ends.
2020-03-12 15:51:37 -07:00
Max Kellermann
edde591748 ID: use class IntrusivePtr 2020-02-27 14:08:00 +01:00
Max Kellermann
56e8a5f116 main: destroy event_registry after iosource_mgr
Fixes use-after-free bugs because PcapSource::Close() queues an event.
2020-02-27 12:02:55 +01:00
Max Kellermann
b654a68c86 main: free the global scope in terminate_bro()
Make valgrind a bit happier.
2020-02-27 12:02:55 +01:00
Tim Wojtulewicz
4f23c0360a GH-773: Make EventMgr an IOSource so that events interrupt kevent waits 2020-02-05 15:43:37 -05: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
Jon Siwek
2f36113743 Change packet source fields of Options to std::optional 2020-01-31 15:41:23 -08:00
Tim Wojtulewicz
0cfb115c1b Update Supervisor code for the new IOSource API 2020-01-31 10:13:10 -07:00
Tim Wojtulewicz
be42608b51 Remove concept of multiple timer managers
- All timers are now handled by a single global timer manager, which simplifies how they handled by the IOSource manager.
- This change flows down a number of changes to other parts of the code. The timer manager tag field is removed, which means that matching connections to a timer manager is also removed. This removes the ability to tag a connection as internal or external, since that's how the connections where differentiated. This in turn removes the `current_conns_extern` field from the `ConnStats` record type in the script layer.
2020-01-31 10:13:09 -07:00
Tim Wojtulewicz
c4d9566294 DNS_Mgr changes to match the new IOSource API and loop architecture 2020-01-31 10:13:09 -07:00
Tim Wojtulewicz
a159d075cf Add Trigger manager for managing triggers created by things like 'when' statements
- Adds new trigger namespace
- Adds trigger::Manager class as a new IOSource for keeping track of triggers and integrating them into the loop. Previously the loop relied on the event manager Drain() method to process all triggers on every loop, but now that the loop actively waits for events to occur, triggers would not fire when they needed to. Adding them as part of the loop ensures they're checked.
2020-01-31 10:13:09 -07:00
Tim Wojtulewicz
92bde61b78 Make TimerMgr an IOSource
- This allows the loop to check what the next timeout is and use that as the basis for the timeout of the poll
- This commit also removes the TimerMgr::Tag type, since it causes a name clash with other code in IOSource
2020-01-31 10:13:09 -07:00
Tim Wojtulewicz
4fa3e4b9b4 Modify IOSource Manager to implement new loop architecture
- Removes entire FindSoonest method that includes all of the calls to select() for checking for ready sources
- Removes FD_Set checking against IOSources
- Adds system for registering and unregistering file descriptors from IOSources. This allows individual sources to mark themselves as ready to be checked by the loop as they become available.
- Adds entirely new loop architecture based on checking the IOSources for when their next timeout is, and then waiting for either that timeout or when the next source is ready. This also implements the polling based on what the OS supports, instead of just calling select() on all platforms. Currently it supports kqueue, epoll, and plain poll.
- Adds system for pinging the loop to force it to wake up
2020-01-31 10:13:09 -07:00
Tim Wojtulewicz
f16f0360ff Only allow a single trace file (-r) or interface (-i) option on the command-line 2020-01-31 09:34:54 -07:00
Jon Siwek
70b45d1aba Merge remote-tracking branch 'origin/topic/robin/631-deprecation-v2'
During merge I split the test for bro_init/bro_done/bro_script_loaded
event errors into individual tests since the other testing of the zeek
versions of those events seemed fine to otherwise keep.

* origin/topic/robin/631-deprecation-v2:
  Update NEWS for naming changes.
  Small cleanup and updating submodules.
  Remove test for legacy plugin.
  Remove legancy symlinks in aux/.
  Add warnings when loading scripts ending in ".bro", or using legacy environment variables.
  Fix missing rename.
  No longer symlink local.zeek to local.bro.
  Update notice user agent.
  Remove old_comm_usage_is_ok.
  Remove bro-config.h.in and bro-path-dev.in.
  Change Bro wrapper script to now abort when old executable names are still used.
  Remove APIs that were explicitly deprecated to be removed in 3.1.
2020-01-30 19:19:56 -08:00
Robin Sommer
d0b206fa36 Remove APIs that were explicitly deprecated to be removed in 3.1.
Special handling for bro_{init,done,script_loaded} events: if still
used, they cause Zeek to abort at startup.
2020-01-29 12:08:09 +00:00
Jon Siwek
53363a9bd3 Move command-line arg parsing functions to Options.{h,cc} 2020-01-27 13:50:44 -08:00
Jon Siwek
59e075acab Move supervisor source files into supervisor/ 2020-01-22 11:23:10 -08:00
Jon Siwek
718879735e Address supervisor code re-factoring feedback from Robin 2020-01-21 22:26:17 -08:00
Jon Siwek
8a145ee1a2 Fix supervised node inheritence of command-line script paths
They're now converting to absolute paths in the argument parsing phase
such that if a supervised node switches working directory, it can still
load the referenced script.
2020-01-16 13:11:04 -08:00
Jon Siwek
dbca14e1fc Use a timer to check for death of supervised node's parent 2020-01-15 15:27:53 -08:00
Jon Siwek
7ddd311583 Improve supervisor checks for parent process termination
Comparing parent process ID to 1 to detect loss of parent process was
not necessarily portable, so now it stores parent PID pre-fork and then
monitors for any change.
2020-01-15 14:42:13 -08:00
Jon Siwek
899a987527 Improve handling of premature supervisor stem exit
i.e. if the stem process terminates before the supervisor registers a
SIGCHLD handler.
2020-01-14 20:25:27 -08:00
Jon Siwek
3e1a9ebec3 Remove unused supervisor config options
Since those related to offline pcap reading are not implemented yet.
2020-01-14 17:33:37 -08:00
Jon Siwek
4d712d6203 Cleanup minor Supervisor TODOs
e.g. Mainly making default parameter for restart/destroy/status API
calls to operate on all nodes.
2020-01-14 13:41:46 -08:00
Jon Siwek
80b3aef486 Improve supervisor debug logging
Mainly making stem process debug messages sent up to parent supervisor
process and included in its debug.log though option to print to stderr
remains in form of environment variable in case debugging breaking
change to the IPC mechanism itself.
2020-01-14 11:24:46 -08:00
Jon Siwek
0ff99c3df8 Separate supervisor node config and status data structures 2020-01-13 20:09:05 -08:00
Jon Siwek
520c6e3ebf Merge branch 'master' into topic/jsiwek/supervisor 2020-01-13 10:27:34 -08:00
Jon Siwek
5191e14eff Add stdout/stderr redirection option to supervised node config 2020-01-10 19:48:31 -08:00
Jon Siwek
263a5f404a Add cpu affinity option to supervised node config 2020-01-10 18:25:42 -08:00