RDKCOM-5492: RDKBDEV-3336 De-authenticating Hotspot Clients Upon DHCP Failure#818
RDKCOM-5492: RDKBDEV-3336 De-authenticating Hotspot Clients Upon DHCP Failure#818rhegde114 wants to merge 12 commits intordkcentral:developfrom
Conversation
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
|
Hi @rhegde114 |
|
@pradeeptakdas , I have re-synced the branch. |
source/core/wifi_ctrl.h
Outdated
| bool marker_list_config_subscribed; | ||
| bool wifi_sta_2g_status_subscribed; | ||
| bool wifi_sta_5g_status_subscribed; | ||
| bool privateHotspotIPSubscribed; |
There was a problem hiding this comment.
stick to the naming convention
| bool privateHotspotIPSubscribed; | |
| bool private_hotspot_ip_subscribed; |
| } | ||
| #endif | ||
|
|
||
| static void handlePrivateHotspotClientDisconnect(char *event_name, raw_data_t *p_data, void *userData) |
There was a problem hiding this comment.
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>"
There was a problem hiding this comment.
Added comments before the handler
| return; | ||
|
|
||
| } | ||
| memset(tmp_str, 0, sizeof(tmp_str)); |
There was a problem hiding this comment.
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.
| } | ||
| } | ||
| #endif | ||
| if(ctrl->privateHotspotIPSubscribed == false) { |
There was a problem hiding this comment.
| 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", |
There was a problem hiding this comment.
| 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 MAC (characters before '_') | ||
| size_t mac_len = tmp - pTmp; | ||
| strncpy(mac, pTmp, mac_len); | ||
| mac[mac_len] = '\0'; |
There was a problem hiding this comment.
| mac[mac_len] = '\0'; | |
| mac[sizeof(mac)] = '\0'; |
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
| 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); |
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
mateuszCieslak-GL
left a comment
There was a problem hiding this comment.
look ok to me.
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