mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-21 12:35:33 +03:00
Pull request 1836: 5714-handle-zeroes-health
Merge in DNS/adguard-home from 5714-handle-zeroes-health to master Updates #5714. Squashed commit of the following: commit 24faab01faf723e313050294b3a35e249c3cd3e3 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Apr 19 13:10:24 2023 +0300 docker: add curly brackets commit 67365d02856200685551a79aa23cf59df4a3484b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Apr 18 20:16:12 2023 +0300 docker: imp zeroes check
This commit is contained in:
parent
584182e264
commit
aeec9a86e2
2 changed files with 26 additions and 9 deletions
|
@ -7,11 +7,10 @@
|
||||||
addrs[$2] = true
|
addrs[$2] = true
|
||||||
prev_line = FNR
|
prev_line = FNR
|
||||||
|
|
||||||
if ($2 == "0.0.0.0" || $2 == "::") {
|
if ($2 == "0.0.0.0" || $2 == "\"\"" || $2 == "'::'") {
|
||||||
delete addrs
|
|
||||||
addrs["localhost"] = true
|
|
||||||
|
|
||||||
# Drop all the other addresses.
|
# Drop all the other addresses.
|
||||||
|
delete addrs
|
||||||
|
addrs[""] = true
|
||||||
prev_line = -1
|
prev_line = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,11 @@ then
|
||||||
error_exit "no DNS bindings could be retrieved from $filename"
|
error_exit "no DNS bindings could be retrieved from $filename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
first_dns="$( echo "$dns_hosts" | head -n 1 )"
|
||||||
|
readonly first_dns
|
||||||
|
|
||||||
# TODO(e.burkov): Deal with 0 port.
|
# TODO(e.burkov): Deal with 0 port.
|
||||||
case "$( echo "$dns_hosts" | head -n 1 )"
|
case "$first_dns"
|
||||||
in
|
in
|
||||||
(*':0')
|
(*':0')
|
||||||
error_exit '0 in DNS port is not supported by healthcheck'
|
error_exit '0 in DNS port is not supported by healthcheck'
|
||||||
|
@ -82,8 +85,23 @@ esac
|
||||||
# See https://github.com/AdguardTeam/AdGuardHome/issues/5642.
|
# See https://github.com/AdguardTeam/AdGuardHome/issues/5642.
|
||||||
wget --no-check-certificate "$web_url" -O /dev/null -q || exit 1
|
wget --no-check-certificate "$web_url" -O /dev/null -q || exit 1
|
||||||
|
|
||||||
echo "$dns_hosts" | while read -r host
|
test_fqdn="healthcheck.adguardhome.test."
|
||||||
do
|
readonly test_fqdn
|
||||||
nslookup -type=a healthcheck.adguardhome.test. "$host" > /dev/null ||\
|
|
||||||
|
# The awk script currently returns only port prefixed with colon in case of
|
||||||
|
# unspecified address.
|
||||||
|
case "$first_dns"
|
||||||
|
in
|
||||||
|
(':'*)
|
||||||
|
nslookup -type=a "$test_fqdn" "127.0.0.1${first_dns}" > /dev/null ||\
|
||||||
|
nslookup -type=a "$test_fqdn" "[::1]${first_dns}" > /dev/null ||\
|
||||||
error_exit "nslookup failed for $host"
|
error_exit "nslookup failed for $host"
|
||||||
done
|
;;
|
||||||
|
(*)
|
||||||
|
echo "$dns_hosts" | while read -r host
|
||||||
|
do
|
||||||
|
nslookup -type=a "$test_fqdn" "$host" > /dev/null ||\
|
||||||
|
error_exit "nslookup failed for $host"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue