summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-gwcheck/files/usr
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-11-13 13:45:17 +0000
committerManuel Munz <freifunk@somakoma.de>2011-11-13 13:45:17 +0000
commit256daa259bcfb7f1b38bf9c6b2959a0aaa239b1c (patch)
treee49ff53386ba5830e0d883b141b6fb9640e5b253 /contrib/package/freifunk-gwcheck/files/usr
parent32be6cea9305168b303d1e54ec3e658826725ef2 (diff)
contrib/freifunk-gwcheck: Some fixes suggested by Patrick grimm
Diffstat (limited to 'contrib/package/freifunk-gwcheck/files/usr')
-rwxr-xr-xcontrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh18
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh b/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh
index 5d34d9a559..a622a4fc44 100755
--- a/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh
+++ b/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh
@@ -3,7 +3,7 @@
#check if dyngw_plain is installed and enabled, else exit
dyngwplainlib=`uci show olsrd |grep dyn_gw_plain |awk {' FS="."; print $1"."$2 '}`
if [ -n "$dyngwplainlib" ]; then
- if [ ! "$(uci -q get $dyngwplainlib.ignore)" == 0 ]; then
+ if [ "$(uci -q get $dyngwplainlib.ignore)" == 1 ]; then
exit 1
fi
else
@@ -15,14 +15,14 @@ fi
# check if we have a defaultroute with metric=0 in one of these tables: main table and gw-check table.
# If not exit here.
defroutemain="$(ip r s |grep default |grep -v metric)"
-defroutegw-check="$(ip r s t gw-check |grep default |grep -v metric)"
-if [ -z "$defroutegw-check" -a -z "$defroutemain" ]; then
+defroutegwcheck="$(ip r s t gw-check |grep default |grep -v metric)"
+if [ -z "$defroutegwcheck" -a -z "$defroutemain" ]; then
exit 1
fi
# get and shuffle list of testservers
testserver="$(uci -q get freifunk-gwcheck.hosts.host)"
-[ -z "$testserver" ] && echo "No testservers found, exit" && exit
+[ -z "$testserver" ] && echo "No testservers found, exit" && exit
testserver="$(for t in $testserver; do echo $t; done | awk 'BEGIN {
srand();
@@ -57,16 +57,16 @@ iw=$(check_internet)
if [ "$iw" == 0 ]; then
# check if we have a seperate routing table for our tests.
# If yes, move defaultroute to normal table and delete table gw-check
- if [ -n "$defroutegw-check" ]; then
- ip r a $defroutegw-check
- ip r d $defroutegw-check t gw-check
+ if [ -n "$defroutegwcheck" ]; then
+ ip r a $defroutegwcheck
+ ip r d $defroutegwcheck t gw-check
ip ru del fwmark 0x2 lookup gw-check
for host in $testserver; do
iptables -t mangle -D OUTPUT -d $host -p tcp --dport 80 -j MARK --set-mark 0x2
done
- logger -t gw-check "Internet is available again, restoring default route ( $defroutegw-check)"
+ logger -t gw-check "Internet is available again, restoring default route ( $defroutegwcheck)"
fi
-
+
else
# Check failed. If we have a defaultroute with metric=0 and it is already in table gw-check then do nothing.
# If there is a defaultroute with metric=0 then remove it from the main routing table and add to table gw-check.