diff options
author | heper <heper@users.noreply.github.com> | 2015-11-09 16:01:08 +0100 |
---|---|---|
committer | heper <heper@users.noreply.github.com> | 2015-11-09 16:01:08 +0100 |
commit | 588a6068e476c2867948735ece7a5e8c886abd5a (patch) | |
tree | 25674fe89f17a2f4e0943b2591e7a4ddf4720d14 /src/usr/local/bin/dhcpd_gather_stats.php | |
parent | be189fe12f1c319d796d804e9e104b2a2bd2b797 (diff) | |
download | pfsense-588a6068e476c2867948735ece7a5e8c886abd5a.zip pfsense-588a6068e476c2867948735ece7a5e8c886abd5a.tar.gz |
improve validation $argv[1]
Diffstat (limited to 'src/usr/local/bin/dhcpd_gather_stats.php')
-rw-r--r-- | src/usr/local/bin/dhcpd_gather_stats.php | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/usr/local/bin/dhcpd_gather_stats.php b/src/usr/local/bin/dhcpd_gather_stats.php index f76f9d9..128fe0f 100644 --- a/src/usr/local/bin/dhcpd_gather_stats.php +++ b/src/usr/local/bin/dhcpd_gather_stats.php @@ -31,15 +31,12 @@ echo "N:"; $result = "NaN"; $result_static="NaN"; -if (isset($argv[1])) { +if (is_array($config['dhcpd'][$argv[1]])) { $leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"; $leases_contents = file($leasesfile); $dhcpif = $argv[1] ; - - - function remove_duplicate($array, $field) { foreach ($array as $sub) { $cmp[] = $sub[$field]; @@ -199,17 +196,12 @@ if (isset($argv[1])) { if ($data['act'] != "static") { if (($lip >= ip2ulong($config['dhcpd'][$dhcpif]['range']['from'])) && ($lip <= ip2ulong($config['dhcpd'][$dhcpif]['range']['to']))) { $result = $result + 1; - } } else { - - if (($lip >= $subnet_start) && ($lip <= $subnet_end)) { $result_static = $result_static + 1; } - - } } } |