diff --git a/scripts/base/frameworks/config/main.zeek b/scripts/base/frameworks/config/main.zeek index 2d87e3c09e..47525ee7b7 100644 --- a/scripts/base/frameworks/config/main.zeek +++ b/scripts/base/frameworks/config/main.zeek @@ -162,13 +162,7 @@ event zeek_init() &priority=10 @if ( !Cluster::is_enabled() || Cluster::local_node_type() == Cluster::MANAGER ) # Iterate over all existing options and add ourselves as change handlers # with a low priority so that we can log the changes. - local gids = global_ids(); - for ( i, gid in gids ) - { - if ( ! gid$option_value ) - next; - - Option::set_change_handler(i, config_option_changed, -100); - } + for ( opt in global_options() ) + Option::set_change_handler(opt, config_option_changed, -100); @endif } diff --git a/scripts/base/utils/site.zeek b/scripts/base/utils/site.zeek index 7843bcf31a..7745d7b2c8 100644 --- a/scripts/base/utils/site.zeek +++ b/scripts/base/utils/site.zeek @@ -243,5 +243,4 @@ event zeek_init() &priority=10 # Create the local_nets mapping table. for ( cidr in Site::local_nets ) local_nets_table[cidr] = cidr; - } diff --git a/src/zeek.bif b/src/zeek.bif index 4665831d65..7b1085a57c 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -2022,6 +2022,25 @@ function global_ids%(%): id_table return ids; %} +## Returns a set giving the names of all global options. +function global_options%(%): string_set + %{ + auto options = make_intrusive(zeek::id::string_set); + const auto& globals = zeek::detail::global_scope()->Vars(); + + for ( const auto& global : globals ) + { + const auto& id = global.second; + if ( ! id->IsOption() ) + continue; + + auto id_name = zeek::make_intrusive(id->Name()); + options->Assign(std::move(id_name), nullptr); + } + + return options; + %} + ## Returns the value of a global identifier. ## ## id: The global identifier.