icwmp: workaround for uci stuck in varstate

This commit is contained in:
Vivek Kumar Dutta 2023-12-19 20:38:07 +05:30
parent 59aad46280
commit c25c241008
3 changed files with 20 additions and 1 deletions

View file

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=9.5.27
PKG_VERSION:=9.5.28
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
@ -102,6 +102,7 @@ define Package/icwmp/default/install
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/95-set-random-inform-time $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/icwmpd/uci_stuck_workaround.sh $(1)/etc/icwmpd/uci_stuck_workaround.sh
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user

View file

@ -0,0 +1,12 @@
#!/bin/sh
log()
{
logger -t cwmp.hacks "$@"
}
timeout 2 uci -c /var/state show icwmp >/dev/null 2>&1
if [ "$?" -eq "143" ]; then
log "Seems uci got stuck, restarting cwmp ...."
/etc/init.d/icwmpd restart
fi

View file

@ -537,6 +537,12 @@ start_service() {
procd_append_param command -b
fi
# Add crontab job to check uci stuck
if ! grep -q "uci_stuck_workaround.sh" /etc/crontabs/root; then
echo "*/1 * * * * /etc/icwmpd/uci_stuck_workaround.sh" >>/etc/crontabs/root
ubus call uci commit '{"config":"cron"}'
fi
procd_set_param respawn \
"${respawn_threshold:-5}" \
"${respawn_timeout:-10}" "${respawn_retry:-3}"