mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
split update_zones_regex into two functions
This commit is contained in:
parent
4a04b563f5
commit
dc1102e9dd
1 changed files with 12 additions and 9 deletions
|
@ -242,12 +242,15 @@ function update_local_nets_table(id: string, new_value: set[subnet]): set[subnet
|
||||||
return new_value;
|
return new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_zones_regex(id: string, new_value: set[string]): set[string]
|
function update_local_zones_regex(id: string, new_value: set[string]): set[string]
|
||||||
{
|
{
|
||||||
# Double backslashes are needed due to string parsing.
|
# Double backslashes are needed due to string parsing.
|
||||||
if ( id == "Site::local_zones" )
|
|
||||||
local_dns_suffix_regex = set_to_regex(new_value, "(^\\.?|\\.)(~~)$");
|
local_dns_suffix_regex = set_to_regex(new_value, "(^\\.?|\\.)(~~)$");
|
||||||
else if ( id == "Site::neighbor_zones" )
|
return new_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_neighbor_zones_regex(id: string, new_value: set[string]): set[string]
|
||||||
|
{
|
||||||
local_dns_neighbor_suffix_regex = set_to_regex(new_value, "(^\\.?|\\.)(~~)$");
|
local_dns_neighbor_suffix_regex = set_to_regex(new_value, "(^\\.?|\\.)(~~)$");
|
||||||
return new_value;
|
return new_value;
|
||||||
}
|
}
|
||||||
|
@ -255,12 +258,12 @@ function update_zones_regex(id: string, new_value: set[string]): set[string]
|
||||||
event zeek_init() &priority=10
|
event zeek_init() &priority=10
|
||||||
{
|
{
|
||||||
Option::set_change_handler("Site::local_nets", update_local_nets_table);
|
Option::set_change_handler("Site::local_nets", update_local_nets_table);
|
||||||
Option::set_change_handler("Site::local_zones", update_zones_regex);
|
Option::set_change_handler("Site::local_zones", update_local_zones_regex);
|
||||||
Option::set_change_handler("Site::neighbor_zones", update_zones_regex);
|
Option::set_change_handler("Site::neighbor_zones", update_neighbor_zones_regex);
|
||||||
|
|
||||||
# Use change handler to initialize local_nets mapping table and zones
|
# Use change handler to initialize local_nets mapping table and zones
|
||||||
# regexes.
|
# regexes.
|
||||||
update_local_nets_table("Site::local_nets", Site::local_nets);
|
update_local_nets_table("Site::local_nets", Site::local_nets);
|
||||||
update_zones_regex("Site::local_zones", Site::local_zones);
|
update_local_zones_regex("Site::local_zones", Site::local_zones);
|
||||||
update_zones_regex("Site::neighbor_zones", Site::neighbor_zones);
|
update_neighbor_zones_regex("Site::neighbor_zones", Site::neighbor_zones);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue