mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 14:20:18 +00:00
add ping internet function and fix some spacing issues
This commit is contained in:
parent
107babe8f4
commit
b74300f67c
1 changed files with 31 additions and 6 deletions
|
@ -301,6 +301,31 @@ ping_gateway() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ping_internet() {
|
||||||
|
local protocol="${1}"
|
||||||
|
# If the protocol is 6,
|
||||||
|
if [[ ${protocol} == "6" ]]; then
|
||||||
|
# use ping6
|
||||||
|
local cmd="ping6"
|
||||||
|
# and Google's public IPv6 address
|
||||||
|
local public_address="2001:4860:4860::8888"
|
||||||
|
# Otherwise,
|
||||||
|
else
|
||||||
|
# use ping
|
||||||
|
local cmd="ping"
|
||||||
|
# and Google's public IPv4 address
|
||||||
|
local public_address="8.8.8.8"
|
||||||
|
fi
|
||||||
|
echo -n " ${INFO} Trying three pings on IPv${protocol} to reach the Internet..."
|
||||||
|
if ! ping_inet="$(${cmd} -q -W 3 -c 3 -n ${public_address} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then
|
||||||
|
echo -e " ${CROSS} Cannot reach the Internet"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo -e " ${TICK} Query responded."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_networking() {
|
check_networking() {
|
||||||
echo_current_diagnostic "Networking"
|
echo_current_diagnostic "Networking"
|
||||||
detect_ip_addresses "4"
|
detect_ip_addresses "4"
|
||||||
|
|
Loading…
Reference in a new issue