summaryrefslogtreecommitdiffstats
path: root/src/usr/local/bin
diff options
context:
space:
mode:
authorstilez <stilez@users.noreply.github.com>2016-01-12 08:27:04 +0000
committerstilez <stilez@users.noreply.github.com>2016-01-12 08:27:04 +0000
commite7a03f449e221e12ad3b241c9c41d879e91e8910 (patch)
tree7e47187dc4127da411830827719adf92466bbbd6 /src/usr/local/bin
parentf4c114d4a6fcfcd7e69e6a009db683d78d83189d (diff)
downloadpfsense-e7a03f449e221e12ad3b241c9c41d879e91e8910.zip
pfsense-e7a03f449e221e12ad3b241c9c41d879e91e8910.tar.gz
redmine 5702 - switch to high level IPv4 functions instead of low level ip2long32() etc
Diffstat (limited to 'src/usr/local/bin')
-rw-r--r--src/usr/local/bin/dhcpd_gather_stats.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/usr/local/bin/dhcpd_gather_stats.php b/src/usr/local/bin/dhcpd_gather_stats.php
index b16e887..1b94849 100644
--- a/src/usr/local/bin/dhcpd_gather_stats.php
+++ b/src/usr/local/bin/dhcpd_gather_stats.php
@@ -187,23 +187,21 @@ if (is_array($config['dhcpd'][$argv[1]])) {
}
$ifcfgip = get_interface_ip($dhcpif);
$ifcfgsn = get_interface_subnet($dhcpif);
- $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
- $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
-
+ $subnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
+ $subnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
+
$result['range'] = (ip2ulong($config['dhcpd'][$dhcpif]['range']['to'])) - (ip2ulong($config['dhcpd'][$dhcpif]['range']['from'])) ;
foreach ($leases as $data) {
- $lip = ip2ulong($data['ip']);
-
if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
continue;
if ($data['act'] != "static") {
- if (($lip >= ip2ulong($config['dhcpd'][$dhcpif]['range']['from'])) && ($lip <= ip2ulong($config['dhcpd'][$dhcpif]['range']['to']))) {
+ if (is_inrange_v4($data['ip'], $config['dhcpd'][$dhcpif]['range']['from'], $config['dhcpd'][$dhcpif]['range']['to'])) {
$result['active'] = $result['active'] + 1;
}
}
else {
- if (($lip >= $subnet_start) && ($lip <= $subnet_end)) {
+ if (is_inrange_v4($data['ip'], $subnet_start, $subnet_end)) {
$result['static'] = $result['static'] + 1;
}
}
OpenPOWER on IntegriCloud