P2P: Do not request station mode scans during P2P operations

The P2P search mechanism depends on the same scan functionality that
is used for station mode scans. If these operations are being used
at the same time, scan result processing is not handled properly.
Avoid unexpected behavior by delaying station mode scan requests
if a P2P operation is in progress.

Among other things, this allows the station mode connection attempt
to be continued after a P2P find or group formation has been completed
if the interface is available (i.e., when the P2P group uses a
separate virtual interface).
This commit is contained in:
Jouni Malinen 2011-09-29 16:53:55 +03:00 committed by Jouni Malinen
parent 0c96fd6d03
commit 303f60d39b
5 changed files with 39 additions and 0 deletions

View file

@ -3681,3 +3681,11 @@ p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next)
return &dev->info; return &dev->info;
} }
int p2p_in_progress(struct p2p_data *p2p)
{
if (p2p == NULL)
return 0;
return p2p->state != P2P_IDLE;
}

View file

@ -1509,4 +1509,11 @@ int p2p_add_wps_vendor_extension(struct p2p_data *p2p,
int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel, int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel,
int cfg_op_channel); int cfg_op_channel);
/**
* p2p_in_progress - Check whether a P2P operation is progress
* @p2p: P2P module context from p2p_init()
* Returns: 0 if P2P module is idle or 1 if an operation is in progress
*/
int p2p_in_progress(struct p2p_data *p2p);
#endif /* P2P_H */ #endif /* P2P_H */

View file

@ -4365,3 +4365,12 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s)
return 0; return 0;
} }
int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s)
{
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return 0;
return p2p_in_progress(wpa_s->global->p2p);
}

View file

@ -127,5 +127,6 @@ int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr);
int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s); int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s);
void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s, void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s,
struct wps_event_fail *fail); struct wps_event_fail *fail);
int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s);
#endif /* P2P_SUPPLICANT_H */ #endif /* P2P_SUPPLICANT_H */

View file

@ -284,6 +284,20 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
return; return;
} }
#ifdef CONFIG_P2P
if (wpas_p2p_in_progress(wpa_s)) {
if (wpa_s->wpa_state == WPA_SCANNING) {
wpa_dbg(wpa_s, MSG_DEBUG, "Delay station mode scan "
"while P2P operation is in progress");
wpa_supplicant_req_scan(wpa_s, 5, 0);
} else {
wpa_dbg(wpa_s, MSG_DEBUG, "Do not request scan while "
"P2P operation is in progress");
}
return;
}
#endif /* CONFIG_P2P */
if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) || if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) ||
wpa_s->conf->ap_scan == 2) wpa_s->conf->ap_scan == 2)
max_ssids = 1; max_ssids = 1;