-
Notifications
You must be signed in to change notification settings - Fork 138
RDKCOM-5492: RDKBDEV-3336 De-authenticating Hotspot Clients Upon DHCP Failure #818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
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.
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
| 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.
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>"
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed Review comment
mateuszCieslak-GL
left a comment
There was a problem hiding this 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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}; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| mac[mac_len] = '\0'; | |
| mac[sizeof(mac)] = '\0'; |
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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); |
There was a problem hiding this comment.
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
mateuszCieslak-GL
left a comment
There was a problem hiding this 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.
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