Skip to content

RDKCOM-5492: RDKBDEV-3336 De-authenticating Hotspot Clients Upon DHCP Failure#818

Open
rhegde114 wants to merge 12 commits intordkcentral:developfrom
rhegde114:develop
Open

RDKCOM-5492: RDKBDEV-3336 De-authenticating Hotspot Clients Upon DHCP Failure#818
rhegde114 wants to merge 12 commits intordkcentral:developfrom
rhegde114:develop

Conversation

@rhegde114
Copy link

Develop an event subscription handler in OneWifi to process the event received from hotspot component upon DHCP failure and initiated de-authentication of associated client

rhegde114 and others added 5 commits December 4, 2025 13:40
             due to DHCP failure
Changes: 1. Added Rbus event handler to moniter event from hotspot
         component in case of DHCP failure
         2. push the event to queue to kick associated client when
         event is received
             due to DHCP failure
Changes: 1. Added Rbus event handler to moniter event from hotspot
         component in case of DHCP failure
         2. push the event to queue to kick associated client when
         event is received
@rhegde114 rhegde114 requested a review from a team as a code owner January 6, 2026 18:49
@pradeeptakdas pradeeptakdas changed the title RDKBDEV-3336:De-authenticating Hotspot Clients Upon DHCP Failure RDKCOM-5492: RDKBDEV-3336 De-authenticating Hotspot Clients Upon DHCP Failure Jan 7, 2026
@pradeeptakdas
Copy link
Contributor

Hi @rhegde114
Looks like the branch is out of date, Can you please rebase ?

@rhegde114
Copy link
Author

@pradeeptakdas , I have re-synced the branch.

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;

}
#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

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

Copy link
Contributor

@mateuszCieslak-GL mateuszCieslak-GL left a comment

Choose a reason for hiding this comment

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

please update

}
}
#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(ctrl->privateHotspotIPSubscribed == false) {
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",

{
(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

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

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

             due to DHCP failure
Changes: 1. Added Rbus event handler to moniter event from hotspot
         component in case of DHCP failure
         2. push the event to queue to kick associated client when
         event is received
             due to DHCP failure
Changes: 1. Added Rbus event handler to moniter event from hotspot
         component in case of DHCP failure
         2. push the event to queue to kick associated client when
         event is received
             due to DHCP failure
Changes: 1. Added Rbus event handler to moniter event from hotspot
         component in case of DHCP failure
         2. push the event to queue to kick associated client when
         event is received
Copy link
Contributor

@mateuszCieslak-GL mateuszCieslak-GL left a comment

Choose a reason for hiding this comment

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

look ok to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants