summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-02-08 22:20:38 +0000
committerJo-Philipp Wich <jow@openwrt.org>2015-02-08 22:20:38 +0000
commit7be42a71e1c3cb29890e9ff3bf5286575361e8b6 (patch)
treeb4dfdaf14d2687244a3c614e840324b055c914bc /package
parent4b0fbf30726cf6807508b7025fef023439e07572 (diff)
downloadmtk-20170518-7be42a71e1c3cb29890e9ff3bf5286575361e8b6.zip
mtk-20170518-7be42a71e1c3cb29890e9ff3bf5286575361e8b6.tar.gz
mtk-20170518-7be42a71e1c3cb29890e9ff3bf5286575361e8b6.tar.bz2
6in4: fix update timeout
The recent rework of the 6in4 endpoint update broke the retry mechanism. Rework the timeout handling and make the update status more verbose. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 44327
Diffstat (limited to 'package')
-rw-r--r--package/network/ipv6/6in4/Makefile2
-rwxr-xr-xpackage/network/ipv6/6in4/files/6in4.sh34
2 files changed, 28 insertions, 8 deletions
diff --git a/package/network/ipv6/6in4/Makefile b/package/network/ipv6/6in4/Makefile
index 0dc1068..ef96912 100644
--- a/package/network/ipv6/6in4/Makefile
+++ b/package/network/ipv6/6in4/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=6in4
-PKG_VERSION:=19
+PKG_VERSION:=20
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
diff --git a/package/network/ipv6/6in4/files/6in4.sh b/package/network/ipv6/6in4/files/6in4.sh
index 00b6e35..f8a43ce 100755
--- a/package/network/ipv6/6in4/files/6in4.sh
+++ b/package/network/ipv6/6in4/files/6in4.sh
@@ -9,6 +9,19 @@
init_proto "$@"
}
+proto_6in4_update() {
+ sh -c '
+ local timeout=5
+
+ (while [ $((timeout--)) -gt 0 ]; do
+ sleep 1
+ kill -0 $$ || exit 0
+ done; kill -9 $$) 2>/dev/null &
+
+ exec "$@"
+ ' "$1" "$@"
+}
+
proto_6in4_setup() {
local cfg="$1"
local iface="$2"
@@ -97,13 +110,20 @@ proto_6in4_setup() {
local try=0
local max=3
- while [ $((++try)) -le $max ]; do
- ( exec $urlget $urlget_opts "$url" | logger -t "$link" ) &
- local pid=$!
- ( sleep 20; kill $pid 2>/dev/null ) &
- wait $pid && break
- sleep 20;
- done
+ (
+ set -o pipefail
+ while [ $((++try)) -le $max ]; do
+ if proto_6in4_update $urlget $urlget_opts "$url" 2>&1 | \
+ sed -e 's,^Killed$,timeout,' -e "s,^,update $try/$max: ," | \
+ logger -t "$link";
+ then
+ logger -t "$link" "updated"
+ return 0
+ fi
+ sleep 5
+ done
+ logger -t "$link" "update failed"
+ )
}
}