mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Custom notify json update
- Logic updated to handle power reset while importing the custom notify json - Import of custom notify parameters only marked as successful, after a successful backup by init script. This logic has an external dependency on init script, as the init script is responsible for backup of updated configs during the reboots.
This commit is contained in:
parent
e3d43fb450
commit
e12c739d30
2 changed files with 8 additions and 5 deletions
|
|
@ -46,7 +46,8 @@ extern struct list_head list_param_obj_notify;
|
|||
|
||||
|
||||
#define DM_ENABLED_NOTIFY "/var/run/icwmpd/dm_enabled_notify"
|
||||
#define NOTIFY_FILE "/etc/icwmpd/icwmpd_notify"
|
||||
#define NOTIFY_MARKER "/etc/icwmpd/icwmpd_notify_import_marker"
|
||||
#define RUN_NOTIFY_MARKER "/var/run/icwmpd/icwmpd_notify_import_marker"
|
||||
void ubus_check_value_change_callback(struct ubus_request *req, int type, struct blob_attr *msg);
|
||||
void cwmp_update_enabled_notify_file(void);
|
||||
int check_value_change(void);
|
||||
|
|
|
|||
|
|
@ -400,16 +400,18 @@ void load_custom_notify_json(struct cwmp *cwmp)
|
|||
if (cwmp->conf.custom_notify_json == NULL || !file_exists(cwmp->conf.custom_notify_json))
|
||||
return;
|
||||
|
||||
if (file_exists(NOTIFY_FILE))
|
||||
// Check for custom notification success import marker
|
||||
if (file_exists(NOTIFY_MARKER) == true)
|
||||
return;
|
||||
|
||||
memset(&bbuf, 0, sizeof(struct blob_buf));
|
||||
blob_buf_init(&bbuf, 0);
|
||||
|
||||
// Create success marker in temp area, so that it can be in sync with backup script
|
||||
if (blobmsg_add_json_from_file(&bbuf, cwmp->conf.custom_notify_json) == false) {
|
||||
CWMP_LOG(WARNING, "The file %s is not a valid JSON file", cwmp->conf.custom_notify_json);
|
||||
blob_buf_free(&bbuf);
|
||||
creat(NOTIFY_FILE , S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
creat(RUN_NOTIFY_MARKER, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +421,7 @@ void load_custom_notify_json(struct cwmp *cwmp)
|
|||
if (tb_notif[0] == NULL) {
|
||||
CWMP_LOG(WARNING, "The JSON file %s doesn't contain a notify parameters list", cwmp->conf.custom_notify_json);
|
||||
blob_buf_free(&bbuf);
|
||||
creat(NOTIFY_FILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
creat(RUN_NOTIFY_MARKER, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
return;
|
||||
}
|
||||
custom_notify_list = tb_notif[0];
|
||||
|
|
@ -448,7 +450,7 @@ void load_custom_notify_json(struct cwmp *cwmp)
|
|||
}
|
||||
}
|
||||
blob_buf_free(&bbuf);
|
||||
creat(NOTIFY_FILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
creat(RUN_NOTIFY_MARKER, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
cwmp->custom_notify_active = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue