annotate base scripts with &is_used as needed

This commit is contained in:
Vern Paxson 2022-05-05 11:13:13 -07:00 committed by Tim Wojtulewicz
parent d9479c0502
commit 9b8ac44169
8 changed files with 18 additions and 17 deletions

View file

@ -57,7 +57,7 @@ global option_cache: table[string] of OptionCacheValue;
global Config::cluster_set_option: event(ID: string, val: any, location: string); global Config::cluster_set_option: event(ID: string, val: any, location: string);
function broadcast_option(ID: string, val: any, location: string) function broadcast_option(ID: string, val: any, location: string) &is_used
{ {
# There's not currently a common topic to broadcast to as then enabling # There's not currently a common topic to broadcast to as then enabling
# implicit Broker forwarding would cause a routing loop. # implicit Broker forwarding would cause a routing loop.
@ -145,7 +145,7 @@ function format_value(value: any) : string
return cat(value); return cat(value);
} }
function config_option_changed(ID: string, new_value: any, location: string): any function config_option_changed(ID: string, new_value: any, location: string): any &is_used
{ {
local log = Info($ts=network_time(), $id=ID, $old_value=format_value(lookup_ID(ID)), $new_value=format_value(new_value)); local log = Info($ts=network_time(), $id=ID, $old_value=format_value(lookup_ID(ID)), $new_value=format_value(new_value));
if ( location != "" ) if ( location != "" )

View file

@ -74,7 +74,7 @@ export {
global shutdown_response: event(); global shutdown_response: event();
} }
event terminate_event() event terminate_event() &is_used
{ {
terminate(); terminate();
} }

View file

@ -587,7 +587,7 @@ global filters: table[ID, string] of Filter;
module Log; module Log;
# Used internally by the log manager. # Used internally by the log manager.
function __default_rotation_postprocessor(info: RotationInfo) : bool function __default_rotation_postprocessor(info: RotationInfo) : bool &is_used
{ {
if ( info$writer in default_rotation_postprocessors ) if ( info$writer in default_rotation_postprocessors )
return default_rotation_postprocessors[info$writer](info); return default_rotation_postprocessors[info$writer](info);

View file

@ -459,8 +459,9 @@ function software_endpoint_name(id: conn_id, host: addr): string
return fmt("%s %s", host, (host == id$orig_h ? "client" : "server")); return fmt("%s %s", host, (host == id$orig_h ? "client" : "server"));
} }
# Convert a version into a string "a.b.c-x". # Convert a version into a string "a.b.c-x". Marked "&is_used" because
function software_fmt_version(v: Version): string # while the base scripts don't call it, the optional policy/ scripts do.
function software_fmt_version(v: Version): string &is_used
{ {
return fmt("%s%s%s%s%s", return fmt("%s%s%s%s%s",
v?$major ? fmt("%d", v$major) : "0", v?$major ? fmt("%d", v$major) : "0",
@ -470,8 +471,8 @@ function software_fmt_version(v: Version): string
v?$addl ? fmt("-%s", v$addl) : ""); v?$addl ? fmt("-%s", v$addl) : "");
} }
# Convert a software into a string "name a.b.cx". # Convert a software into a string "name a.b.cx". Same as above re "&is_used".
function software_fmt(i: Info): string function software_fmt(i: Info): string &is_used
{ {
return fmt("%s %s", i$name, software_fmt_version(i$version)); return fmt("%s %s", i$name, software_fmt_version(i$version));
} }

View file

@ -330,7 +330,7 @@ function compose_resultvals(rv1: ResultVal, rv2: ResultVal): ResultVal
return result; return result;
} }
function compose_results(r1: Result, r2: Result): Result function compose_results(r1: Result, r2: Result): Result &is_used
{ {
local result: Result = table(); local result: Result = table();

View file

@ -13,7 +13,7 @@ export {
global enable: bool = T &redef; global enable: bool = T &redef;
} }
function should_detect(): bool function should_detect(): bool &is_used
{ {
local args = zeek_args(); local args = zeek_args();

View file

@ -71,7 +71,7 @@ event zeek_init() &priority=5
# Establish the variable for tracking expected connections. # Establish the variable for tracking expected connections.
global ftp_data_expected: table[addr, port] of Info &read_expire=5mins; global ftp_data_expected: table[addr, port] of Info &read_expire=5mins;
function minimize_info(info: Info): Info function minimize_info(info: Info): Info &is_used
{ {
# Just minimal data for sending to other remote Zeek processes. # Just minimal data for sending to other remote Zeek processes.
# Generally, only data that's consistent across an entire FTP session or # Generally, only data that's consistent across an entire FTP session or
@ -103,7 +103,7 @@ const directory_cmds = {
["XPWD", 257], ["XPWD", 257],
}; };
function ftp_relay_topic(): string function ftp_relay_topic(): string &is_used
{ {
local rval = Cluster::rr_topic(Cluster::proxy_pool, "ftp_transfer_rr_key"); local rval = Cluster::rr_topic(Cluster::proxy_pool, "ftp_transfer_rr_key");
@ -176,7 +176,7 @@ function ftp_message(s: Info)
delete s$data_channel; delete s$data_channel;
} }
event sync_add_expected_data(s: Info, chan: ExpectedDataChannel) event sync_add_expected_data(s: Info, chan: ExpectedDataChannel) &is_used
{ {
@if ( Cluster::local_node_type() == Cluster::PROXY || @if ( Cluster::local_node_type() == Cluster::PROXY ||
Cluster::local_node_type() == Cluster::MANAGER ) Cluster::local_node_type() == Cluster::MANAGER )
@ -189,7 +189,7 @@ event sync_add_expected_data(s: Info, chan: ExpectedDataChannel)
@endif @endif
} }
event sync_remove_expected_data(resp_h: addr, resp_p: port) event sync_remove_expected_data(resp_h: addr, resp_p: port) &is_used
{ {
@if ( Cluster::local_node_type() == Cluster::PROXY || @if ( Cluster::local_node_type() == Cluster::PROXY ||
Cluster::local_node_type() == Cluster::MANAGER ) Cluster::local_node_type() == Cluster::MANAGER )

View file

@ -33,7 +33,7 @@ export {
global dcc_expected_transfers: table[addr, port] of Info &read_expire=5mins; global dcc_expected_transfers: table[addr, port] of Info &read_expire=5mins;
function dcc_relay_topic(): string function dcc_relay_topic(): string &is_used
{ {
local rval = Cluster::rr_topic(Cluster::proxy_pool, "dcc_transfer_rr_key"); local rval = Cluster::rr_topic(Cluster::proxy_pool, "dcc_transfer_rr_key");
@ -44,7 +44,7 @@ function dcc_relay_topic(): string
return rval; return rval;
} }
event dcc_transfer_add(host: addr, p: port, info: Info) event dcc_transfer_add(host: addr, p: port, info: Info) &is_used
{ {
@if ( Cluster::local_node_type() == Cluster::PROXY || @if ( Cluster::local_node_type() == Cluster::PROXY ||
Cluster::local_node_type() == Cluster::MANAGER ) Cluster::local_node_type() == Cluster::MANAGER )
@ -56,7 +56,7 @@ event dcc_transfer_add(host: addr, p: port, info: Info)
@endif @endif
} }
event dcc_transfer_remove(host: addr, p: port) event dcc_transfer_remove(host: addr, p: port) &is_used
{ {
@if ( Cluster::local_node_type() == Cluster::PROXY || @if ( Cluster::local_node_type() == Cluster::PROXY ||
Cluster::local_node_type() == Cluster::MANAGER ) Cluster::local_node_type() == Cluster::MANAGER )