3 Commits

Author SHA1 Message Date
Ivan Diaz
dfe2967675 watchcat: set default value for mmifacename to prevent argument shift
Set mmifacename default to "null" instead of an empty string to avoid
argument displacement when the value is not defined. Also remove leftover
debug comments from previous commit.

Signed-off-by: Ivan Diaz <diaz.it@icloud.com>
2025-12-09 12:12:19 +01:00
Ivan Diaz
5dc13908b4 watchcat: fix argument handling and allow multiple ping hosts
The backend now correctly supports multiple IP addresses and avoids
argument shifting when mmifacename is empty.

Signed-off-by: Ivan Diaz <diaz.it@icloud.com>
2025-12-09 12:12:19 +01:00
Christian Lamparter
e35de9af78 openconnect: fix off-by-one while condition
resolveip returns 0 on success. This means that the while loop
will just run until all tries are exhausted. But this was not
the intended behaviour.

Fixes: 20ea72607b ("openconnect: make host dependency more resilient")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2025-12-09 10:02:43 +01:00
4 changed files with 8 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openconnect
PKG_VERSION:=9.12
PKG_RELEASE:=5
PKG_RELEASE:=6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.infradead.org/openconnect/download

View File

@@ -86,7 +86,7 @@ proto_openconnect_setup() {
[ -n $uri ] && server=$(echo $uri | awk -F[/:] '{print $4}')
logger -t "openconnect" "adding host dependency for $server at $config"
while resolveip -t 10 "$server" > "$tmpfile" && [ "$trials" -gt 0 ]; do
while ! resolveip -t 10 "$server" > "$tmpfile" && [ "$trials" -gt 0 ]; do
sleep 5
trials=$((trials - 1))
done

View File

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=watchcat
PKG_VERSION:=1
PKG_RELEASE:=17
PKG_RELEASE:=18
PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
PKG_LICENSE:=GPL-2.0

View File

@@ -39,7 +39,7 @@ config_watchcat() {
config_get forcedelay "$1" forcedelay "60"
config_get pingsize "$1" pingsize "standard"
config_get interface "$1" interface
config_get mmifacename "$1" mmifacename
config_get mmifacename "$1" mmifacename "null"
config_get_bool unlockbands "$1" unlockbands "0"
config_get addressfamily "$1" addressfamily "any"
config_get script "$1" script
@@ -73,7 +73,7 @@ config_watchcat() {
append_string "warn" "pingperiod cannot be a negative value." "; "
fi
if [ "$mmifacename" != "" ] && [ "$period" -lt 30 ]; then
if [ "$mmifacename" != "null" ] && [ "$period" -lt 30 ]; then
append_string "error" "Check interval is less than 30s. For robust operation with ModemManager modem interfaces it is recommended to set the period to at least 30s."
fi
fi
@@ -104,19 +104,19 @@ config_watchcat() {
;;
ping_reboot)
procd_open_instance "watchcat_${1}"
procd_set_param command /usr/bin/watchcat.sh "ping_reboot" "$period" "$forcedelay" "$pinghosts" "$pingperiod" "$pingsize" "$addressfamily"
procd_set_param command /usr/bin/watchcat.sh "ping_reboot" "$period" "$forcedelay" \"$pinghosts\" "$pingperiod" "$pingsize" "$addressfamily"
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
procd_close_instance
;;
restart_iface)
procd_open_instance "watchcat_${1}"
procd_set_param command /usr/bin/watchcat.sh "restart_iface" "$period" "$pinghosts" "$pingperiod" "$pingsize" "$interface" "$mmifacename" "$unlockbands" "$addressfamily"
procd_set_param command /usr/bin/watchcat.sh "restart_iface" "$period" \"$pinghosts\" "$pingperiod" "$pingsize" "$interface" "$mmifacename" "$unlockbands" "$addressfamily"
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
procd_close_instance
;;
run_script)
procd_open_instance "watchcat_${1}"
procd_set_param command /usr/bin/watchcat.sh "run_script" "$period" "$pinghosts" "$pingperiod" "$pingsize" "$interface" "$addressfamily" "$script"
procd_set_param command /usr/bin/watchcat.sh "run_script" "$period" \"$pinghosts\" "$pingperiod" "$pingsize" "$interface" "$addressfamily" "$script"
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
procd_close_instance
;;