mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-18 04:51:45 +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
|
||||
prev_line = FNR
|
||||
|
||||
if ($2 == "0.0.0.0" || $2 == "::") {
|
||||
delete addrs
|
||||
addrs["localhost"] = true
|
||||
|
||||
if ($2 == "0.0.0.0" || $2 == "\"\"" || $2 == "'::'") {
|
||||
# Drop all the other addresses.
|
||||
delete addrs
|
||||
addrs[""] = true
|
||||
prev_line = -1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,8 +61,11 @@ then
|
|||
error_exit "no DNS bindings could be retrieved from $filename"
|
||||
fi
|
||||
|
||||
first_dns="$( echo "$dns_hosts" | head -n 1 )"
|
||||
readonly first_dns
|
||||
|
||||
# TODO(e.burkov): Deal with 0 port.
|
||||
case "$( echo "$dns_hosts" | head -n 1 )"
|
||||
case "$first_dns"
|
||||
in
|
||||
(*':0')
|
||||
error_exit '0 in DNS port is not supported by healthcheck'
|
||||
|
@ -82,8 +85,23 @@ esac
|
|||
# See https://github.com/AdguardTeam/AdGuardHome/issues/5642.
|
||||
wget --no-check-certificate "$web_url" -O /dev/null -q || exit 1
|
||||
|
||||
test_fqdn="healthcheck.adguardhome.test."
|
||||
readonly test_fqdn
|
||||
|
||||
# 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"
|
||||
;;
|
||||
(*)
|
||||
echo "$dns_hosts" | while read -r host
|
||||
do
|
||||
nslookup -type=a healthcheck.adguardhome.test. "$host" > /dev/null ||\
|
||||
nslookup -type=a "$test_fqdn" "$host" > /dev/null ||\
|
||||
error_exit "nslookup failed for $host"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue