proto_openconnect_setup() {
local config="$1"
+ local tmpfile="/tmp/openconnect-server.$$.tmp"
json_get_vars \
authgroup \
logger -t openconnect "initializing..."
[ -n "$interface" ] && {
+ local trials=5
+
logger -t "openconnect" "adding host dependency for $server at $config"
- for ip in $(resolveip -t 10 "$server"); do
- logger -t "openconnect" "adding host dependency for $ip at $config"
- proto_add_host_dependency "$config" "$ip" "$interface"
+ while resolveip -t 10 "$server" > "$tmpfile" && [ "$trials" -gt 0 ]; do
+ sleep 5
+ trials=$((trials - 1))
done
+
+ if [ -s "$tmpfile" ]; then
+ for ip in $(cat "$tmpfile"); do
+ logger -t "openconnect" "adding host dependency for $ip at $config"
+ proto_add_host_dependency "$config" "$ip" "$interface"
+ done
+ fi
+ rm -f "$tmpfile"
}
[ -n "$port" ] && port=":$port"