mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Fix registration of protocol analyzers from inside plugins.
With the recent packet manager work, it broke to register a protocol analyzer for a specific port from inside a plugin's initialization code. That's because that registration now depends on the packet manager being set up, which isn't case at that time a plugin's `InitPostInit()` runs. This fix contains two parts: - Initialize the packet manager before the analyzer manager, so that the latter's `InitPostScript()` can rely on the former being ready. - Change the analyzer manager to (only) record port registrations happening before it's fully initialized. Its `InitPostScript()` then performs the actual registrations, knowing it can use the packet manager now. This comes with a `cmake/` to add a missing include directory.
This commit is contained in:
parent
6e3d2d4516
commit
a7343ee019
9 changed files with 59 additions and 7 deletions
|
@ -87,8 +87,8 @@ int perftools_profile = 0;
|
|||
#endif
|
||||
|
||||
zeek::ValManager* zeek::val_mgr = nullptr;
|
||||
zeek::analyzer::Manager* zeek::analyzer_mgr = nullptr;
|
||||
zeek::packet_analysis::Manager* zeek::packet_mgr = nullptr;
|
||||
zeek::analyzer::Manager* zeek::analyzer_mgr = nullptr;
|
||||
zeek::plugin::Manager* zeek::plugin_mgr = nullptr;
|
||||
|
||||
zeek::detail::RuleMatcher* zeek::detail::rule_matcher = nullptr;
|
||||
|
@ -253,8 +253,8 @@ static void done_with_network()
|
|||
|
||||
run_state::terminating = true;
|
||||
|
||||
analyzer_mgr->Done();
|
||||
packet_mgr->Done();
|
||||
analyzer_mgr->Done();
|
||||
timer_mgr->Expire();
|
||||
dns_mgr->Flush();
|
||||
event_mgr.Drain();
|
||||
|
@ -324,8 +324,8 @@ static void terminate_bro()
|
|||
plugin_mgr->FinishPlugins();
|
||||
|
||||
delete zeekygen_mgr;
|
||||
delete analyzer_mgr;
|
||||
delete packet_mgr;
|
||||
delete analyzer_mgr;
|
||||
delete file_mgr;
|
||||
// broker_mgr, timer_mgr, and supervisor are deleted via iosource_mgr
|
||||
delete iosource_mgr;
|
||||
|
@ -577,8 +577,8 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
|||
|
||||
iosource_mgr = new iosource::Manager();
|
||||
event_registry = new EventRegistry();
|
||||
analyzer_mgr = new analyzer::Manager();
|
||||
packet_mgr = new packet_analysis::Manager();
|
||||
analyzer_mgr = new analyzer::Manager();
|
||||
log_mgr = new logging::Manager();
|
||||
input_mgr = new input::Manager();
|
||||
file_mgr = new file_analysis::Manager();
|
||||
|
@ -708,8 +708,8 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
|||
exit(success ? 0 : 1);
|
||||
}
|
||||
|
||||
analyzer_mgr->InitPostScript();
|
||||
packet_mgr->InitPostScript();
|
||||
analyzer_mgr->InitPostScript();
|
||||
file_mgr->InitPostScript();
|
||||
dns_mgr->InitPostScript();
|
||||
|
||||
|
@ -916,8 +916,8 @@ SetupResult setup(int argc, char** argv, Options* zopts)
|
|||
reporter->FatalError("errors occurred while initializing");
|
||||
|
||||
run_state::detail::zeek_init_done = true;
|
||||
analyzer_mgr->DumpDebug();
|
||||
packet_mgr->DumpDebug();
|
||||
analyzer_mgr->DumpDebug();
|
||||
|
||||
run_state::detail::have_pending_timers = ! run_state::reading_traces && timer_mgr->Size() > 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue