mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Commit cwmp if in service list
This commit is contained in:
parent
601708dd0a
commit
3e2d5bd86e
4 changed files with 39 additions and 2 deletions
|
|
@ -591,7 +591,11 @@ void icwmp_restart_services()
|
|||
blob_buf_init(&b, 0);
|
||||
bb_add_string(&b, "config", list_services[i]);
|
||||
|
||||
icwmp_ubus_invoke("uci", "commit", b.head, NULL, NULL);
|
||||
if (CWMP_STRCMP(list_services[i], "cwmp") == 0) {
|
||||
commit_uci_package("cwmp");
|
||||
} else {
|
||||
icwmp_ubus_invoke("uci", "commit", b.head, NULL, NULL);
|
||||
}
|
||||
|
||||
blob_buf_free(&b);
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ static void ubus_transaction_callback(struct ubus_request *req, int type __attri
|
|||
blobmsg_for_each_attr(service, updated_services, rem) {
|
||||
char *service_name = blobmsg_get_string(service);
|
||||
|
||||
if (CWMP_STRLEN(service_name) == 0 || CWMP_STRCMP(service_name, "cwmp") == 0)
|
||||
if (CWMP_STRLEN(service_name) == 0)
|
||||
continue;
|
||||
|
||||
CWMP_LOG(DEBUG, "Detected service: %s will be restarted in the end session", service_name);
|
||||
|
|
|
|||
|
|
@ -919,3 +919,35 @@ exit:
|
|||
pthread_mutex_unlock(&mutex_config_load);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int commit_uci_package(char *package)
|
||||
{
|
||||
struct uci_context *uci_ctx = NULL;
|
||||
struct uci_ptr ptr = {0};
|
||||
int ret = 0;
|
||||
|
||||
pthread_mutex_lock(&mutex_config_load);
|
||||
uci_ctx = uci_alloc_context();
|
||||
if (!uci_ctx) {
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (uci_lookup_ptr(uci_ctx, &ptr, package, true) != UCI_OK) {
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (uci_commit(uci_ctx, &ptr.p, false) != UCI_OK) {
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:
|
||||
if (uci_ctx) {
|
||||
uci_free_context(uci_ctx);
|
||||
}
|
||||
pthread_mutex_unlock(&mutex_config_load);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ int set_uci_path_value(const char *conf_dir, char *path, char *value);
|
|||
int set_uci_list_value(const char *conf_dir, char *path, char *value);
|
||||
int del_uci_list_value(const char *conf_dir, char *path, char *value);
|
||||
int get_inform_parameters_uci(struct list_head *inform_head);
|
||||
int commit_uci_package(char *package);
|
||||
int get_global_config();
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue