fix(wpa_supplicant): Add support to detect PBC overlap in wps registrar mode

This commit is contained in:
Sarvesh Bodakhe 2023-08-11 16:06:21 +05:30
parent 080087a9a0
commit 2c3394ff01
3 changed files with 24 additions and 0 deletions

View File

@ -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;
@ -279,6 +280,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);

View File

@ -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);

View File

@ -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)