From 8201f79d124fdd0887968778ce0804ec7f3b7daa Mon Sep 17 00:00:00 2001 From: Vivek Dutta Date: Tue, 6 Jan 2026 18:29:06 +0530 Subject: [PATCH] Revert "Do not commit in get operation" --- bbfdmd/ubus/bbfdmd.c | 2 -- bbfdmd/ubus/common.c | 15 ------------ bbfdmd/ubus/common.h | 1 - bbfdmd/ubus/get.c | 49 ++++---------------------------------- bbfdmd/ubus/get.h | 6 ----- libbbfdm-ubus/get.c | 16 ++----------- utilities/src/ubus/utils.c | 2 +- 7 files changed, 7 insertions(+), 84 deletions(-) diff --git a/bbfdmd/ubus/bbfdmd.c b/bbfdmd/ubus/bbfdmd.c index 7049cf56..d7ce3ce5 100644 --- a/bbfdmd/ubus/bbfdmd.c +++ b/bbfdmd/ubus/bbfdmd.c @@ -294,8 +294,6 @@ static int bbfdm_handler_async(struct ubus_context *ctx, struct ubus_object *obj context->ubus_ctx = ctx; context->raw_format = raw_format; - INIT_LIST_HEAD(&context->uci_modified); - memset(&context->tmp_bb, 0, sizeof(struct blob_buf)); blob_buf_init(&context->tmp_bb, 0); diff --git a/bbfdmd/ubus/common.c b/bbfdmd/ubus/common.c index a3c8858a..7ee99179 100644 --- a/bbfdmd/ubus/common.c +++ b/bbfdmd/ubus/common.c @@ -109,21 +109,6 @@ struct blob_attr *get_results_array(struct blob_attr *msg) return tb[0]; } -struct blob_attr *get_modified_uci_array(struct blob_attr *msg) -{ - struct blob_attr *tb[1] = {0}; - const struct blobmsg_policy p[1] = { - { "modified_uci", BLOBMSG_TYPE_ARRAY } - }; - - if (msg == NULL) - return NULL; - - blobmsg_parse(p, 1, tb, blobmsg_data(msg), blobmsg_len(msg)); - - return tb[0]; -} - bool str_match(const char *string, const char *pattern, size_t nmatch, regmatch_t pmatch[]) { regex_t re; diff --git a/bbfdmd/ubus/common.h b/bbfdmd/ubus/common.h index 47a961b2..77cd07dd 100644 --- a/bbfdmd/ubus/common.h +++ b/bbfdmd/ubus/common.h @@ -39,7 +39,6 @@ unsigned int get_proto_type(const char *proto); void fill_optional_input(struct blob_attr *msg, unsigned int *proto, bool *raw_format); struct blob_attr *get_results_array(struct blob_attr *msg); -struct blob_attr *get_modified_uci_array(struct blob_attr *msg); bool str_match(const char *string, const char *pattern, size_t nmatch, regmatch_t pmatch[]); bool proto_match(unsigned int dm_type, const enum bbfdmd_type_enum type); diff --git a/bbfdmd/ubus/get.c b/bbfdmd/ubus/get.c index 5cc78f3f..12b66340 100644 --- a/bbfdmd/ubus/get.c +++ b/bbfdmd/ubus/get.c @@ -30,17 +30,6 @@ static void prepare_and_send_response(struct async_request_context *ctx) blobmsg_close_array(&ctx->tmp_bb, ctx->array); - struct list_uci_modified *list_node = NULL, *tmp = NULL; - void *array = blobmsg_open_array(&ctx->tmp_bb, "modified_uci"); - - list_for_each_entry_safe(list_node, tmp, &ctx->uci_modified, list) { - blobmsg_add_string(&ctx->tmp_bb, "", list_node->file_path); - list_del(&list_node->list); - BBFDM_FREE(list_node); - } - - blobmsg_close_array(&ctx->tmp_bb, array); - if (strcmp(ctx->ubus_method, "get") == 0 && ctx->raw_format == false) { // Pretty Format struct blob_buf bb_pretty = {0}; @@ -76,41 +65,11 @@ static void append_response_data(struct ubus_request_tracker *tracker, struct bl return; struct blob_attr *results = get_results_array(msg); - if (results) { - blobmsg_for_each_attr(attr, results, remaining) { - blobmsg_add_blob(&tracker->ctx->tmp_bb, attr); - } - } + if (!results) + return; - struct blob_attr *modified_uci = get_modified_uci_array(msg); - if (modified_uci) { - bool exist = false; - struct list_uci_modified *list_node = NULL; - - attr = NULL; - remaining = 0; - - blobmsg_for_each_attr(attr, modified_uci, remaining) { - list_for_each_entry(list_node, &tracker->ctx->uci_modified, list) { - if (strcmp(list_node->file_path, blobmsg_get_string(attr)) == 0) { - exist = true; - break; - } - } - - if (exist == true) - continue; - - list_node = (struct list_uci_modified *)calloc(1, sizeof(struct list_uci_modified)); - if (list_node == NULL) { - BBFDM_INFO("Failed to allocate memory in get response handler for changed uci"); - continue; - } - - INIT_LIST_HEAD(&list_node->list); - list_add_tail(&list_node->list, &tracker->ctx->uci_modified); - snprintf(list_node->file_path, sizeof(list_node->file_path), "%s", blobmsg_get_string(attr)); - } + blobmsg_for_each_attr(attr, results, remaining) { + blobmsg_add_blob(&tracker->ctx->tmp_bb, attr); } } diff --git a/bbfdmd/ubus/get.h b/bbfdmd/ubus/get.h index 3b234140..53680980 100644 --- a/bbfdmd/ubus/get.h +++ b/bbfdmd/ubus/get.h @@ -20,7 +20,6 @@ enum { }; struct async_request_context { - struct list_head uci_modified; struct ubus_context *ubus_ctx; struct ubus_request_data request_data; struct blob_buf tmp_bb; @@ -41,11 +40,6 @@ struct ubus_request_tracker { char request_name[128]; }; -struct list_uci_modified { - struct list_head list; - char file_path[2048]; -}; - void run_async_call(struct async_request_context *ctx, service_entry_t *service, struct blob_attr *msg); void send_response(struct async_request_context *ctx); diff --git a/libbbfdm-ubus/get.c b/libbbfdm-ubus/get.c index 28b38cd7..4d8ff690 100644 --- a/libbbfdm-ubus/get.c +++ b/libbbfdm-ubus/get.c @@ -42,16 +42,6 @@ void bbfdm_get(bbfdm_data_t *data, int method) blobmsg_close_array(&data->bbf_ctx.bb, array); - array = blobmsg_open_array(&data->bbf_ctx.bb, "modified_uci"); - if (data->bbf_ctx.modified_uci_head != NULL) { - struct dm_modified_uci *m; - list_for_each_entry(m, data->bbf_ctx.modified_uci_head, list) { - bb_add_string(&data->bbf_ctx.bb, "", m->uci_file); - } - } - - blobmsg_close_array(&data->bbf_ctx.bb, array); - if (!validate_msglen(data)) { BBF_ERR("IPC failed for path(%s)", data->bbf_ctx.in_param); } @@ -60,10 +50,8 @@ void bbfdm_get(bbfdm_data_t *data, int method) ubus_send_reply(data->ctx, data->req, data->bbf_ctx.bb.head); } - // Apply all bbfdm dmmap changes - if (data->bbf_ctx.dm_type == BBFDM_BOTH) { - dmuci_commit_bbfdm(); - } + // Apply all bbfdm changes + dmuci_commit_bbfdm(); bbf_cleanup(&data->bbf_ctx); } diff --git a/utilities/src/ubus/utils.c b/utilities/src/ubus/utils.c index cd1b63f9..b2398645 100644 --- a/utilities/src/ubus/utils.c +++ b/utilities/src/ubus/utils.c @@ -105,7 +105,7 @@ static void add_external_action_list(struct list_head *action_list, struct list_ bool arg_exist = false; list_for_each_entry(act_node, action_list, list) { - if (strcmp(act_node->action, DEFAULT_HANDLER_ACT) == 0) { + if (strcmp(app_node->action, DEFAULT_HANDLER_ACT) == 0) { node_exist = true; for (int i = 0; i < act_node->idx; i++) { if (strcmp(act_node->arg[i], config) == 0) {