fix(wpa_supplicant): Ensure pbc_overlap event is posted correctly

Preserves the pbc_overlap flag to allow proper event posting.
This ensures that pbc overlap detection functions as expected.
This commit is contained in:
akshat
2025-04-02 15:03:42 +05:30
committed by BOT
parent 7aabeaeab9
commit c99c80c1d0
2 changed files with 12 additions and 6 deletions

View File

@ -352,12 +352,12 @@ is_wps_pbc_overlap(struct wps_sm *sm, const u8 *sel_uuid)
return false; return false;
} }
if (os_memcmp(sel_uuid, sm->uuid, WPS_UUID_LEN) != 0) { if (os_memcmp(sel_uuid, sm->uuid_r, WPS_UUID_LEN) != 0) {
wpa_printf(MSG_DEBUG, "uuid is not same"); wpa_printf(MSG_DEBUG, "uuid is not same");
wpa_hexdump(MSG_DEBUG, "WPS: UUID of scanned BSS is", wpa_hexdump(MSG_DEBUG, "WPS: UUID of scanned BSS is",
sel_uuid, WPS_UUID_LEN); sel_uuid, WPS_UUID_LEN);
wpa_hexdump(MSG_DEBUG, "WPS: UUID of sm BSS is", wpa_hexdump(MSG_DEBUG, "WPS: UUID of sm BSS is",
sm->uuid, WPS_UUID_LEN); sm->uuid_r, WPS_UUID_LEN);
return true; return true;
} }
@ -369,7 +369,10 @@ wps_parse_scan_result(struct wps_scan_ie *scan)
{ {
struct wps_sm *sm = gWpsSm; struct wps_sm *sm = gWpsSm;
wifi_mode_t op_mode = 0; wifi_mode_t op_mode = 0;
sm->wps_pbc_overlap = false;
if(sm->wps_pbc_overlap) {
return false;
}
if (!sm->is_wps_scan || !scan->bssid) { if (!sm->is_wps_scan || !scan->bssid) {
return false; return false;
@ -443,11 +446,11 @@ wps_parse_scan_result(struct wps_scan_ie *scan)
scan_uuid = wps_get_uuid_e(buf); scan_uuid = wps_get_uuid_e(buf);
if (scan_uuid) { if (scan_uuid) {
if (wps_get_type() == WPS_TYPE_PBC && is_wps_pbc_overlap(sm, scan_uuid) == true) { if (sm->discover_ssid_cnt > 1 && wps_get_type() == WPS_TYPE_PBC && is_wps_pbc_overlap(sm, scan_uuid) == true) {
wpa_printf(MSG_INFO, "pbc_overlap flag is true"); wpa_printf(MSG_INFO, "pbc_overlap flag is true");
sm->wps_pbc_overlap = true; sm->wps_pbc_overlap = true;
} }
os_memcpy(sm->uuid, scan_uuid, WPS_UUID_LEN); os_memcpy(sm->uuid_r, scan_uuid, WPS_UUID_LEN);
} }
if (ap_supports_sae(scan)) { if (ap_supports_sae(scan)) {
@ -1738,6 +1741,8 @@ int wifi_station_wps_start(void)
default: default:
break; break;
} }
os_memset(sm->uuid_r, 0, sizeof(sm->uuid_r));
sm->wps_pbc_overlap = false;
sm->discard_ap_cnt = 0; sm->discard_ap_cnt = 0;
os_memset(&sm->dis_ap_list, 0, WPS_MAX_DIS_AP_NUM * sizeof(struct discard_ap_list_t)); os_memset(&sm->dis_ap_list, 0, WPS_MAX_DIS_AP_NUM * sizeof(struct discard_ap_list_t));
esp_wifi_set_wps_start_flag_internal(true); esp_wifi_set_wps_start_flag_internal(true);

View File

@ -71,7 +71,8 @@ struct wps_sm {
struct wps_credential creds[MAX_CRED_COUNT]; struct wps_credential creds[MAX_CRED_COUNT];
u8 ap_cred_cnt; u8 ap_cred_cnt;
struct wps_device_data *dev; struct wps_device_data *dev;
u8 uuid[16]; u8 uuid[WPS_UUID_LEN];
u8 uuid_r[WPS_UUID_LEN];
u8 current_identifier; u8 current_identifier;
bool is_wps_scan; bool is_wps_scan;
u8 channel; u8 channel;