Page 1 of 1

Get reason of disconnection for WiFi AP mode

Posted: Mon Apr 03, 2023 8:40 am
by dgroch
Hello,

I would like to get reason of disconnection for wifi_event_ap_stadisconnected_t, similar as we have for wifi_event_sta_disconnected_t.
I need to detect attempting to connect to the access point with an incorrect password. There was some topic here and was pointed there is missing expose of SYSTEM_EVENT_AP_STADISCONNECTED.
Is any other valid way of detecting incorrect password entry for AP?

Re: Get reason of disconnection for WiFi AP mode

Posted: Thu Jun 15, 2023 12:35 pm
by sarvesh.bodakhe
Hello @dgroch,
I would like to get reason of disconnection for wifi_event_ap_stadisconnected_t, similar as we have for wifi_event_sta_disconnected_t.
Adding reason for disconnection in wifi_event_ap_stadisconnected_t is indeed an useful feature to have. We are working on this.

I need to detect attempting to connect to the access point with an incorrect password.
Regarding detection of failed connection attempts with wrong password,
We can not use WIFI_EVENT_AP_STADISCONNECTED to detect failed connection attempts because WIFI_EVENT_AP_STADISCONNECTED is only posted when a successfully connected device disconnects from softAP.

Is any other valid way of detecting incorrect password entry for AP?
Yes, It is possible. We can add different event to detect attempts with wrong password.
May I know how you are planning to use this event about wrong-password attempts.

Thanks

Re: Get reason of disconnection for WiFi AP mode

Posted: Wed Jul 31, 2024 8:57 am
by kenone
I hope you don't mind me bringing this post from the dead.

The OP for this topic is a colleague of mine and the client is again requesting the ability to detect when a user/station enters an incorrect password for the AP.

They want to be able to take the matter into their own hands (e.g. disable the WIFI etc). This is to allow them to satisfy a stringent cyber security related requirement for their future product.

Is there currently a way to do this? I can see a deauth/disassoc being sent...
esp32_wifi_incorrect_password_response.png
esp32_wifi_incorrect_password_response.png (42 KiB) Viewed 705 times
But is there a way to reliably detect that an incorrect password attempt has been made?

Re: Get reason of disconnection for WiFi AP mode

Posted: Wed Jul 31, 2024 2:53 pm
by esp32person
Hi,

if you look at wifi_prov_mgr example project, you have,

case WIFI_PROV_CRED_FAIL: {
wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_reason_t *)event_data;
ESP_LOGE(TAG, "Provisioning failed!\n\tReason : %s"
"\n\tPlease reset to factory and retry provisioning",

Looking into that might give you ideas.

Regards

Re: Get reason of disconnection for WiFi AP mode

Posted: Wed Jul 31, 2024 3:08 pm
by kenone
esp32person wrote:
Wed Jul 31, 2024 2:53 pm
Hi,

if you look at wifi_prov_mgr example project, you have,

case WIFI_PROV_CRED_FAIL: {
wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_reason_t *)event_data;
ESP_LOGE(TAG, "Provisioning failed!\n\tReason : %s"
"\n\tPlease reset to factory and retry provisioning",

Looking into that might give you ideas.

Regards
Thank you, but the device is already provisioned and advertising at this stage. We need to capture when a device is continually trying to connect using an incorrect password.

Re: Get reason of disconnection for WiFi AP mode

Posted: Wed Jul 31, 2024 5:44 pm
by sarvesh.bodakhe
Hi @kenone,
They want to be able to take the matter into their own hands (e.g. disable the WIFI etc). This is too allow them to satisfy a stringent cyber security related requirement for their future product.

Indeed an interesting approach.

We had created changes as per the requirements of OP. Was waiting for the update.

Can you please create a github request so that the exchange of logs and build can be easier. Also please mention the target branch and any additional requirements you have.