Commit 34b11c03 authored by Omar Kallel's avatar Omar Kallel

Ticket refs #2673: TR069: No '4 value change' sent in case of active passive...

Ticket refs #2673: TR069: No '4 value change' sent in case of active passive notification (the case of parameter without ubus tr069 notify)
parent 5302ab5e
Pipeline #1515 passed with stage
in 17 seconds
......@@ -187,6 +187,7 @@ void cwmp_schedule_session (struct cwmp *cwmp)
cwmp->session_status.last_start_time = time(NULL);
cwmp->session_status.last_status = SESSION_RUNNING;
cwmp->session_status.next_retry = 0;
cwmp_add_notification_min();
CWMP_LOG (INFO,"Start session");
uci_get_value(UCI_CPE_EXEC_DOWNLOAD, &exec_download);
if(strcmp(exec_download, "1") == 0){
......
......@@ -279,6 +279,73 @@ void cwmp_lwnotification()
FREE(msg_out);
}
void cwmp_add_notification_min(void) {
int fault, iscopy;
FILE *fp;
char buf[512];
char *parameter, *notification = NULL, *value = NULL, *jval;
struct cwmp *cwmp = &cwmp_main;
struct dm_parameter *dm_parameter;
struct dmctx dmctx = {0};
bool initiate = false;
cwmp_dm_ctx_init(&cwmp_main, &dmctx);
fp = fopen(DM_ENABLED_NOTIFY, "r");
if (fp == NULL)
return;
while (fgets(buf, 512, fp) != NULL) {
dm_ctx_init_sub(&dmctx, DM_CWMP, cwmp_main.conf.amd_version, cwmp_main.conf.instance_mode);
initiate = true;
int len = strlen(buf);
if (len)
buf[len-1] = '\0';
#ifdef TR098
dmjson_parse_init(buf);
dmjson_get_var("parameter", &jval);
parameter = strdup(jval);
dmjson_get_var("value", &jval);
value = strdup(jval);
dmjson_get_var("notification", &jval);
notification = strdup(jval);
dmjson_parse_fini();
#else
bbfdmjson_parse_init(buf);
bbfdmjson_get_var("parameter", &jval);
parameter = strdup(jval);
bbfdmjson_get_var("value", &jval);
value = strdup(jval);
bbfdmjson_get_var("notification", &jval);
notification = strdup(jval);
bbfdmjson_parse_fini();
#endif
fault = dm_entry_param_method(&dmctx, CMD_GET_VALUE, parameter, NULL, NULL);
if (!fault && dmctx.list_parameter.next != &dmctx.list_parameter) {
dm_parameter = list_entry(dmctx.list_parameter.next, struct dm_parameter, list);
if (strcmp(dm_parameter->data, value) != 0 && notification[0] == '1') {
#ifdef TR098
dm_update_file_enabled_notify(parameter, dm_parameter->data);
iscopy = copy_temporary_file_to_original_file(DM_ENABLED_NOTIFY, DM_ENABLED_NOTIFY_TEMPORARY);
#else
bbfdm_update_file_enabled_notify(parameter, dm_parameter->data);
iscopy = dm_copy_temporary_file_to_original_file(DM_ENABLED_NOTIFY, DM_ENABLED_NOTIFY_TEMPORARY);
#endif
if(iscopy)
remove(DM_ENABLED_NOTIFY_TEMPORARY);
add_list_value_change(parameter, dm_parameter->data, dm_parameter->type);
}
}
FREE(value);
FREE(notification);
FREE(parameter);
}
fclose(fp);
cwmp_dm_ctx_clean(cwmp, &dmctx);
}
void cwmp_add_notification(void)
{
int fault, iscopy;
......
......@@ -299,6 +299,7 @@ int event_remove_noretry_event_container(struct session *session, struct cwmp *c
void cwmp_save_event_container (struct cwmp *cwmp,struct event_container *event_container);
void *thread_event_periodic (void *v);
void cwmp_add_notification(void);
void cwmp_add_notification_min(void);
int netlink_init(void);
char * mix_get_time(void);
char * mix_get_time_of(time_t t_time);
......
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