Skip to content

RDKBWIFI-442: Beacon measurements collection from the associated STA#1130

Open
Nikita-Hakai wants to merge 1 commit into
rdkcentral:developfrom
Nikita-Hakai:beacon_metrics
Open

RDKBWIFI-442: Beacon measurements collection from the associated STA#1130
Nikita-Hakai wants to merge 1 commit into
rdkcentral:developfrom
Nikita-Hakai:beacon_metrics

Conversation

@Nikita-Hakai
Copy link
Copy Markdown
Contributor

@Nikita-Hakai Nikita-Hakai commented May 13, 2026

Collection of Beacon measurement report from the associated STA

@github-actions github-actions Bot added the community contribution Contributions from community. label May 13, 2026
@Nikita-Hakai Nikita-Hakai force-pushed the beacon_metrics branch 3 times, most recently from 5f0c136 to c5ac862 Compare May 14, 2026 17:27
@Nikita-Hakai Nikita-Hakai marked this pull request as ready for review May 14, 2026 18:00
@Nikita-Hakai Nikita-Hakai requested a review from a team as a code owner May 14, 2026 18:00
Copilot AI review requested due to automatic review settings May 14, 2026 18:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds EasyMesh beacon-query/report plumbing so the EM app can request beacon measurements from associated STAs, process RRM measurement reports, encode/decode beacon report payloads, and translate them into EasyMesh STA info.

Changes:

  • Adds Device.WiFi.EM.BeaconQuery handling and RRM action-frame send/receive paths.
  • Changes beacon report payload storage from a fixed array to dynamically allocated data.
  • Updates beacon report encoding/decoding and EasyMesh translation logic.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
source/webconfig/wifi_webconfig_beacon_report.c Frees prior dynamic beacon report data before decoding a new report.
source/webconfig/wifi_encoder.c Dynamically allocates the hex string used to encode report data.
source/webconfig/wifi_easymesh_translator.c Finds BSS by vap_index and copies beacon report data into EasyMesh STA info.
source/webconfig/wifi_decoder.c Allocates beacon report data from decoded FrameLen and decodes hex report data.
source/core/wifi_ctrl.c Routes radio measurement action frames to the beacon report event subtype.
source/apps/em/wifi_em.h Adds beacon query namespace and EM data fields.
source/apps/em/wifi_em.c Adds beacon query sending, RRM beacon report parsing/publishing, and bus registration.
include/wifi_base.h Adds beacon query params and changes beacon report data to a pointer.
Comments suppressed due to low confidence (4)

source/apps/em/wifi_em.c:935

  • The HAL result is ignored. If wifi_hal_setRMBeaconRequest fails, the function still logs a dialog token and returns success, so the controller gets no indication that the beacon request was not transmitted.
    wifi_hal_setRMBeaconRequest(ap_index, query->sta_mac, params, &out_dialog);
    wifi_util_dbg_print(WIFI_EM, "%s:%d: dialogue token is %d\n", __func__, __LINE__, out_dialog);

source/webconfig/wifi_decoder.c:6284

  • This new allocation is not released by the generic webconfig_data_free cleanup path, which currently only frees u.encoded.raw. Successful beacon-report decodes will therefore leak the report buffer unless this ownership is added to cleanup or freed after translation.
    sta_data->data = (unsigned char *)malloc(sta_data->data_len);
    if (sta_data->data == NULL) {
        wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: failed to allocate %u bytes for report data\n",
            __func__, __LINE__, sta_data->data_len);
        return webconfig_error_decode;

source/webconfig/wifi_decoder.c:6287

  • If ReportData is missing or invalid, decode_param_string returns immediately from the function and bypasses the free for sta_data->data, leaking the buffer allocated above.
    decode_param_string(obj_sta_cfg, "ReportData", param);

source/webconfig/wifi_decoder.c:6289

  • stringtohex only checks that the output buffer is large enough for the input string; it does not require ReportData to contain exactly FrameLen * 2 hex characters. With the new malloc'd buffer, a short hex string leaves the remaining bytes uninitialized and those bytes can be forwarded/encoded as part of the report.
    out_ptr = stringtohex(strlen(param->valuestring), param->valuestring, sta_data->data_len,
        sta_data->data);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Comment thread source/webconfig/wifi_decoder.c
@Nikita-Hakai Nikita-Hakai changed the title Beacon metrics RDKBWIFI-442: Beacon measurements collection from the associated STA May 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Comment on lines 6276 to +6284
// FrameLen
decode_param_integer(obj_sta_cfg, "FrameLen", param);
sta_data->data_len = param->valuedouble;

sta_data->data = (unsigned char *)malloc(sta_data->data_len);
if (sta_data->data == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: failed to allocate %u bytes for report data\n",
__func__, __LINE__, sta_data->data_len);
return webconfig_error_decode;
Comment on lines 6287 to 6289
decode_param_string(obj_sta_cfg, "ReportData", param);
out_ptr = stringtohex(strlen(param->valuestring), param->valuestring, sta_data->data_len,
sta_data->data);
Comment on lines +2881 to +2886
size_t hex_buf_len = sta_data->data_len * 2 + 1;
char *assoc_frame_string = (char *)malloc(hex_buf_len);
if (assoc_frame_string == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d failed to allocate hex buffer\n", __func__, __LINE__);
return webconfig_error_encode;
}
Comment on lines +167 to 168
free(params->sta_beacon_report.data);
memset(&params->sta_beacon_report, 0, sizeof(sta_beacon_report_reponse_t));
Comment thread source/apps/em/wifi_em.c

if (radio_oper_param == NULL) {
wifi_util_error_print(WIFI_EM, "%s:%d Unable to get radio params with radio_index:%d\n", __func__, __LINE__, radio_index);
return 0;
Comment thread source/apps/em/wifi_em.c
}
}

wifi_hal_setRMBeaconRequest(ap_index, query->sta_mac, params, &out_dialog);
Comment thread source/apps/em/wifi_em.c
Comment on lines +2563 to +2568
data_len = len - IEEE80211_HDRLEN - 1 - sizeof(mgmt->u.action.u.rrm);
report.data = (unsigned char *)malloc(data_len);
if (report.data == NULL) {
wifi_util_error_print(WIFI_EM, "%s:%d failed to allocate %zu bytes for beacon report data\n",
__func__, __LINE__, data_len);
return -1;
Comment thread source/apps/em/wifi_em.c
Comment on lines +2915 to +2930
if (p_data->data_type != bus_data_type_bytes) {
wifi_util_error_print(WIFI_EM, "%s:%d: Invalid Received:%s data type:%x\n",

__func__, __LINE__, event_name, p_data->data_type);
return bus_error_invalid_input;
}

if (p_data->raw_data.bytes == NULL) {
wifi_util_error_print(WIFI_EM, "%s:%d: Invalid Received:%s raw_data.bytes is NULL\n",
__func__, __LINE__, event_name);
return bus_error_invalid_input;
}

//now create map for response and send
em_send_action_frame(p_data->raw_data.bytes);
return bus_error_success;
Comment thread source/apps/em/wifi_em.c
{ NULL, NULL, NULL, NULL, NULL, NULL}, slow_speed, ZERO_TABLE,
{ bus_data_type_bytes, false, 0, 0, 0, NULL } },
{ WIFI_EM_BEACON_QUERY, bus_element_type_event,
{ NULL, send_beacon_query, NULL, NULL, NULL, NULL }, slow_speed, ZERO_TABLE,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution Contributions from community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants