Merge branch 'bugfix/wps_reg_state_handling_v5.0' into 'release/v5.0'

fix(wpa_supplicant): Handle case when WPS registrar misses WSC_DONE sent by station (Backport v5.0)

See merge request espressif/esp-idf!32079
This commit is contained in:
Jiang Jiang Jian
2024-07-15 10:37:59 +08:00
3 changed files with 8 additions and 29 deletions

View File

@ -221,7 +221,7 @@ int esp_wifi_ap_wps_enable(const esp_wps_config_t *config)
return ret;
}
static int wifi_ap_wps_disable_internal(void)
int wifi_ap_wps_disable_internal(void)
{
struct wps_sm *sm = gWpsSm;

View File

@ -2411,21 +2411,6 @@ bool wpa_ap_join(struct sta_info *sta, uint8_t *bssid, uint8_t *wpa_ie, uint8_t
return true;
}
#ifdef CONFIG_WPS_REGISTRAR
static void ap_free_sta_timeout(void *ctx, void *data)
{
struct hostapd_data *hapd = (struct hostapd_data *) ctx;
u8 *addr = (u8 *) data;
struct sta_info *sta = ap_get_sta(hapd, addr);
if (sta) {
ap_free_sta(hapd, sta);
}
os_free(addr);
}
#endif
bool wpa_ap_remove(void* sta_info)
{
struct hostapd_data *hapd = hostapd_get_hapd_data();
@ -2434,19 +2419,6 @@ bool wpa_ap_remove(void* sta_info)
return false;
}
#ifdef CONFIG_WPS_REGISTRAR
wpa_printf(MSG_DEBUG, "wps_status=%d", wps_get_status());
if (wps_get_status() == WPS_STATUS_PENDING) {
struct sta_info *sta = (struct sta_info *)sta_info;
u8 *addr = os_malloc(ETH_ALEN);
if (!addr) {
return false;
}
os_memcpy(addr, sta->addr, ETH_ALEN);
eloop_register_timeout(0, 10000, ap_free_sta_timeout, hapd, addr);
} else
#endif
ap_free_sta(hapd, sta_info);
return true;

View File

@ -103,6 +103,13 @@ static void eap_wsc_reset(struct eap_sm *sm, void *priv)
wpabuf_free(data->out_buf);
//wps_deinit(data->wps);
os_free(data);
#ifdef ESP_SUPPLICANT
/* TODO: When wps-registrar is shifted in a separate task other than wifi task,
* call esp_wifi_ap_wps_disable() here instead of wifi_ap_wps_disable_internal()
* */
extern int wifi_ap_wps_disable_internal(void);
wifi_ap_wps_disable_internal();
#endif
}