From 452701bef32c07e0c2a49d37fac93a94038dace1 Mon Sep 17 00:00:00 2001 From: Robert Schindler Date: Mon, 20 Jul 2020 16:02:26 +0200 Subject: dhcp-server: T2717: Fix DHCP pool size in statistics The calculated size of DHCP server address pools was not corrent. The fact that both boundaries of address ranges are inclusive wasn't accounted for, so the calculated size was too small by 1 address per range. --- src/op_mode/show_dhcp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/op_mode/show_dhcp.py b/src/op_mode/show_dhcp.py index f9577e57e..ff1e3cc56 100755 --- a/src/op_mode/show_dhcp.py +++ b/src/op_mode/show_dhcp.py @@ -161,7 +161,8 @@ def get_pool_size(config, pool): start = config.return_effective_value("service dhcp-server shared-network-name {0} subnet {1} range {2} start".format(pool, s, r)) stop = config.return_effective_value("service dhcp-server shared-network-name {0} subnet {1} range {2} stop".format(pool, s, r)) - size += int(ip_address(stop)) - int(ip_address(start)) + # Add +1 because both range boundaries are inclusive + size += int(ip_address(stop)) - int(ip_address(start)) + 1 return size -- cgit v1.2.3