diff --git a/src/common.c b/src/common.c index 69d432d..f44a0eb 100755 --- a/src/common.c +++ b/src/common.c @@ -551,16 +551,12 @@ void cwmp_reboot(const char *command_key) /* * FactoryReset */ -void cwmp_factory_reset(bool is_soft_reset) +void cwmp_factory_reset() { int code = 3; // Flawfinder: ignore - if (is_soft_reset) { - code = run_cmd("defaultreset -s", NULL, 0); - } else { - code = run_cmd("defaultreset", NULL, 0); - } + code = run_cmd("defaultreset", NULL, 0); if (code == 0) { // Wait before exit to avoid getting restarted by procd sleep(300); diff --git a/src/common.h b/src/common.h index 49444f3..940c013 100644 --- a/src/common.h +++ b/src/common.h @@ -685,7 +685,7 @@ void cwmp_free_all_list_param_fault(struct list_head *list_param_fault); bool folder_exists(const char *path); bool file_exists(const char *path); void cwmp_reboot(const char *command_key); -void cwmp_factory_reset(bool is_soft_reset); +void cwmp_factory_reset(); int download_file(const char *file_path, const char *url, const char *username, const char *password, const char *interface); unsigned int get_file_size(const char *file_name); int cwmp_check_image(); diff --git a/src/download.c b/src/download.c index a780eae..ed3c11b 100644 --- a/src/download.c +++ b/src/download.c @@ -874,22 +874,15 @@ int apply_downloaded_file(struct download *pdownload, char *download_file_name, // Trigger reboot/soft-reset only in case of its not operator default opconf file, // operator will trigger factory reset to apply it latter, triggering factoryreset // will break the DownloadRPC message flow -#ifdef ICWMP_ENABLE_OPCONF_SUPPORT - if (err == CWMP_OK && pdownload->filetype != DOWNLOAD_FILETYPE_OPERATOR_CONF_FILE) { -#else if (err == CWMP_OK) { -#endif - if (is_opconf == true) { - CWMP_LOG(INFO, "Trigger Soft Factory Reset to apply the opconf"); - cwmp_factory_reset(true); - } else { + if (pdownload->filetype == DOWNLOAD_FILETYPE_VENDOR_CONFIG) { 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"); + 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"); + } } } break; diff --git a/src/session.c b/src/session.c index 677b58e..10ca765 100644 --- a/src/session.c +++ b/src/session.c @@ -813,7 +813,7 @@ int run_session_end_func(void) if (end_session_flag & END_SESSION_FACTORY_RESET) { CWMP_LOG(INFO, "Executing factory reset: end session request"); - cwmp_factory_reset(false); + cwmp_factory_reset(); exit(EXIT_SUCCESS); }