1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

IPv4 DNS tests

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
Dan Schaper 2017-03-04 12:16:16 -08:00
parent 6cd4ff6d68
commit 709b44f736
No known key found for this signature in database
GPG Key ID: 572E999E385B7BFC

View File

@ -265,11 +265,13 @@ daemon_check() {
testResolver() {
header_write "Resolver Functions Check"
local protocol="${1}"
local IP="${2}"
local url
local testurl
local localdig
local piholedig
local remotedig
# Find a blocked url that has not been whitelisted.
url=$(shuf -n 1 "${GRAVITYFILE}" | awk -F ' ' '{ print $2 }')
@ -278,8 +280,7 @@ testResolver() {
log_write "Resolution of ${testurl} from Pi-hole (localhost):"
if localdig=$(dig "${testurl}" @localhost +short); then
if localdig=$(dig -"${protocol}" "${testurl}" @localhost +short); then
log_write "${localdig}"
else
log_write "Failed to resolve ${testurl} on Pi-hole"
@ -287,8 +288,7 @@ testResolver() {
log_write ""
log_write "Resolution of ${testurl} from Pi-hole (direct IP):"
if piholedig=$(dig "${testurl}" @"${IPV4_ADDRESS%/*}" +short); then
if piholedig=$(dig -"${protocol}" "${testurl}" @"${IP}" +short); then
log_write "${piholedig}"
else
log_write "Failed to resolve ${testurl} on Pi-hole"
@ -297,8 +297,7 @@ testResolver() {
log_write "Resolution of ${testurl} from 8.8.8.8:"
remotedig=$(dig "${testurl}" @8.8.8.8 +short)
if [[ $? = 0 ]]; then
if remotedig=$(dig -"${protocol}" "${testurl}" @8.8.8.8 +short); then
log_write "${remotedig:-NXDOMAIN}"
else
log_write "Failed to resolve ${testurl} on 8.8.8.8"
@ -417,7 +416,7 @@ daemon_check lighttpd http
daemon_check dnsmasq domain
daemon_check pihole-FTL 4711
checkProcesses
testResolver
testResolver 4 "${IPV4_ADDRESS%/*}"
debugLighttpd
files_check "${DNSMASQFILE}"