introduce -A arg: treat single subnets as shared-network with CIDR as their name

Current output makes some false-positives for situations when multiple
ranges are specified inside single network, for example:

subnet 10.0.0.0 netmask 255.255.254.0 {
	...
	range 10.0.0.1 10.0.0.254;
	range 10.0.1.1 10.0.1.253;
	...
}

An alert for range 10.0.0.1 - 10.0.0.254 will be raised even in situations
when range 10.0.1.1 - 10.0.1.253 is completely empty.  To cope with this
issue, an -A option is added to treat all single networks as shared-network.
This option changes output for both range and shared networks output if
specified.  Frankly saying, using network CIDR as network name is much more
sane for me than 'All Networks'.

Signed-off-by: Boris Lytochkin <lytboris@yandex-team.ru>
This commit is contained in:
Boris Lytochkin 2016-12-04 17:09:32 +03:00 committed by Sami Kerola
parent dff991666e
commit b9cff0d814
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
6 changed files with 54 additions and 3 deletions

View file

@ -108,6 +108,7 @@ struct shared_network_t {
double used;
double touched;
double backups;
int netmask;
};
/*! \struct range_t
* \brief Counters for an individual range.
@ -128,7 +129,9 @@ enum isc_conf_parser {
ITS_A_RANGE_FIRST_IP,
ITS_A_RANGE_SECOND_IP,
ITS_A_SHAREDNET,
ITS_AN_INCLUCE
ITS_AN_INCLUCE,
ITS_A_SUBNET,
ITS_A_NETMASK
};
/*! \enum ltype
* \brief Lease state types.
@ -196,6 +199,7 @@ struct configuration_t {
snet_alarms:1,
print_mac_addreses:1,
perfdata:1,
all_as_shared:1,
header_limit:3,
number_limit:3;
};