P2P: Abort join-group operation if concurrent group cannot be supported

If the driver does not indicate support for multi-channel concurrency,
abort join-group operation if the end result would result in use of
multiple operating frequencies with the same radio.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-04-08 20:12:05 +03:00
parent 7fa56233ae
commit 4b15620609

View file

@ -2605,6 +2605,44 @@ static void wpas_p2p_pd_before_join_timeout(void *eloop_ctx, void *timeout_ctx)
} }
static int wpas_check_freq_conflict(struct wpa_supplicant *wpa_s, int freq)
{
struct wpa_supplicant *iface;
int shared_freq;
u8 bssid[ETH_ALEN];
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT)
return 0;
for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
if (!wpas_p2p_create_iface(wpa_s) && iface == wpa_s)
continue;
if (iface->current_ssid == NULL || iface->assoc_freq == 0)
continue;
if (wpa_drv_get_bssid(iface, bssid) == 0) {
if (freq != (int) wpa_s->assoc_freq) {
wpa_printf(MSG_DEBUG, "P2P: Frequency "
"conflict - %s connected on %d MHz "
"- new connection on %d MHz",
wpa_s->ifname, wpa_s->assoc_freq,
freq);
return 1;
}
}
}
shared_freq = wpa_drv_shared_freq(wpa_s);
if (shared_freq > 0 && shared_freq != freq) {
wpa_printf(MSG_DEBUG, "P2P: Frequency conflict - shared "
"virtual interface connected on %d MHz - new "
"connection on %d MHz", shared_freq, freq);
return 1;
}
return 0;
}
static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s, static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res) struct wpa_scan_results *scan_res)
{ {
@ -2655,6 +2693,13 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
if (freq > 0) { if (freq > 0) {
u16 method; u16 method;
if (wpas_check_freq_conflict(wpa_s, freq) > 0) {
wpa_msg(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE
"reason=FREQ_CONFLICT");
return;
}
wpa_printf(MSG_DEBUG, "P2P: Send Provision Discovery Request " wpa_printf(MSG_DEBUG, "P2P: Send Provision Discovery Request "
"prior to joining an existing group (GO " MACSTR "prior to joining an existing group (GO " MACSTR
" freq=%u MHz)", " freq=%u MHz)",