From 5c6a4ff73b3523a9c424be410294594aa1ece6c1 Mon Sep 17 00:00:00 2001 From: Amin Ben Romdhane Date: Fri, 18 Oct 2024 15:56:16 +0200 Subject: [PATCH] Set last_reboot_cause option to 'RemoteReboot' when rebooting via cwmp --- src/common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common.c b/src/common.c index 492197c..81868a0 100755 --- a/src/common.c +++ b/src/common.c @@ -409,6 +409,9 @@ void cwmp_reboot(const char *command_key) { set_rpc_parameter_key(command_key); + // Set last_reboot_cause to 'RemoteReboot' because the upcoming reboot will be initiated by CWMP Reboot RPC + set_uci_path_value(NULL, "deviceinfo.globals.last_reboot_cause", "RemoteReboot"); + struct blob_buf b = { 0 }; CWMP_MEMSET(&b, 0, sizeof(struct blob_buf)); blob_buf_init(&b, 0); @@ -419,6 +422,10 @@ void cwmp_reboot(const char *command_key) // Wait before exit to avoid getting restarted by procd sleep(300); + + // Set last_reboot_cause to empty because there is a problem in the system reboot + set_uci_path_value(NULL, "deviceinfo.globals.last_reboot_cause", ""); + CWMP_LOG(ERROR, "# Problem in system restart #"); }