Skip to content

RDKBWIFI-278: CLIENT ASSOC CTRL REQUEST#926

Open
sundram0711 wants to merge 1 commit intordkcentral:developfrom
sundram0711:easymesh-client_assoc_ctrl_req
Open

RDKBWIFI-278: CLIENT ASSOC CTRL REQUEST#926
sundram0711 wants to merge 1 commit intordkcentral:developfrom
sundram0711:easymesh-client_assoc_ctrl_req

Conversation

@sundram0711
Copy link
Copy Markdown
Contributor

@sundram0711 sundram0711 commented Feb 26, 2026

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

@sundram0711 sundram0711 requested a review from a team as a code owner February 26, 2026 19:05
@sundram0711 sundram0711 marked this pull request as draft February 26, 2026 19:05
@sundram0711 sundram0711 force-pushed the easymesh-client_assoc_ctrl_req branch from b31e3de to 1c5dab9 Compare February 26, 2026 19:06
@github-actions github-actions bot added the community contribution Contributions from community. label Mar 13, 2026
@sundram0711 sundram0711 force-pushed the easymesh-client_assoc_ctrl_req branch 4 times, most recently from 8ab3213 to b07a543 Compare March 18, 2026 10:22
@sundram0711 sundram0711 marked this pull request as ready for review March 18, 2026 10:24
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

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,
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
{ 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,

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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?

@sundram0711 sundram0711 force-pushed the easymesh-client_assoc_ctrl_req branch 12 times, most recently from f70d64d to d2ca27c Compare April 2, 2026 13:33
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>
@amarnathhullur amarnathhullur force-pushed the easymesh-client_assoc_ctrl_req branch from d2ca27c to b339695 Compare April 2, 2026 18:34
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 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__);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The debug log has a spelling issue: "Recevied" → "Received".

Suggested change
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__);

Copilot uses AI. Check for mistakes.

(void)userData;
client_assoc_ctrl_req_t *assoc_ctrl_req;
unsigned int i;
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
unsigned int i;

Copilot uses AI. Check for mistakes.

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);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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;
}

Copilot uses AI. Check for mistakes.
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);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
__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;

Copilot uses AI. Check for mistakes.
success = (wifi_hal_delApAclDevice(vap_index, sta_mac_str) == RETURN_OK);
#else
success = (wifi_delApAclDevice(vap_index, sta_mac_str) == RETURN_OK);
#endif
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
#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;
}

Copilot uses AI. Check for mistakes.
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.

3 participants