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
This commit is contained in:
Scott Ullrich 2005-11-05 21:29:11 +00:00
parent a636c6ba3e
commit a6bfa4ba23

View File

@ -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") {