Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/wifi_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extern "C" {
#define WIFI_COLLECT_STATS_ASSOC_DEVICE_STATS "Device.WiFi.CollectStats.AccessPoint.{i}.AssociatedDeviceStats"
#define WIFI_NOTIFY_DENY_TCM_ASSOCIATION "Device.WiFi.ConnectionControl.TcmClientDenyAssociation"
#define WIFI_CSA_BEACON_FRAME_RECEIVED "Device.WiFi.CSABeaconFrameRecieved"
#define WIFI_PRIVATE_HOTSPOT_CLIENT_IP "Device.X_COMCAST-COM_GRE.Hotspot.RejectAssociatedClient"
#define WIFI_STUCK_DETECT_FILE_NAME "/nvram/wifi_stuck_detect"

#ifdef CONFIG_IEEE80211BE
Expand Down
1 change: 1 addition & 0 deletions source/core/wifi_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ typedef struct wifi_ctrl {
bool marker_list_config_subscribed;
bool wifi_sta_2g_status_subscribed;
bool wifi_sta_5g_status_subscribed;
bool privateHotspotIPSubscribed;
Copy link
Contributor

Choose a reason for hiding this comment

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

stick to the naming convention

Suggested change
bool privateHotspotIPSubscribed;
bool private_hotspot_ip_subscribed;

bool eth_bh_status_subscribed;
bool mesh_keep_out_chans_subscribed;
wifiapi_t wifiapi;
Expand Down
48 changes: 48 additions & 0 deletions source/core/wifi_ctrl_rbus_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,43 @@ static void wifi_sta_5g_status_handler(char *event_name, raw_data_t *p_data, voi
}
#endif

static void handlePrivateHotspotClientDisconnect(char *event_name, raw_data_t *p_data, void *userData)
Copy link
Contributor

@mateuszCieslak-GL mateuszCieslak-GL Jan 29, 2026

Choose a reason for hiding this comment

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

Please add a comment here how does the proper command should look like, and what its supposed to do i.e.
"// Hotspot app will use this to kick stations which won't complete DHCP in time.
// expected command from hotspot app:
// Device.X_COMCAST-COM_GRE.Hotspot.RejectAssociatedClient <mac>_<vap_index>"

Copy link
Author

Choose a reason for hiding this comment

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

Added comments before the handler

{
(void)userData;
char *pTmp = NULL;
char mac[64] = {0};
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 64? Why not 18?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed comment

int index = 0;
char tmp_str[120];

wifi_util_dbg_print(WIFI_CTRL, "%s:%d Received event:%s with data type:%x\n", __func__, __LINE__,
event_name, p_data->data_type);

pTmp = (char *)p_data->raw_data.bytes;

if((strcmp(event_name, WIFI_PRIVATE_HOTSPOT_CLIENT_IP) != 0) || (pTmp == NULL)) {
wifi_util_info_print(WIFI_CTRL,"%s:%d Invalid event received,%s:%x\n", __func__, __LINE__, event_name, p_data->data_type);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
wifi_util_info_print(WIFI_CTRL,"%s:%d Invalid event received,%s:%x\n", __func__, __LINE__, event_name, p_data->data_type);
wifi_util_error_print(WIFI_CTRL,"%s:%d Invalid event received,%s:%x\n", __func__, __LINE__, event_name, p_data->data_type);

Copy link
Author

Choose a reason for hiding this comment

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

Fixed review comment

return;
}
// Find the position of the underscore
char *tmp = strchr(pTmp, '_');
if (tmp != NULL) {
// Copy MAC (characters before '_')
size_t mac_len = tmp - pTmp;
strncpy(mac, pTmp, mac_len);
mac[mac_len] = '\0';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
mac[mac_len] = '\0';
mac[sizeof(mac)] = '\0';

Copy link
Contributor

Choose a reason for hiding this comment

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

uchm this one would be dependent on chancing char mac[64] = {0}; to char mac[18], so might be safer to leave it as is - otherwise it will crash some strcpy down the line..

Copy link
Author

Choose a reason for hiding this comment

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

I am keeping the original changes as mac is declared as char Mac[18], so valid indices are 0 to 17. Writing to Mac[18] is undefined behavior (out of bounds).

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, you are correct. Just add -1, so that it would be sizeof(mac) - 1 and it should be fine.


// Convert index (characters after '_') to integer
index = atoi(tmp + 1);
} else {
wifi_util_error_print(WIFI_CTRL, "%s:%d Invalid format:\n", __func__, __LINE__);
return;

}
memset(tmp_str, 0, sizeof(tmp_str));
Copy link
Contributor

Choose a reason for hiding this comment

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

since youre already initializing other local variables to zero at the beginning of the function, it would make sense to do the same for tmp_str.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed Review comment

snprintf(tmp_str, sizeof(tmp_str), "%d-%s-0", (index-1),mac);
push_event_to_ctrl_queue(tmp_str, (strlen(tmp_str) + 1), wifi_event_type_command, wifi_event_type_command_kick_assoc_devices, NULL);
}

#if defined(RDKB_EXTENDER_ENABLED)
static void eth_bh_status_handler(char *event_name, raw_data_t *p_data, void *userData)
{
Expand Down Expand Up @@ -2062,6 +2099,17 @@ void bus_subscribe_events(wifi_ctrl_t *ctrl)
}
}
#endif
if(ctrl->privateHotspotIPSubscribed == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(ctrl->privateHotspotIPSubscribed == false) {
if(!ctrl->privateHotspotIPSubscribed) {

if (bus_desc->bus_event_subs_fn(&ctrl->handle, WIFI_PRIVATE_HOTSPOT_CLIENT_IP,handlePrivateHotspotClientDisconnect, NULL,
0) != bus_error_success) {
wifi_util_info_print(WIFI_CTRL, "%s:%d bus: bus event:%s subscribe fail\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
wifi_util_info_print(WIFI_CTRL, "%s:%d bus: bus event:%s subscribe fail\n",
wifi_util_error_print(WIFI_CTRL, "%s:%d bus: bus event:%s subscribe fail\n",

__FUNCTION__, __LINE__, WIFI_PRIVATE_HOTSPOT_CLIENT_IP);
} else {
ctrl->privateHotspotIPSubscribed = true;
wifi_util_info_print(WIFI_CTRL, "%s:%d bus: bus event:%s subscribe success\n",
__FUNCTION__, __LINE__, WIFI_PRIVATE_HOTSPOT_CLIENT_IP);
}
}
}

bus_error_t get_sta_connection_timeout(char *name, raw_data_t *p_data, bus_user_data_t *user_data)
Expand Down
Loading