summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/diag_dns.php
diff options
context:
space:
mode:
authorNewEraCracker <neweracracker@gmail.com>2016-09-03 00:38:07 +0100
committerRenato Botelho <renato@netgate.com>2016-09-13 09:37:43 -0300
commit6002af93021b2ce2ce5ae573ad6235049a138230 (patch)
tree4944f16a73297bf8d62c6364d752a76e9a545a4d /src/usr/local/www/diag_dns.php
parenta016674e7fffff6c34d4ee803bd74243583c80f8 (diff)
downloadpfsense-6002af93021b2ce2ce5ae573ad6235049a138230.zip
pfsense-6002af93021b2ce2ce5ae573ad6235049a138230.tar.gz
Fix diag_dns regressions
After testing diag_dns behaviour some regressions have been noticed. 1) Looking up ipv6.google.com (it only has AAAA records) doesn't work - gethostbyname() only supports v4, ipv6.google.com only has v6 - this bug was recently and inadvertently introduced 2) Results table will always show even when domain is not resolved - since refactoring ages ago, $resolved is an array, bad idea to replace with a string, this will cause issues - this piece of code was 'dead' until the recent commit has 'enabled' it again, removing it as not needed 3) Parameters for display_host_results (see: fe74228f2a8a9abc45a580a01559518043ca8d0b for its introduction) weren't correctly updated - mostly a dead function, doubt this is used for anything, keeping it just in case. This commit fixes all aforementioned issues. (cherry picked from commit df7f65a318f407b30627eabe77052d7d0b857786)
Diffstat (limited to 'src/usr/local/www/diag_dns.php')
-rw-r--r--src/usr/local/www/diag_dns.php28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php
index b11421e..de92ef8 100644
--- a/src/usr/local/www/diag_dns.php
+++ b/src/usr/local/www/diag_dns.php
@@ -94,7 +94,7 @@ function resolve_host_addresses($host) {
}
}
error_reporting($errreporting);// restore original php warning/error settings.
-
+
foreach ($dnsresult as $item) {
$newitem = array();
$newitem['type'] = $item['type'];
@@ -111,7 +111,6 @@ function resolve_host_addresses($host) {
$newitem['data'] = $item['ipv6'];
$resolved[] = $newitem;
break;
-
}
}
return $resolved;
@@ -184,7 +183,7 @@ if ($_POST) {
}
$type = "unknown";
- $resolved = "";
+ $resolved = array();
$ipaddr = "";
if (!$input_errors) {
if (is_ipaddr($host)) {
@@ -199,26 +198,15 @@ if ($_POST) {
}
} elseif (is_hostname($host)) {
$type = "hostname";
- $resolved = gethostbyname($host);
- if ($host != $resolved) {
- $resolved = resolve_host_addresses($host);
- foreach ($resolved as $item) {
- if ($item['type'] == 'A') {
- $ipaddr = $item['data'];
- break;
- }
- }
- }
- }
-
- if ($host == $resolved) {
- $resolved = gettext("No record found");
+ $ipaddr = gethostbyname($host);
+ $resolved = resolve_host_addresses($host);
}
}
}
-if (($_POST['host']) && ($_POST['dialog_output'])) {
- display_host_results ($host, $resolved, $dns_speeds);
+if ($_POST['host'] && $_POST['dialog_output']) {
+ $host = (isset($resolvedptr) ? $resolvedptr : $host);
+ display_host_results ($ipaddr, $host, $dns_speeds);
exit;
}
@@ -300,7 +288,7 @@ if (!$input_errors && $type) {
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Results')?></h2></div>
<div class="panel-body">
-
+
<table class="table">
<thead>
<tr>
OpenPOWER on IntegriCloud