diff --git a/api_db.php b/api_db.php index 019fb7ac..51d59ba4 100644 --- a/api_db.php +++ b/api_db.php @@ -87,7 +87,6 @@ if(isset($_GET["network"]) && $auth) $data = array_merge($data, array('network' => $network)); } -$qtypes = ["A", "AAAA", "ANY", "SRV", "SOA", "PTR", "TXT", "NAPTR", "MX", "DS", "RRSIG", "DNSKEY", "NS", "OTHER", "SVCB", "HTTPS"]; if (isset($_GET['getAllQueries']) && $auth) { $allQueries = array(); @@ -121,17 +120,14 @@ if (isset($_GET['getAllQueries']) && $auth) if(!is_bool($results)) while ($row = $results->fetchArray()) { + // Try to resolve host name of this client $c = resolveHostname($row[3],false); // Convert query type ID to name - // Names taken from FTL's query type names - $qtype = intval($row[1]); - if($qtype > 0 && $qtype <= count($qtypes)) - $query_type = $qtypes[$qtype-1]; - else - $query_type = "TYPE".(intval($row[1]) - 100); + $query_type = getQueryTypeStr($row[1]); - // array: time type domain client status upstream destination + // Insert into array + // array: time type domain client status upstream destination $allQueries[] = [$row[0], $query_type, utf8_encode(str_replace("~"," ",$row[2])), utf8_encode($c), $row[4], utf8_encode($row[5])]; } } diff --git a/cname_records.php b/cname_records.php index 0e4e7e16..53dcdab5 100644 --- a/cname_records.php +++ b/cname_records.php @@ -40,7 +40,7 @@
The target of a CNAME must be a domain that the Pi-hole already has in its cache or is authoritative for. This is an universal limitation of CNAME records.
The target of a CNAME must be a domain that the Pi-hole already has in its cache or is authoritative for. This is a universal limitation of CNAME records.
The reason for this is that Pi-hole will not send additional queries upstream when serving CNAME replies. As consequence, if you set a target that isn't already known, the reply to the client may be incomplete. Pi-hole just returns the information it knows at the time of the query. This results in certain limitations for CNAME targets,
for instance, only active DHCP leases work as targets - mere DHCP leases aren't sufficient as they aren't (yet) valid DNS records.
Additionally, you can't CNAME external domains (bing.com to google.com) successfully as this could result in invalid SSL certificate errors when the target server does not serve content for the requested domain.