add ping internet function and fix some spacing issues

pull/1565/head
Jacob Salmela 7 years ago
parent 107babe8f4
commit b74300f67c
No known key found for this signature in database
GPG Key ID: 1962FF1A5046135E

@ -301,6 +301,31 @@ ping_gateway() {
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() {
echo_current_diagnostic "Networking"
detect_ip_addresses "4"

Loading…
Cancel
Save