RDKBWIFI-278: CLIENT ASSOC CTRL REQUEST#926
RDKBWIFI-278: CLIENT ASSOC CTRL REQUEST#926sundram0711 wants to merge 1 commit intordkcentral:developfrom
Conversation
b31e3de to
1c5dab9
Compare
8ab3213 to
b07a543
Compare
b07a543 to
eb55006
Compare
There was a problem hiding this comment.
Pull request overview
Implements EasyMesh “Client Assoc Ctrl Request” handling in the EM agent to block/unblock a station on a specific BSSID using the ACL mechanism, with optional expiry via a timer callback.
Changes:
- Adds a new EM bus namespace for
Device.WiFi.EM.ClientAssocCtrlRequest. - Introduces a new request payload type (
client_assoc_ctrl_req_t) for association control parameters. - Adds an EM event handler that updates ACL entries and schedules timed ACL removal.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 14 comments.
| File | Description |
|---|---|
| source/apps/em/wifi_em.h | Adds the new bus namespace string for the client association control request. |
| source/apps/em/wifi_em.c | Adds the ACL timer callback, event handler logic, and registers the new bus event in em_init(). |
| include/wifi_base.h | Adds the client_assoc_ctrl_req_t request structure used as the bytes payload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { bus_data_type_string, false, 0, 0, 0, NULL } } | ||
| { bus_data_type_string, false, 0, 0, 0, NULL } }, | ||
| { WIFI_EM_CLIENT_ASSOC_CTRL_REQ, bus_element_type_event, | ||
| { NULL, easymesh_client_assoc_ctrl_handler, NULL, NULL, NULL, NULL }, slow_speed, ZERO_TABLE, |
There was a problem hiding this comment.
The callback for a bus_element_type_event should be registered in cb_table.event_sub_handler (5th field), but this event registers easymesh_client_assoc_ctrl_handler in cb_table.set_handler (2nd field). As a result the subscription callback will never fire; move the handler to the event_sub_handler slot (and keep other slots NULL as in other event registrations, e.g. wifi_levl.c).
| { NULL, easymesh_client_assoc_ctrl_handler, NULL, NULL, NULL, NULL }, slow_speed, ZERO_TABLE, | |
| { NULL, NULL, NULL, NULL, easymesh_client_assoc_ctrl_handler, NULL }, slow_speed, ZERO_TABLE, |
There was a problem hiding this comment.
@sundram0711 , the function easymesh_client_assoc_ctrl_handler is addressing the set of the ACL, can you rename it appropriately so that it indicates it as set?
f70d64d to
d2ca27c
Compare
Implement client association control request handling on a per-station basis. The agent receives and processes the request, forwarding it from the agent to OneWiFi and then to rdk-wifi-hal to block or unblock clients using the ACL mechanism. Unit Testing: Triggered the association control request from the controller using rdkb-cli. Added a temporary handler in main.go and invoked it via a curl command. Note: EasyMesh(rdkb-cli) currently supports processing this command only for connected clients. Test Results: When the controller sends a request to block a connected client on a specific BSSID for a defined duration, the client is added to the ACL for that BSSID. If the client disconnects and attempts to reconnect, it is denied access to the same BSSID. When blocked on the 5GHz BSSID, the client was still able to connect to the 2.4GHz BSSID. After blocking the client on both 5GHz and 2.4GHz BSSIDs, the client was unable to connect until the validity timer expired. Signed-off-by: Sundram Patel <Sundram.p@tataelxsi.co.in>
d2ca27c to
b339695
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| static bus_error_t easymesh_client_assoc_ctrl_handler(char *event_name, raw_data_t *p_data, void *userData) | ||
| { | ||
| wifi_util_dbg_print(WIFI_CTRL, "%s:%d Recevied Client Assoc Ctrl Event from Agent\n", __func__, __LINE__); |
There was a problem hiding this comment.
The debug log has a spelling issue: "Recevied" → "Received".
| wifi_util_dbg_print(WIFI_CTRL, "%s:%d Recevied Client Assoc Ctrl Event from Agent\n", __func__, __LINE__); | |
| wifi_util_dbg_print(WIFI_CTRL, "%s:%d Received Client Assoc Ctrl Event from Agent\n", __func__, __LINE__); |
|
|
||
| (void)userData; | ||
| client_assoc_ctrl_req_t *assoc_ctrl_req; | ||
| unsigned int i; |
There was a problem hiding this comment.
unsigned int i; is declared but never used. If the build treats warnings as errors, this will break compilation; please remove it (or use it if a loop is intended).
| unsigned int i; |
|
|
||
| assoc_ctrl_req = (client_assoc_ctrl_req_t *)p_data->raw_data.bytes; | ||
|
|
||
| vap_index = em_get_radio_index_from_mac(assoc_ctrl_req->bssid); |
There was a problem hiding this comment.
em_get_radio_index_from_mac() returns RETURN_ERR when the BSSID is not found (see wifi_em.c:99-123), but the result is used directly as vap_index. Add a check for vap_index == RETURN_ERR and return an error before calling ACL HAL APIs with an invalid index.
| vap_index = em_get_radio_index_from_mac(assoc_ctrl_req->bssid); | |
| vap_index = em_get_radio_index_from_mac(assoc_ctrl_req->bssid); | |
| if (vap_index == RETURN_ERR) { | |
| wifi_util_error_print(WIFI_CTRL, "%s:%d Invalid BSSID %s, unable to resolve vap index\n", | |
| __func__, __LINE__, to_mac_str(assoc_ctrl_req->bssid, bssid_mac_str)); | |
| return bus_error_invalid_input; | |
| } |
| if (scheduler_add_timer_task(ctrl->sched, TRUE, NULL, del_acl_cb, kick_details, | ||
| assoc_ctrl_req->validity_period * 1000, 1, FALSE) != 0) { | ||
| wifi_util_error_print(WIFI_CTRL, "%s:%d Failed to schedule timer task for vap %d\n", __func__, | ||
| __LINE__, vap_index); |
There was a problem hiding this comment.
If scheduler_add_timer_task() fails, the STA has already been added to the ACL but no expiry task is scheduled, which can leave the client blocked indefinitely. In this error path, remove the newly-added ACL entry (best-effort) and free kick_details->kick_list (currently leaked) before returning an error.
| __LINE__, vap_index); | |
| __LINE__, vap_index); | |
| #ifdef NL80211_ACL | |
| if (wifi_hal_delApAclDevice(vap_index, sta_mac_str) != RETURN_OK) { | |
| wifi_util_error_print(WIFI_CTRL, "%s:%d Failed to roll back ACL device on vap %d\n", | |
| __func__, __LINE__, vap_index); | |
| } | |
| #else | |
| if (wifi_delApAclDevice(vap_index, sta_mac_str) != RETURN_OK) { | |
| wifi_util_error_print(WIFI_CTRL, "%s:%d Failed to roll back ACL device on vap %d\n", | |
| __func__, __LINE__, vap_index); | |
| } | |
| #endif | |
| free(kick_details->kick_list); | |
| kick_details->kick_list = NULL; |
| success = (wifi_hal_delApAclDevice(vap_index, sta_mac_str) == RETURN_OK); | ||
| #else | ||
| success = (wifi_delApAclDevice(vap_index, sta_mac_str) == RETURN_OK); | ||
| #endif |
There was a problem hiding this comment.
In the unblock path, success is set based on *_delApAclDevice() but the result is ignored and the handler always returns bus_error_success. Please check success and return an error when the ACL delete fails so the caller gets an accurate outcome.
| #endif | |
| #endif | |
| if (!success) { | |
| wifi_util_error_print(WIFI_CTRL, "%s:%d Failed to delete ACL device on vap %d\n", | |
| __func__, __LINE__, vap_index); | |
| ret = bus_error_general; | |
| goto cleanup; | |
| } |
RDKBWIFI-278: CLIENT ASSOC CTRL REQUEST
Implement client association control request handling on a per-station basis.
The agent receives and processes the request, forwarding it from the agent to OneWiFi and then to rdk-wifi-hal to block or unblock clients using the ACL mechanism.
Unit Testing:
Triggered the association control request from the controller using rdkb-cli.
Added a temporary handler in main.go and invoked it via a curl command.
Note: EasyMesh(rdkb-cli) currently supports processing this command only for connected clients.
Test Results:
When the controller sends a request to block a connected client on a specific BSSID for a defined duration, the client is added to the ACL for that BSSID.
If the client disconnects and attempts to reconnect, it is denied access to the same BSSID.
When blocked on the 5GHz BSSID, the client was still able to connect to the 2.4GHz BSSID.
After blocking the client on both 5GHz and 2.4GHz BSSIDs, the client was unable to connect until the validity timer expired.
Signed-off-by: Sundram Patel Sundram.p@tataelxsi.co.in