Also check for IPv6 address for configured DNS servers (#5560)

This commit is contained in:
Dominik 2024-05-12 09:33:08 +02:00 committed by GitHub
commit 3abd2c04ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -823,12 +823,12 @@ If you want to specify a port other than 53, separate it with a hash.\
printf -v PIHOLE_DNS_1 "%s" "${piholeDNS%%,*}" printf -v PIHOLE_DNS_1 "%s" "${piholeDNS%%,*}"
printf -v PIHOLE_DNS_2 "%s" "${piholeDNS##*,}" printf -v PIHOLE_DNS_2 "%s" "${piholeDNS##*,}"
# If the first DNS value is invalid or empty, this if statement will be true and we will set PIHOLE_DNS_1="Invalid" # If the first DNS value is invalid (neither IPv4 nor IPv6) or empty, set PIHOLE_DNS_1="Invalid"
if ! valid_ip "${PIHOLE_DNS_1}" || [[ ! "${PIHOLE_DNS_1}" ]]; then if ! valid_ip "${PIHOLE_DNS_1}" && ! valid_ip6 "${PIHOLE_DNS_1}" || [[ -z "${PIHOLE_DNS_1}" ]]; then
PIHOLE_DNS_1=${strInvalid} PIHOLE_DNS_1=${strInvalid}
fi fi
# If the second DNS value is invalid or empty, this if statement will be true and we will set PIHOLE_DNS_2="Invalid" # If the second DNS value is invalid but not empty, set PIHOLE_DNS_2="Invalid"
if ! valid_ip "${PIHOLE_DNS_2}" && [[ "${PIHOLE_DNS_2}" ]]; then if ! valid_ip "${PIHOLE_DNS_2}" && ! valid_ip6 "${PIHOLE_DNS_2}" && [[ -n "${PIHOLE_DNS_2}" ]]; then
PIHOLE_DNS_2=${strInvalid} PIHOLE_DNS_2=${strInvalid}
fi fi
# If either of the DNS servers are invalid, # If either of the DNS servers are invalid,