From: Jouni Malinen Date: Fri, 20 Jan 2023 17:08:07 +0000 (+0200) Subject: WPS: Do not indicate incorrect PBC overlap based on partner link X-Git-Tag: hostap_2_11~1339 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=831be651494e45e49e04139b744deeaf5285003a;p=thirdparty%2Fhostap.git WPS: Do not indicate incorrect PBC overlap based on partner link The check for PBC overlap on a partner link should not be done unless the current interface is actually in active PBC mode. Furthermore, the wpa_s->wps_overlap variable needs to be cleared in additional places to avoid leaving it set indefinitely. This was found with the following test case sequence: dbus_wps_pbc_overlap dbus_p2p_two_groups Fixes: b43e19f3f369 ("WPS: Cross band overlap detection with multiple interfaces") Signed-off-by: Jouni Malinen --- diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 64b2bcd1d..6f0ffa5b0 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1821,7 +1821,8 @@ int wpa_supplicant_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *selected, struct wpa_ssid *ssid) { - if (wpas_wps_partner_link_overlap_detect(wpa_s) || + if ((eap_is_wps_pbc_enrollee(&ssid->eap) && + wpas_wps_partner_link_overlap_detect(wpa_s)) || wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) { wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP "PBC session overlap"); diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index fdc1ec72f..220a5f8b5 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -1014,6 +1014,7 @@ static void wpas_wps_timeout(void *eloop_ctx, void *timeout_ctx) */ wpas_notify_wps_event_fail(wpa_s, &data.fail); wpa_s->supp_pbc_active = false; + wpa_s->wps_overlap = false; wpas_clear_wps(wpa_s); } @@ -1386,6 +1387,7 @@ int wpas_wps_cancel(struct wpa_supplicant *wpa_s) } wpa_s->supp_pbc_active = false; + wpa_s->wps_overlap = false; wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_CANCEL); wpa_s->after_wps = 0;