Commit 7efea90d authored by Omar Kallel's avatar Omar Kallel

Reboot command key

parent e8c65004
Pipeline #1241 passed with stage
in 18 seconds
......@@ -27,6 +27,7 @@
#include "config.h"
struct cwmp cwmp_main = {0};
char *commandKey = NULL;
int cwmp_dm_ctx_init(struct cwmp *cwmp, struct dmctx *ctx)
{
......@@ -562,7 +563,9 @@ int run_session_end_func (struct session *session)
{
CWMP_LOG (INFO,"Executing Reboot: end session request");
external_init();
external_simple("reboot", NULL, 0);
external_simple("reboot", commandKey, 0);
if(commandKey)
free(commandKey);
external_exit();
exit(EXIT_SUCCESS);
}
......
......@@ -277,6 +277,7 @@ typedef struct rpc {
} rpc;
extern int ip_version;
extern char *commandKey;
#define ARRAYSIZEOF(a) (sizeof(a) / sizeof((a)[0]))
#ifndef FREE
#define FREE(x) do { free(x); x = NULL; } while (0)
......
......@@ -109,6 +109,7 @@ case "$1" in
;;
reboot)
action="reboot"
commandKey=$2
;;
apply)
if [ "$2" = "notification" ]; then
......@@ -504,6 +505,7 @@ handle_action() {
if [ "$action" = "reboot" ]; then
sync
uci set cwmp.acs.ParameterKey=$commandKey
reboot
fi
......
......@@ -2088,6 +2088,7 @@ int cwmp_handle_rpc_cpe_reboot(struct session *session, struct rpc *rpc)
b->parent->type == MXML_ELEMENT &&
!strcmp(b->parent->value.element.name, "CommandKey")) {
command_key = b->value.text.string;
commandKey = strdup(b->value.text.string);
}
b = mxmlWalkNext(b, session->body_in, MXML_DESCEND);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment