P2P: Stop connection attempt on PBC session overlap

The overlap condition cannot disappear before group formation timeout
hits, so there is no point in continuing in this case and failure can
be indicated immediately.
This commit is contained in:
Jouni Malinen 2010-09-07 13:42:55 +03:00 committed by Jouni Malinen
parent 3094d4837a
commit b73bf0a74b
3 changed files with 18 additions and 0 deletions

View file

@ -623,6 +623,10 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
if (wpas_wps_scan_pbc_overlap(wpa_s, selected, ssid)) {
wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
"PBC session overlap");
#ifdef CONFIG_P2P
if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1)
return;
#endif /* CONFIG_P2P */
wpa_supplicant_req_new_scan(wpa_s, 10, 0);
return;
}

View file

@ -3535,3 +3535,16 @@ static void wpas_p2p_cross_connect_setup(struct wpa_supplicant *wpa_s)
break;
}
}
int wpas_p2p_notif_pbc_overlap(struct wpa_supplicant *wpa_s)
{
if (wpa_s->p2p_group_interface != P2P_GROUP_INTERFACE_CLIENT &&
!wpa_s->p2p_in_provisioning)
return 0; /* not P2P client operation */
wpa_printf(MSG_DEBUG, "P2P: Terminate connection due to WPS PBC "
"session overlap");
wpas_group_formation_completed(wpa_s, 0);
return 1;
}

View file

@ -112,5 +112,6 @@ int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start,
int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled);
void wpas_p2p_notif_connected(struct wpa_supplicant *wpa_s);
void wpas_p2p_notif_disconnected(struct wpa_supplicant *wpa_s);
int wpas_p2p_notif_pbc_overlap(struct wpa_supplicant *wpa_s);
#endif /* P2P_SUPPLICANT_H */