From 4d13d1ed53a94aeb8c35fb4e161e9b2ea84f0069 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta Date: Thu, 6 Jul 2023 10:10:02 +0000 Subject: [PATCH] Fix Device.Bridge.Bridge.{i}.STP.Status get --- bbfdmd/src/events.c | 3 ++- libbbfdm/dmtree/tr181/bridging.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bbfdmd/src/events.c b/bbfdmd/src/events.c index 82408133..8e3696c5 100644 --- a/bbfdmd/src/events.c +++ b/bbfdmd/src/events.c @@ -187,7 +187,8 @@ static void bbfdm_event_handler(struct ubus_context *ctx, struct ubus_event_hand blobmsg_add_string(&b, "name", dm_path); generate_blob_input(&bb, type, &pv_list); blobmsg_add_field(&b, BLOBMSG_TYPE_TABLE, "input", blob_data(bb.head), blob_len(bb.head)); - ubus_send_event(ctx, BBF_EVENT, b.head); + ubus_send_event(ctx, method_name, b.head); + DEBUG("Event[%s], for [%s] sent", method_name, dm_path); blob_buf_free(&bb); blob_buf_free(&b); diff --git a/libbbfdm/dmtree/tr181/bridging.c b/libbbfdm/dmtree/tr181/bridging.c index 663fef78..dc4b3996 100644 --- a/libbbfdm/dmtree/tr181/bridging.c +++ b/libbbfdm/dmtree/tr181/bridging.c @@ -1748,13 +1748,17 @@ static int get_BridgingBridgeSTP_Status(char *refparam, struct dmctx *ctx, void { char *name = NULL; + *value = "Disabled"; dmuci_get_value_by_section_string(((struct bridge_args *)data)->bridge_sec, "name", &name); - get_net_device_status(name, value); - if (DM_STRCMP(*value, "Up") == 0) { - *value = "Enabled"; - } else { - *value = "Disabled"; + if (DM_STRLEN(name) == 0) { + return 0; } + + char *enable = NULL; + get_net_device_sysfs(name, "bridge/stp_state", &enable); + if (DM_STRCMP(enable, "1") == 0) + *value = "Enabled"; + return 0; }