mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/wpsreg_ap_assoc_respone' into 'master'
esp_wifi: Bugfix wpsreg AP not responding to assoc req See merge request espressif/esp-idf!23863
This commit is contained in:
commit
f6452f0819
@ -269,7 +269,7 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code)
|
|||||||
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
|
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
|
||||||
|
|
||||||
#ifdef CONFIG_WPS_REGISTRAR
|
#ifdef CONFIG_WPS_REGISTRAR
|
||||||
static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_info, u8 *ies, u8 ies_len, bool *pmf_enable)
|
static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_info, u8 *ies, u8 ies_len, bool *pmf_enable, int subtype)
|
||||||
{
|
{
|
||||||
struct wpabuf *wps_ie = ieee802_11_vendor_ie_concat(ies, ies_len, WPS_DEV_OUI_WFA);
|
struct wpabuf *wps_ie = ieee802_11_vendor_ie_concat(ies, ies_len, WPS_DEV_OUI_WFA);
|
||||||
int wps_type = esp_wifi_get_wps_type_internal();
|
int wps_type = esp_wifi_get_wps_type_internal();
|
||||||
@ -284,7 +284,10 @@ static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_i
|
|||||||
|
|
||||||
if (sta_info->eapol_sm) {
|
if (sta_info->eapol_sm) {
|
||||||
wpa_printf(MSG_DEBUG, "considering station " MACSTR " for WPS", MAC2STR(sta_info->addr));
|
wpa_printf(MSG_DEBUG, "considering station " MACSTR " for WPS", MAC2STR(sta_info->addr));
|
||||||
return 1;
|
if (esp_send_assoc_resp(hapd, sta_info, sta_info->addr, WLAN_STATUS_SUCCESS, true, subtype) != WLAN_STATUS_SUCCESS) {
|
||||||
|
wpa_printf(MSG_ERROR, "failed to send assoc response " MACSTR, MAC2STR(sta_info->addr));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -293,25 +296,30 @@ static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_i
|
|||||||
|
|
||||||
static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8 *rsnxe, u8 rsnxe_len, bool *pmf_enable, int subtype)
|
static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8 *rsnxe, u8 rsnxe_len, bool *pmf_enable, int subtype)
|
||||||
{
|
{
|
||||||
struct sta_info *sta_info;
|
struct sta_info *sta_info = NULL;
|
||||||
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
struct hostapd_data *hapd = hostapd_get_hapd_data();
|
||||||
|
|
||||||
if (!hapd) {
|
if (!hapd) {
|
||||||
return 0;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*sta && !esp_wifi_ap_is_sta_sae_reauth_node(bssid)) {
|
if (*sta && !esp_wifi_ap_is_sta_sae_reauth_node(bssid)) {
|
||||||
ap_free_sta(hapd, *sta);
|
ap_free_sta(hapd, *sta);
|
||||||
}
|
}
|
||||||
|
|
||||||
sta_info = ap_sta_add(hapd, bssid);
|
sta_info = ap_sta_add(hapd, bssid);
|
||||||
if (!sta_info) {
|
if (!sta_info) {
|
||||||
wpa_printf(MSG_ERROR, "failed to add station " MACSTR, MAC2STR(bssid));
|
wpa_printf(MSG_ERROR, "failed to add station " MACSTR, MAC2STR(bssid));
|
||||||
return 0;
|
goto fail;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_WPS_REGISTRAR
|
#ifdef CONFIG_WPS_REGISTRAR
|
||||||
if (check_n_add_wps_sta(hapd, sta_info, wpa_ie, wpa_ie_len, pmf_enable)) {
|
if (check_n_add_wps_sta(hapd, sta_info, wpa_ie, wpa_ie_len, pmf_enable, subtype) == 0) {
|
||||||
*sta = sta_info;
|
if (sta_info->eapol_sm) {
|
||||||
return true;
|
*sta = sta_info;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wpa_ap_join(sta_info, bssid, wpa_ie, wpa_ie_len, rsnxe, rsnxe_len, pmf_enable, subtype)) {
|
if (wpa_ap_join(sta_info, bssid, wpa_ie, wpa_ie_len, rsnxe, rsnxe_len, pmf_enable, subtype)) {
|
||||||
@ -319,6 +327,11 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (sta_info) {
|
||||||
|
ap_free_sta(hapd, sta_info);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user