fff-hoods: Remove hardcoded IPv4 address and foreign domain

IPv4 is not a requirement for VPN nodes. However, a working DNS
is a requirement for nodes connecting via VPN. Therefore the
hardcoded IPv4 address is removed from the internet test.

To improve readability, a loop is used instead of having a seperate
ping command for each host. The ping utility built into our firmware
supports both IPv4 and IPv6.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[bump PKG_RELEASE]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Fabian Bläse 2020-05-06 16:48:01 +02:00 committed by Adrian Schmutzler
parent 225116dfd2
commit 5cd46fb17b
2 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-hoods
PKG_RELEASE:=10
PKG_RELEASE:=11
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -31,14 +31,10 @@ isGatewayAvailable() {
# Ping test
hasInternet() {
test_ipv4_host1="keyserver.freifunk-franken.de" # Freifunk-Franken keyserver
test_ipv4_host2="8.8.8.8" # Google DNS
test_ipv6_host1="heise.de" # heise Zeitschriftenverlag
if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null ; then
return 0
fi
internetAddresses="keyserver.freifunk-franken.de heise.de"
for addr in $internetAddresses; do
ping -w5 -c3 "$addr" &>/dev/null && return 0
done
return 1
}