diff options
author | Renato Botelho <renato@netgate.com> | 2016-01-13 09:53:07 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-01-13 09:53:07 -0200 |
commit | 96e8acdd220610dd95387c5be3908cc37def2b26 (patch) | |
tree | 35e3ff15b662c9c6aca11e857977b5a2a226f8dc /src/usr/local | |
parent | d6edfce5a7fb3b49ffc1964dae9cd518146e8f30 (diff) | |
parent | a8942d21bddf2c23bb5c9aef27666c78a863e8b1 (diff) | |
download | pfsense-96e8acdd220610dd95387c5be3908cc37def2b26.zip pfsense-96e8acdd220610dd95387c5be3908cc37def2b26.tar.gz |
Merge pull request #2408 from stilez/patch-12
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/bin/dhcpd_gather_stats.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/usr/local/bin/dhcpd_gather_stats.php b/src/usr/local/bin/dhcpd_gather_stats.php index b16e887..8903559 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)))); - - $result['range'] = (ip2ulong($config['dhcpd'][$dhcpif]['range']['to'])) - (ip2ulong($config['dhcpd'][$dhcpif]['range']['from'])) ; + $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; } } |