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: b43e19f3f3 ("WPS: Cross band overlap detection with multiple interfaces")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2023-01-20 19:08:07 +02:00 committed by Jouni Malinen
parent 48cb42182f
commit 831be65149
2 changed files with 4 additions and 1 deletions

View file

@ -1821,7 +1821,8 @@ int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
struct wpa_bss *selected, struct wpa_bss *selected,
struct wpa_ssid *ssid) 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)) { wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
"PBC session overlap"); "PBC session overlap");

View file

@ -1014,6 +1014,7 @@ static void wpas_wps_timeout(void *eloop_ctx, void *timeout_ctx)
*/ */
wpas_notify_wps_event_fail(wpa_s, &data.fail); wpas_notify_wps_event_fail(wpa_s, &data.fail);
wpa_s->supp_pbc_active = false; wpa_s->supp_pbc_active = false;
wpa_s->wps_overlap = false;
wpas_clear_wps(wpa_s); 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->supp_pbc_active = false;
wpa_s->wps_overlap = false;
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_CANCEL); wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_CANCEL);
wpa_s->after_wps = 0; wpa_s->after_wps = 0;