diff --git a/icwmp/Makefile b/icwmp/Makefile index eea4bcbe6..67c727659 100755 --- a/icwmp/Makefile +++ b/icwmp/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=icwmp -PKG_VERSION:=8.4.14 +PKG_VERSION:=8.4.15 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git -PKG_SOURCE_VERSION:=a3be4dd092de5e98022ccd29f10a5724863a360a +PKG_SOURCE_VERSION:=23e16013bee15fb395df6b30b5c16994591c2b93 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_MIRROR_HASH:=skip @@ -46,7 +46,7 @@ define Package/icwmp/config endef TARGET_CFLAGS += \ - -D_GNU_SOURCE \ + -D_GNU_SOURCE -ggdb\ "-DCWMP_REVISION=\\\"$(PKG_SOURCE_VERSION)\\\"" define Package/icwmp diff --git a/icwmp/files/etc/icwmpd/update.sh b/icwmp/files/etc/icwmpd/update.sh index 4b5e41660..20d95a760 100644 --- a/icwmp/files/etc/icwmpd/update.sh +++ b/icwmp/files/etc/icwmpd/update.sh @@ -6,9 +6,9 @@ log() { handle_icwmp_update() { local defwan vendorspecinf update - local fallback_restart + local bootup_start - fallback_restart="${1:-0}" + bootup_start="${1:-0}" update="0" defwan="$(uci -q get cwmp.cpe.default_wan_interface)" vendorspecinf="$(ifstatus "${defwan}" | jsonfilter -e "@.data.vendorspecinf")" @@ -79,17 +79,23 @@ handle_icwmp_update() { fi } + if [ "${bootup_start}" -eq "1" ]; then + # if called at boot up then no need to reload the service, since it will start after + uci commit cwmp + return 0 + fi + # In case of update restart icwmp if [ "${update}" -eq "1" ]; then log "CWMP uci changes, reload cwmp with uci commit" ubus call uci commit '{"config":"cwmp"}' else status="$(ubus call tr069 status |jsonfilter -qe '@.last_session.status')" - if [ "$status" = "failure" ]; then + if [ "$status" = "failure" ] || [ "$status" = "" ]; then log "Trigger out of bound inform, since last inform status was failure" ubus -t 10 call tr069 inform >/dev/null 2>&1 - # Handle timeout - if [ "$?" -eq 7 ]; then + # Handle timeout or tr069 object not found + if [ "$?" -eq 7 ] || [ "$?" -eq 4 ]; then log "Restarting icwmp tr069 object" /etc/init.d/icwmpd restart fi diff --git a/icwmp/files/etc/init.d/icwmpd b/icwmp/files/etc/init.d/icwmpd index 22dfe2862..8e65fbc39 100755 --- a/icwmp/files/etc/init.d/icwmpd +++ b/icwmp/files/etc/init.d/icwmpd @@ -152,11 +152,6 @@ validate_defaults() { fi fi - [ -z "${url}" ] && [ -z "${dhcp_url}" ] && { - log "ACS url is empty can't start" - return 1; - } - validate_cpe_section || { log "Validation of cpe section failed" return 1; @@ -165,16 +160,28 @@ validate_defaults() { return 0; } +boot() { + local dhcp_discovery="0" + + config_load cwmp + config_get dhcp_discovery acs dhcp_discovery "0" + + if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then + # Set dhcp option 43 if not already configured + config_get wan_interface cpe default_wan_interface "wan" + enable_dhcp_option43 "${wan_interface}" + /etc/icwmpd/update.sh 1 + fi + + start +} + start_service() { local enable_cwmp local wan_interface - local dhcp_discovery - local dhcp_url config_load cwmp config_get_bool enable_cwmp cpe enable 1 - config_get dhcp_discovery acs dhcp_discovery "0" - config_get dhcp_url acs dhcp_url '' config_get wan_interface cpe default_wan_interface "wan" if [ "$enable_cwmp" = "0" ] || [ "$enable_cwmp" = "false" ]; then @@ -182,22 +189,10 @@ start_service() { return 0 fi - # Set dhcp option 43 if dhcp discovery enabled - if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then - enable_dhcp_option43 "${wan_interface}" - fi - [ -f /sbin/netifd ] && log "Waiting for Network to be started ..." && ubus -t 5 wait_for network.interface [ -f /usr/sbin/dnsmasq ] && log "Waiting for DNS Proxy to be started ..." && ubus -t 5 wait_for dnsmasq [ -f /etc/config/dhcp ] && log "Waiting for DNS Server(s) ..." && wait_for_resolvfile 20 - if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then - if [ -z "${dhcp_url}" ]; then - log "Empty dhcp url, running update script" - /etc/icwmpd/update.sh - fi - fi - validate_defaults || { log "Validation of defaults failed" return 1; @@ -242,7 +237,6 @@ service_triggers() { json_add_array json_add_string "" "run_script" json_add_string "" "/etc/icwmpd/update.sh" - json_add_string "" "1" json_close_array json_close_array json_add_int "" "2000"