diff --git a/README.md b/README.md index f1f4d82..05b0270 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,7 @@ root@iopsys:~# cat /etc/icwmpd/forced_inform.json root@iopsys:~# ``` And then the path of the JSON file can be set in the UCI option: `cwmp.cpe.forced_inform_json` like below: + ```bash root@iopsys:~# uci set cwmp.cpe.forced_inform_json=/etc/icwmpd/forced_inform.json root@iopsys:~# uci commit cwmp @@ -290,6 +291,7 @@ root@iopsys:~# /etc/init.d/icwmpd restart > - It is required to restart icwmp service after the changes to use the new forced inform parameters > - This JSON file shouldn't contain duplicate parameters or parameters of the standard inform parameters specified in the datamodel > - Forced inform parameters defined in JSON should be leaf elements +> - Forced inform parameters appears only in BOOT or BOOTSTRAP inform message. ## icwmpd notifications As per the cwmp notifications requirements, there is a list parameters specified in the standard that has forced notification type. Those parameters are defined internally in icwmp client. The list contains below parameters: diff --git a/inc/common.h b/inc/common.h index bb23d2b..1d2a80e 100644 --- a/inc/common.h +++ b/inc/common.h @@ -142,6 +142,7 @@ typedef struct cwmp { struct session_status session_status; unsigned int cwmp_id; int cr_socket_desc; + bool is_boot; } cwmp; enum action { diff --git a/rpc_soap.c b/rpc_soap.c index 1f873f1..7f771c4 100755 --- a/rpc_soap.c +++ b/rpc_soap.c @@ -160,6 +160,7 @@ static int xml_prepare_events_inform(struct session *session, mxml_node_t *tree) int n = 0; struct list_head *ilist; struct event_container *event_container; + struct cwmp *cwmp = &cwmp_main; b1 = mxmlFindElement(tree, tree, "Event", NULL, NULL, MXML_DESCEND); if (!b1) @@ -173,6 +174,8 @@ static int xml_prepare_events_inform(struct session *session, mxml_node_t *tree) b2 = mxmlNewElement(node, "EventCode"); if (!b2) goto error; + if (event_container->code == EVENT_IDX_0BOOTSTRAP || event_container->code == EVENT_IDX_1BOOT) + cwmp->is_boot = true; b2 = mxmlNewOpaque(b2, EVENT_CONST[event_container->code].CODE); if (!b2) goto error; @@ -299,6 +302,7 @@ int cwmp_rpc_acs_prepare_message_inform(struct cwmp *cwmp, struct session *sessi if (!b) goto error; + cwmp->is_boot = false; if (xml_prepare_events_inform(session, tree)) goto error; @@ -362,15 +366,15 @@ int cwmp_rpc_acs_prepare_message_inform(struct cwmp *cwmp, struct session *sessi if (xml_prepare_parameters_inform(&cwmp_dm_param, parameter_list, &size)) goto error; } - - for (i = 0; i < nbre_custom_inform; i++) { - char *fault = cwmp_get_single_parameter_value(custom_forced_inform_parameters[i], &cwmp_dm_param); - if (fault != NULL) - continue; - if (xml_prepare_parameters_inform(&cwmp_dm_param, parameter_list, &size)) - goto error; + if (cwmp->is_boot == true) { + for (i = 0; i < nbre_custom_inform; i++) { + char *fault = cwmp_get_single_parameter_value(custom_forced_inform_parameters[i], &cwmp_dm_param); + if (fault != NULL) + continue; + if (xml_prepare_parameters_inform(&cwmp_dm_param, parameter_list, &size)) + goto error; + } } - if (snprintf(c, sizeof(c), "cwmp:ParameterValueStruct[%d]", size) == -1) goto error;