Merge branch 'cherry-pick-036211cf' into 'devel'

Apply non-persistent opconf in runtime with a reboot

See merge request bbf/icwmp!524
This commit is contained in:
Vivek Dutta 2026-03-12 15:21:06 +05:30 committed by IOPSYS Dev
commit b4245f0c38
No known key found for this signature in database
4 changed files with 11 additions and 22 deletions

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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);
}