mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 06:48:07 +00:00
Merge pull request #4248 from pi-hole/tweak/debugscript
Fix error on checking interfaces that are not dual-stack
This commit is contained in:
commit
15dfd19f58
@ -922,16 +922,20 @@ dig_at() {
|
|||||||
# s/\/.*$//g;
|
# s/\/.*$//g;
|
||||||
# Removes CIDR and everything thereafter (e.g., scope properties)
|
# Removes CIDR and everything thereafter (e.g., scope properties)
|
||||||
addresses="$(ip address show dev "${iface}" | sed "/${sed_selector} /!d;s/^.*${sed_selector} //g;s/\/.*$//g;")"
|
addresses="$(ip address show dev "${iface}" | sed "/${sed_selector} /!d;s/^.*${sed_selector} //g;s/\/.*$//g;")"
|
||||||
while IFS= read -r local_address ; do
|
if [ -n "${addresses}" ]; then
|
||||||
# Check if Pi-hole can use itself to block a domain
|
while IFS= read -r local_address ; do
|
||||||
if local_dig=$(dig +tries=1 +time=2 -"${protocol}" "${random_url}" @"${local_address}" +short "${record_type}"); then
|
# Check if Pi-hole can use itself to block a domain
|
||||||
# If it can, show success
|
if local_dig=$(dig +tries=1 +time=2 -"${protocol}" "${random_url}" @"${local_address}" +short "${record_type}"); then
|
||||||
log_write "${TICK} ${random_url} ${COL_GREEN}is ${local_dig}${COL_NC} on ${COL_CYAN}${iface}${COL_NC} (${COL_CYAN}${local_address}${COL_NC})"
|
# If it can, show success
|
||||||
else
|
log_write "${TICK} ${random_url} ${COL_GREEN}is ${local_dig}${COL_NC} on ${COL_CYAN}${iface}${COL_NC} (${COL_CYAN}${local_address}${COL_NC})"
|
||||||
# Otherwise, show a failure
|
else
|
||||||
log_write "${CROSS} ${COL_RED}Failed to resolve${COL_NC} ${random_url} on ${COL_RED}${iface}${COL_NC} (${COL_RED}${local_address}${COL_NC})"
|
# Otherwise, show a failure
|
||||||
fi
|
log_write "${CROSS} ${COL_RED}Failed to resolve${COL_NC} ${random_url} on ${COL_RED}${iface}${COL_NC} (${COL_RED}${local_address}${COL_NC})"
|
||||||
done <<< "${addresses}"
|
fi
|
||||||
|
done <<< "${addresses}"
|
||||||
|
else
|
||||||
|
log_write "${TICK} No IPv${protocol} address available on ${COL_CYAN}${iface}${COL_NC}"
|
||||||
|
fi
|
||||||
done <<< "${interfaces}"
|
done <<< "${interfaces}"
|
||||||
|
|
||||||
# Finally, we need to make sure legitimate queries can out to the Internet using an external, public DNS server
|
# Finally, we need to make sure legitimate queries can out to the Internet using an external, public DNS server
|
||||||
|
Loading…
Reference in New Issue
Block a user