RDKBWIFI-442: Beacon measurements collection from the associated STA#1130
Open
Nikita-Hakai wants to merge 1 commit into
Open
RDKBWIFI-442: Beacon measurements collection from the associated STA#1130Nikita-Hakai wants to merge 1 commit into
Nikita-Hakai wants to merge 1 commit into
Conversation
5f0c136 to
c5ac862
Compare
Contributor
There was a problem hiding this comment.
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.BeaconQueryhandling 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_setRMBeaconRequestfails, 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_freecleanup path, which currently only freesu.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
ReportDatais missing or invalid,decode_param_stringreturns immediately from the function and bypasses the free forsta_data->data, leaking the buffer allocated above.
decode_param_string(obj_sta_cfg, "ReportData", param);
source/webconfig/wifi_decoder.c:6289
stringtohexonly checks that the output buffer is large enough for the input string; it does not requireReportDatato contain exactlyFrameLen * 2hex 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.
c5ac862 to
3a33f4a
Compare
3a33f4a to
6cf8d7b
Compare
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(¶ms->sta_beacon_report, 0, sizeof(sta_beacon_report_reponse_t)); |
|
|
||
| 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; |
| } | ||
| } | ||
|
|
||
| wifi_hal_setRMBeaconRequest(ap_index, query->sta_mac, params, &out_dialog); |
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 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; |
| { 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Collection of Beacon measurement report from the associated STA