summaryrefslogtreecommitdiff
path: root/src/op_mode/show_dhcp.py
diff options
context:
space:
mode:
authorRobert Schindler <r.schindler@efficiosoft.com>2020-07-20 16:02:26 +0200
committerChristian Poessinger <christian@poessinger.com>2021-06-10 19:51:28 +0200
commitae59f14144ee158f46dbd5716b2c94d14deae829 (patch)
treeb753c64fb39c5f2dbb44c129af2c747d4330d187 /src/op_mode/show_dhcp.py
parentc23255302bbe4715ec99708b4ea2cca5be27733d (diff)
downloadvyos-1x-ae59f14144ee158f46dbd5716b2c94d14deae829.tar.gz
vyos-1x-ae59f14144ee158f46dbd5716b2c94d14deae829.zip
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. (cherry picked from commit 452701bef32c07e0c2a49d37fac93a94038dace1)
Diffstat (limited to 'src/op_mode/show_dhcp.py')
-rwxr-xr-xsrc/op_mode/show_dhcp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/op_mode/show_dhcp.py b/src/op_mode/show_dhcp.py
index c2a05f516..6b2088732 100755
--- a/src/op_mode/show_dhcp.py
+++ b/src/op_mode/show_dhcp.py
@@ -158,7 +158,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(ipaddress.ip_address(stop)) - int(ipaddress.ip_address(start))
+ # Add +1 because both range boundaries are inclusive
+ size += int(ipaddress.ip_address(stop)) - int(ipaddress.ip_address(start)) + 1
return size