From ea78dfdd2abf14250e7899d1ac37d5e5256fb65d Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Tue, 24 Feb 2026 18:49:00 +0530 Subject: [PATCH] Perform reboot after config file download --- src/download.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/download.c b/src/download.c index 1dbc5e8..36a29ef 100644 --- a/src/download.c +++ b/src/download.c @@ -807,9 +807,15 @@ int apply_downloaded_file(struct download *pdownload, char *download_file_name, remove(VENDOR_CONFIG_FILE); } - if (err == CWMP_OK) - error = FAULT_CPE_NO_FAULT; - else if (err == CWMP_GEN_ERR) { + if (err == CWMP_OK) { + cwmp_reboot("VendorConfigApply"); + if (error == FAULT_CPE_NO_FAULT) { + sleep(70); + error = FAULT_CPE_DOWNLOAD_FAIL_COMPLETE_DOWNLOAD; + snprintf(err_msg, sizeof(err_msg), "Failed to reboot after config apply"); + CWMP_LOG(ERROR, "## Failed to reboot after config apply"); + } + } else if (err == CWMP_GEN_ERR) { error = FAULT_CPE_INTERNAL_ERROR; snprintf(err_msg, sizeof(err_msg), "Failed to commit the config file changes"); } else if (err == -1) { @@ -841,8 +847,7 @@ int apply_downloaded_file(struct download *pdownload, char *download_file_name, if (error == FAULT_CPE_NO_FAULT) { set_rpc_parameter_key(pdownload->command_key); - if (pdownload->filetype == DOWNLOAD_FILETYPE_VENDOR_CONFIG || - pdownload->filetype == DOWNLOAD_FILETYPE_WEB_CONTENT || + if (pdownload->filetype == DOWNLOAD_FILETYPE_WEB_CONTENT || pdownload->filetype == DOWNLOAD_FILETYPE_STORED_FIRMWARE_IMAGE) { bkp_session_delete_element((ltype == TYPE_DOWNLOAD) ? "download" : "schedule_download", pdownload->id); @@ -1028,6 +1033,7 @@ void cwmp_start_download(struct uloop_timeout *timeout) CWMP_LOG(ERROR, "Error while applying the downloaded file: %s", download_file_name); } } + list_del(&(pdownload->list)); if (pdownload->scheduled_time != 0) { count_download_queue--;