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

This commit is contained in:
Omar Kallel 2022-10-21 11:12:03 +01:00
parent 3d157a4418
commit cb601366e6
6 changed files with 20 additions and 8 deletions

View file

@ -356,6 +356,13 @@ int get_global_config(struct config *conf)
return CWMP_GEN_ERR;
}
if ((error = uci_get_value(UCI_ACS_GETRPC, &value)) == CWMP_OK) {
conf->acs_getrpc = uci_str_to_bool(value);
FREE(value);
} else {
return error;
}
if ((error = uci_get_value(UCI_ACS_USERID_PATH, &value)) == CWMP_OK) {
if (value != NULL) {
FREE(conf->acs_userid);

View file

@ -329,7 +329,7 @@ int cwmp_root_cause_get_rpc_method(struct cwmp *cwmp)
}
cwmp_save_event_container(event_container);
session = list_entry(cwmp->head_event_container, struct session, head_event_container);
if (cwmp_add_session_rpc_acs(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
if (cwmp->conf.acs_getrpc && cwmp_add_session_rpc_acs(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
return CWMP_MEM_ERR;
}

View file

@ -104,6 +104,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

@ -27,6 +27,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

@ -112,11 +112,14 @@ struct session *cwmp_add_queue_session(struct cwmp *cwmp)
/*
* Set Required methods as initial value of
*/
if (cwmp->conf.acs_getrpc) {
rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS);
if (rpc_acs == NULL) {
FREE(session);
return NULL;
}
}
rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM);
if (rpc_acs == NULL) {
FREE(session);
@ -176,7 +179,7 @@ int cwmp_move_session_to_session_queue(struct cwmp *cwmp, struct session *sessio
if (session->head_rpc_acs.next != &(session->head_rpc_acs)) {
rpc_acs = list_entry(session->head_rpc_acs.next, struct rpc, list);
if (rpc_acs->type != RPC_ACS_INFORM) {
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
if (cwmp->conf.acs_getrpc && cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
return CWMP_MEM_ERR;
}
@ -186,7 +189,7 @@ int cwmp_move_session_to_session_queue(struct cwmp *cwmp, struct session *sessio
}
}
} else {
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
if (cwmp->conf.acs_getrpc && cwmp_add_session_rpc_acs_head(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
return CWMP_MEM_ERR;
}

View file

@ -280,7 +280,7 @@ static void icwmp_inform_get_rpc_method(struct ubus_context *ctx, struct ubus_re
cwmp_save_event_container(event_container);
session = list_entry(cwmp_main.head_event_container, struct session, head_event_container);
if (cwmp_add_session_rpc_acs(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
if (cwmp_main.conf.acs_getrpc && cwmp_add_session_rpc_acs(session, RPC_ACS_GET_RPC_METHODS) == NULL) {
pthread_mutex_unlock(&(cwmp_main.mutex_session_queue));
return;
}