diff --git a/package/network/ipv6/6in4/files/6in4.sh b/package/network/ipv6/6in4/files/6in4.sh index dd055ecb63..015f8066b9 100755 --- a/package/network/ipv6/6in4/files/6in4.sh +++ b/package/network/ipv6/6in4/files/6in4.sh @@ -25,7 +25,7 @@ test_6in4_rfc1918() proto_6in4_update() { sh -c ' - timeout=5 + timeout=15 (while [ $((timeout--)) -gt 0 ]; do sleep 1 @@ -123,7 +123,7 @@ proto_6in4_setup() { local ca_path="${SSL_CERT_DIR:-/etc/ssl/certs}" [ -f /lib/libustream-ssl.so ] && http=https - [ "$http" = "https" -a -z "$(find $ca_path -name "*.0" 2>/dev/null)" ] && { + [ "$http" = "https" -a -z "$(find "$ca_path" \( -name "*.0" -o -name "*.crt" \) 2>/dev/null)" ] && { urlget_opts="$urlget_opts --no-check-certificate" } @@ -135,10 +135,12 @@ proto_6in4_setup() { local try=0 local max=3 + local retry_delay=5 ( set -o pipefail - while [ $((++try)) -le $max ]; do + while true; do + try=$((try + 1)) if proto_6in4_update $urlget $urlget_opts --user="$username" --password="$password" "$url" 2>&1 | \ sed -e 's,^Killed$,timeout,' -e "s,^,update $try/$max: ," | \ logger -t "$link"; @@ -146,7 +148,11 @@ proto_6in4_setup() { logger -t "$link" "updated" return 0 fi - sleep 5 + + [ "$try" -ge "$max" ] && break + + sleep "$retry_delay" + retry_delay=$((retry_delay * 2)) done logger -t "$link" "update failed" )