summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Yurchenko <ey@tm-k.com>2011-06-17 11:26:19 -0400
committerEvgeny Yurchenko <ey@tm-k.com>2011-06-17 11:27:28 -0400
commitdd4bded7de6d6654afe2cf203df3136c1bef9515 (patch)
tree52e1e8ae6f05a45a7f33a5842a85bd154e8cd796
parent2dfaa85fa0f09d05d88c116b0913f5d1ab46e108 (diff)
downloadpfsense-dd4bded7de6d6654afe2cf203df3136c1bef9515.zip
pfsense-dd4bded7de6d6654afe2cf203df3136c1bef9515.tar.gz
Bug #1602. diag_arp.php hangs when DNS server unreachable.
-rwxr-xr-xusr/local/www/diag_arp.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/usr/local/www/diag_arp.php b/usr/local/www/diag_arp.php
index 4665a44..9dc12a5 100755
--- a/usr/local/www/diag_arp.php
+++ b/usr/local/www/diag_arp.php
@@ -248,10 +248,14 @@ function _getHostName($mac,$ip) {
return $dhcpmac[$mac];
else if ($dhcpip[$ip])
return $dhcpip[$ip];
- else if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip)
- return gethostbyaddr($ip);
- else
- return "";
+ else{
+ exec("host -W 1 $ip", $output);
+ if (preg_match('/.*pointer ([A-Za-z0-9.-]+)\..*/',$output[0],$matches)) {
+ if ($matches[1] <> $ip)
+ return $matches[1];
+ }
+ }
+ return "";
}
$pgtitle = array(gettext("Diagnostics"),gettext("ARP Table"));
@@ -277,8 +281,18 @@ ob_implicit_flush(1);
// Resolve hostnames and replace Z_ with "". The intention
// is to sort the list by hostnames, alpha and then the non
// resolvable addresses will appear last in the list.
+$dnsavailable=1;
+$dns = trim(_getHostName("", "8.8.8.8"));
+if ($dns == ""){
+ $dns = trim(_getHostName("", "8.8.4.4"));
+ if ($dns == "") $dnsavailable =0;
+}
+
foreach ($data as &$entry) {
- $dns = trim(_getHostName($entry['mac'], $entry['ip']));
+ if ($dnsavailable){
+ $dns = trim(_getHostName($entry['mac'], $entry['ip']));
+ }else
+ $dns="";
if(trim($dns))
$entry['dnsresolve'] = "$dns";
else
OpenPOWER on IntegriCloud