diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c index ea562edcd5..552bd0e145 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c @@ -38,6 +38,7 @@ #include "ap/ieee802_1x.h" #include "ap/sta_info.h" #include "wps/wps_defs.h" +#include "wps/wps.h" const wifi_osi_funcs_t *wifi_funcs; struct wpa_funcs *wpa_cb; @@ -280,6 +281,13 @@ static int check_n_add_wps_sta(struct hostapd_data *hapd, struct sta_info *sta_i return 0; } + if (wps_type == WPS_TYPE_PBC) { + if (esp_wps_registrar_check_pbc_overlap(hapd->wps)) { + wpa_printf(MSG_DEBUG, "WPS: PBC session overlap detected"); + return -1; + } + } + sta_info->wps_ie = wps_ie; sta_info->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta_info); diff --git a/components/wpa_supplicant/src/wps/wps.h b/components/wpa_supplicant/src/wps/wps.h index 6ba008b4ea..2800566782 100644 --- a/components/wpa_supplicant/src/wps/wps.h +++ b/components/wpa_supplicant/src/wps/wps.h @@ -870,6 +870,9 @@ void wps_registrar_complete(struct wps_registrar *registrar, const u8 *uuid_e, void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr, const struct wpabuf *wps_data, int p2p_wildcard); +#ifdef ESP_SUPPLICANT +bool esp_wps_registrar_check_pbc_overlap(struct wps_context *wps); +#endif /* ESP_SUPPLICANT */ int wps_registrar_update_ie(struct wps_registrar *reg); int wps_registrar_get_info(struct wps_registrar *reg, const u8 *addr, char *buf, size_t buflen); diff --git a/components/wpa_supplicant/src/wps/wps_registrar.c b/components/wpa_supplicant/src/wps/wps_registrar.c index d5fa424b5c..a7edf79ff6 100644 --- a/components/wpa_supplicant/src/wps/wps_registrar.c +++ b/components/wpa_supplicant/src/wps/wps_registrar.c @@ -1228,6 +1228,19 @@ void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr, } } +#ifdef ESP_SUPPLICANT +bool esp_wps_registrar_check_pbc_overlap(struct wps_context *wps) +{ + + if (wps_registrar_pbc_overlap(wps->registrar, NULL, NULL)) { + wps->registrar->force_pbc_overlap = 1; + wps_pbc_overlap_event(wps); + return true; + } + + return false; +} +#endif /* ESP_SUPPLICANT */ int wps_cb_new_psk(struct wps_registrar *reg, const u8 *mac_addr, const u8 *p2p_dev_addr, const u8 *psk, size_t psk_len)