mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Apply bbfdm dmmap changes while reloading the services
This commit is contained in:
parent
86a659a869
commit
15a5778c4f
2 changed files with 24 additions and 13 deletions
33
src/common.c
33
src/common.c
|
|
@ -580,33 +580,40 @@ void icwmp_free_list_services()
|
|||
|
||||
void icwmp_restart_services()
|
||||
{
|
||||
int i;
|
||||
struct blob_buf bb = {0};
|
||||
|
||||
for (i = 0; i < nbre_services; i++) {
|
||||
memset(&bb, 0, sizeof(struct blob_buf));
|
||||
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
void *array = blobmsg_open_array(&bb, "services");
|
||||
|
||||
for (int i = 0; i < nbre_services; i++) {
|
||||
if (list_services[i] == NULL)
|
||||
continue;
|
||||
|
||||
struct blob_buf b = { 0 };
|
||||
CWMP_MEMSET(&b, 0, sizeof(struct blob_buf));
|
||||
blob_buf_init(&b, 0);
|
||||
bb_add_string(&b, "config", list_services[i]);
|
||||
|
||||
if (CWMP_STRCMP(list_services[i], "cwmp") == 0) {
|
||||
commit_uci_package("cwmp");
|
||||
} else {
|
||||
icwmp_ubus_invoke("uci", "commit", b.head, NULL, NULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
blob_buf_free(&b);
|
||||
|
||||
if (CWMP_STRCMP(list_services[i], "firewall") == 0) {
|
||||
if (CWMP_STRCMP(list_services[i], "firewall") == 0)
|
||||
g_firewall_restart = true;
|
||||
|
||||
blobmsg_add_string(&bb, NULL, list_services[i]);
|
||||
}
|
||||
}
|
||||
|
||||
blobmsg_close_array(&bb, array);
|
||||
|
||||
icwmp_ubus_invoke("bbf.config", "commit", bb.head, NULL, NULL);
|
||||
|
||||
blob_buf_free(&bb);
|
||||
|
||||
if (g_firewall_restart) {
|
||||
CWMP_LOG(INFO, "Initiating Firewall restart");
|
||||
set_uci_path_value(VARSTATE_CONFIG, "icwmp.cpe.firewall_restart", "in_progress");
|
||||
}
|
||||
|
||||
icwmp_free_list_services();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -299,6 +299,8 @@ static void soap_add_object_message_test(void **state)
|
|||
|
||||
int ret = cwmp_handle_rpc_cpe_add_object(rpc_cpe);
|
||||
assert_int_equal(ret, 0);
|
||||
icwmp_restart_services();
|
||||
|
||||
env = mxmlFindElement(cwmp_main->session->tree_out, cwmp_main->session->tree_out, "soap_env:Envelope", NULL, NULL, MXML_DESCEND);
|
||||
assert_non_null(env);
|
||||
n = mxmlFindElement(env, env, "soap_env:Header", NULL, NULL, MXML_DESCEND);
|
||||
|
|
@ -449,6 +451,8 @@ static void soap_delete_object_message_test(void **state)
|
|||
|
||||
int ret = cwmp_handle_rpc_cpe_delete_object(rpc_cpe);
|
||||
assert_int_equal(ret, 0);
|
||||
icwmp_restart_services();
|
||||
|
||||
env = mxmlFindElement(cwmp_main->session->tree_out, cwmp_main->session->tree_out, "soap_env:Envelope", NULL, NULL, MXML_DESCEND);
|
||||
assert_non_null(env);
|
||||
n = mxmlFindElement(env, env, "soap_env:Header", NULL, NULL, MXML_DESCEND);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue