diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-11-05 21:29:11 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-11-05 21:29:11 +0000 |
commit | a6bfa4ba238a7bd940dff8a46c95ad1e9db09dc8 (patch) | |
tree | 7da6e791abf37903b05882bdd204841ceb6a12b1 | |
parent | a636c6ba3e3d9f445deecce8d538f9de12f17057 (diff) | |
download | pfsense-a6bfa4ba238a7bd940dff8a46c95ad1e9db09dc8.zip pfsense-a6bfa4ba238a7bd940dff8a46c95ad1e9db09dc8.tar.gz |
When displaying DHCP leases, call gethostbyaddr() to resolve the hostname if we do not have the record in the database
Also check to make sure gethostbyaddr() would return a real value
Ticket 7390
-rwxr-xr-x | usr/local/www/diag_dhcp_leases.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/local/www/diag_dhcp_leases.php b/usr/local/www/diag_dhcp_leases.php index 2db2d75..474f453 100755 --- a/usr/local/www/diag_dhcp_leases.php +++ b/usr/local/www/diag_dhcp_leases.php @@ -115,8 +115,14 @@ while ($data = array_shift($return)) { } if ($data[0] == "client-hostname") { $d = array_shift($return); - $leases[$i]['hostname'] = $d[0]; - } + if($d[0] <> "") { + $leases[$i]['hostname'] = $d[0]; + } else { + if(gethostbyaddr($leases[$i]['ip']) <> "") { + $leases[$i]['hostname'] = gethostbyaddr($leases[$i]['ip']); + } + } + } if ($data[0] == "hardware") { $d = array_shift($return); if ($d[0] == "ethernet") { |