Make the enable/disable of GetRPCMethods ACS methods done via cwmp uci option

This commit is contained in:
Omar Kallel 2022-10-20 23:53:00 +01:00
parent 0e55079964
commit 4a5ca8b525
6 changed files with 16 additions and 6 deletions

View file

@ -116,6 +116,7 @@ typedef struct config {
bool insecure_enable;
bool ipv6_enable;
bool heart_beat_enable;
bool acs_getrpc;
int retry_min_wait_interval;
int retry_interval_multiplier;
bool lw_notification_enable;

View file

@ -430,6 +430,13 @@ int get_global_config()
FREE(value2);
FREE(value3);
if ((error = uci_get_value(UCI_ACS_GETRPC, &value)) == CWMP_OK) {
cwmp_main->conf.acs_getrpc = uci_str_to_bool(value);
FREE(value);
} else {
return error;
}
if ((error = uci_get_value(UCI_CPE_USERID_PATH, &value)) == CWMP_OK) {
FREE(cwmp_main->conf.cpe_userid);
if (value != NULL) {

View file

@ -28,6 +28,7 @@
#define UCI_ACS_COMPRESSION "cwmp.acs.compression"
#define UCI_ACS_RETRY_MIN_WAIT_INTERVAL "cwmp.acs.retry_min_wait_interval"
#define UCI_ACS_RETRY_INTERVAL_MULTIPLIER "cwmp.acs.retry_interval_multiplier"
#define UCI_ACS_GETRPC "cwmp.acs.get_rpc_methods"
#define UCI_CPE_USERID_PATH "cwmp.cpe.userid"
#define UCI_CPE_PASSWD_PATH "cwmp.cpe.passwd"
#define UCI_CPE_CWMP_ENABLE "cwmp.cpe.enable"

View file

@ -266,7 +266,7 @@ int cwmp_root_cause_get_rpc_method()
return CWMP_MEM_ERR;
cwmp_save_event_container(event_container);
if (cwmp_add_session_rpc_acs(RPC_ACS_GET_RPC_METHODS) == NULL)
if (cwmp_main->conf.acs_getrpc && cwmp_add_session_rpc_acs(RPC_ACS_GET_RPC_METHODS) == NULL)
return CWMP_MEM_ERR;
}

View file

@ -66,9 +66,11 @@ int cwmp_session_init()
/*
* Set Required methods as initial value of
*/
rpc_acs = cwmp_add_session_rpc_acs_head(RPC_ACS_GET_RPC_METHODS);
if (rpc_acs == NULL)
return CWMP_GEN_ERR;
if (cwmp_main->conf.acs_getrpc) {
rpc_acs = cwmp_add_session_rpc_acs_head(RPC_ACS_GET_RPC_METHODS);
if (rpc_acs == NULL)
return CWMP_GEN_ERR;
}
rpc_acs = cwmp_add_session_rpc_acs_head(RPC_ACS_INFORM);
if (rpc_acs == NULL)
@ -132,7 +134,6 @@ int cwmp_schedule_rpc()
cwmp_session_rpc_destructor(rpc_acs);
continue;
}
if (!rpc_acs->type || cwmp_stop)
goto retry;

View file

@ -256,7 +256,7 @@ static const struct blobmsg_policy icwmp_inform_policy[] = {
static int icwmp_inform_get_rpc_method(struct blob_buf *bb)
{
if (cwmp_add_session_rpc_acs(RPC_ACS_GET_RPC_METHODS) == NULL)
if (cwmp_main->conf.acs_getrpc && cwmp_add_session_rpc_acs(RPC_ACS_GET_RPC_METHODS) == NULL)
return -1;
blobmsg_add_u32(bb, "status", 1);