From patchwork Wed May 6 14:48:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [1/3] fff-hoods: Remove hardcoded IPv4 address and foreign domain From: Fabian Blaese X-Patchwork-Id: 1388 Message-Id: <20200506144803.590699-1-fabian@blaese.de> To: franken-dev@freifunk.net Date: Wed, 6 May 2020 16:48:01 +0200 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 Reviewed-by: Robert Langhammer Reviewed-by: Adrian Schmutzler --- .../fff/fff-hoods/files/usr/sbin/configurehood | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 8c7bb3d..3b92cbc 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -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 }