New variable in utils/site for mapping address to defined local subnet.

- Site::local_nets_table[1.2.3.4] might yield "1.2.0.0/16" if that
  subnet is defined in the Site::local_nets variable.
This commit is contained in:
Seth Hall 2011-08-09 11:15:07 -04:00
parent 29425c29e2
commit 5f61c9bde9

View file

@ -16,6 +16,10 @@ export {
## Networks that are considered "local".
const local_nets: set[subnet] &redef;
## This is used for mapping between local networks and string
## values for the CIDRs represented.
global local_nets_table: table[subnet] of string = {};
## Networks that are considered "neighbors".
const neighbor_nets: set[subnet] &redef;
@ -138,4 +142,9 @@ event bro_init() &priority=10
# Double backslashes are needed due to string parsing.
local_dns_suffix_regex = set_to_regex(local_zones, "(^\\.?|\\.)(~~)$");
local_dns_neighbor_suffix_regex = set_to_regex(neighbor_zones, "(^\\.?|\\.)(~~)$");
# Create the local_nets mapping table.
for ( cidr in Site::local_nets )
local_nets_table[cidr] = fmt("%s", cidr);
}