mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
fix(wpa_supplicant):Fix for setting wps status fail when connection fails
This commit is contained in:
parent
2dc5e29012
commit
30effe7894
@ -725,6 +725,7 @@ typedef struct {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
WPS_FAIL_REASON_NORMAL = 0, /**< ESP32 WPS normal fail reason */
|
WPS_FAIL_REASON_NORMAL = 0, /**< ESP32 WPS normal fail reason */
|
||||||
WPS_FAIL_REASON_RECV_M2D, /**< ESP32 WPS receive M2D frame */
|
WPS_FAIL_REASON_RECV_M2D, /**< ESP32 WPS receive M2D frame */
|
||||||
|
WPS_FAIL_REASON_RECV_DEAUTH, /**< Recv deauth from AP while wps handshake */
|
||||||
WPS_FAIL_REASON_MAX
|
WPS_FAIL_REASON_MAX
|
||||||
} wifi_event_sta_wps_fail_reason_t;
|
} wifi_event_sta_wps_fail_reason_t;
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 8e77aab969608a0b128631b2731765ddd2d2ac7f
|
Subproject commit 72dc39569c1bca16e528af0570b9e24ca2734546
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -33,6 +33,7 @@
|
|||||||
#include "esp_owe_i.h"
|
#include "esp_owe_i.h"
|
||||||
|
|
||||||
#include "esp_wps.h"
|
#include "esp_wps.h"
|
||||||
|
#include "esp_wps_i.h"
|
||||||
#include "eap_server/eap.h"
|
#include "eap_server/eap.h"
|
||||||
#include "eapol_auth/eapol_auth_sm.h"
|
#include "eapol_auth/eapol_auth_sm.h"
|
||||||
#include "ap/ieee802_1x.h"
|
#include "ap/ieee802_1x.h"
|
||||||
@ -263,6 +264,12 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wps_sm_funcs *wps_sm_cb = wps_get_wps_sm_cb();
|
||||||
|
if (wps_sm_cb && wps_sm_cb->wps_sm_notify_deauth) {
|
||||||
|
wps_sm_cb->wps_sm_notify_deauth();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OWE_STA
|
#ifdef CONFIG_OWE_STA
|
||||||
owe_deinit();
|
owe_deinit();
|
||||||
#endif /* CONFIG_OWE_STA */
|
#endif /* CONFIG_OWE_STA */
|
||||||
|
@ -57,6 +57,7 @@ struct wps_rx_param {
|
|||||||
};
|
};
|
||||||
static STAILQ_HEAD(,wps_rx_param) s_wps_rxq;
|
static STAILQ_HEAD(,wps_rx_param) s_wps_rxq;
|
||||||
|
|
||||||
|
struct wps_sm_funcs *s_wps_sm_cb = NULL;
|
||||||
static void *s_wps_task_hdl = NULL;
|
static void *s_wps_task_hdl = NULL;
|
||||||
static void *s_wps_queue = NULL;
|
static void *s_wps_queue = NULL;
|
||||||
static void *s_wps_data_lock = NULL;
|
static void *s_wps_data_lock = NULL;
|
||||||
@ -856,6 +857,13 @@ int wps_finish(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wps_sm_notify_deauth(void)
|
||||||
|
{
|
||||||
|
if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED) {
|
||||||
|
wps_stop_process(WPS_FAIL_REASON_RECV_DEAUTH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add current ap to discard ap list */
|
/* Add current ap to discard ap list */
|
||||||
void wps_add_discard_ap(u8 *bssid)
|
void wps_add_discard_ap(u8 *bssid)
|
||||||
{
|
{
|
||||||
@ -1415,6 +1423,11 @@ int wps_init_cfg_pin(struct wps_config *cfg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wps_sm_funcs* wps_get_wps_sm_cb(void)
|
||||||
|
{
|
||||||
|
return s_wps_sm_cb;
|
||||||
|
}
|
||||||
|
|
||||||
static int wifi_station_wps_init(const esp_wps_config_t *config)
|
static int wifi_station_wps_init(const esp_wps_config_t *config)
|
||||||
{
|
{
|
||||||
struct wps_funcs *wps_cb;
|
struct wps_funcs *wps_cb;
|
||||||
@ -1496,6 +1509,12 @@ static int wifi_station_wps_init(const esp_wps_config_t *config)
|
|||||||
wps_cb->wps_start_pending = wps_start_pending;
|
wps_cb->wps_start_pending = wps_start_pending;
|
||||||
esp_wifi_set_wps_cb_internal(wps_cb);
|
esp_wifi_set_wps_cb_internal(wps_cb);
|
||||||
|
|
||||||
|
s_wps_sm_cb = os_malloc(sizeof(struct wps_sm_funcs));
|
||||||
|
if (s_wps_sm_cb == NULL) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
s_wps_sm_cb->wps_sm_notify_deauth = wps_sm_notify_deauth;
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
@ -1569,6 +1588,11 @@ wifi_station_wps_deinit(void)
|
|||||||
wps_deinit(sm->wps);
|
wps_deinit(sm->wps);
|
||||||
sm->wps = NULL;
|
sm->wps = NULL;
|
||||||
}
|
}
|
||||||
|
if (s_wps_sm_cb) {
|
||||||
|
os_free(s_wps_sm_cb);
|
||||||
|
s_wps_sm_cb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
os_free(gWpsSm);
|
os_free(gWpsSm);
|
||||||
gWpsSm = NULL;
|
gWpsSm = NULL;
|
||||||
|
|
||||||
|
@ -119,6 +119,11 @@ int wps_dev_deinit(struct wps_device_data *dev);
|
|||||||
int wps_dev_init(void);
|
int wps_dev_init(void);
|
||||||
int wps_set_factory_info(const esp_wps_config_t *config);
|
int wps_set_factory_info(const esp_wps_config_t *config);
|
||||||
|
|
||||||
|
struct wps_sm_funcs {
|
||||||
|
void (*wps_sm_notify_deauth)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wps_sm_funcs* wps_get_wps_sm_cb(void);
|
||||||
static inline int wps_get_type(void)
|
static inline int wps_get_type(void)
|
||||||
{
|
{
|
||||||
return esp_wifi_get_wps_type_internal();
|
return esp_wifi_get_wps_type_internal();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user