P2P: Search all 2.4 GHz social channels regardless of disallow_freq

Commit 1595eb93ae ('P2P: Add support for
60 GHz social channel') had an unintended change to how P2P search scans
2.4 GHz social channels. Use of p2p_supported_freq() to filter the list
of social channels ended up using the disallow_freq setting to remove
social channels from the P2P search scans. This is not desired since
peers need to be found on any of the social channels even if those
channels have been disabled from P2P operating channel use. Restore the
previous behavior by included all the 2.4 GHz social channels in P2P
search scans if the driver indicated support for the 2.4 GHz band.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-10-22 20:02:48 +03:00 committed by Jouni Malinen
parent a6b1215769
commit 7475d299ab
2 changed files with 25 additions and 4 deletions

View file

@ -279,6 +279,22 @@ static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
} }
static int wpas_p2p_search_social_channel(struct wpa_supplicant *wpa_s,
int freq)
{
if (wpa_s->global->p2p_24ghz_social_channels &&
(freq == 2412 || freq == 2437 || freq == 2462)) {
/*
* Search all social channels regardless of whether these have
* been disabled for P2P operating channel use to avoid missing
* peers.
*/
return 1;
}
return p2p_supported_freq(wpa_s->global->p2p, freq);
}
static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
unsigned int num_req_dev_types, unsigned int num_req_dev_types,
const u8 *req_dev_types, const u8 *dev_id, u16 pw_id) const u8 *req_dev_types, const u8 *dev_id, u16 pw_id)
@ -348,8 +364,8 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
if (params->freqs == NULL) if (params->freqs == NULL)
goto fail; goto fail;
for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) { for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) {
if (p2p_supported_freq(wpa_s->global->p2p, if (wpas_p2p_search_social_channel(
social_channels_freq[i])) wpa_s, social_channels_freq[i]))
params->freqs[num_channels++] = params->freqs[num_channels++] =
social_channels_freq[i]; social_channels_freq[i];
} }
@ -363,8 +379,8 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
if (params->freqs == NULL) if (params->freqs == NULL)
goto fail; goto fail;
for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) { for (i = 0; i < ARRAY_SIZE(social_channels_freq); i++) {
if (p2p_supported_freq(wpa_s->global->p2p, if (wpas_p2p_search_social_channel(
social_channels_freq[i])) wpa_s, social_channels_freq[i]))
params->freqs[num_channels++] = params->freqs[num_channels++] =
social_channels_freq[i]; social_channels_freq[i];
} }
@ -3416,6 +3432,8 @@ static int wpas_p2p_default_channels(struct wpa_supplicant *wpa_s,
{ {
int i, cla = 0; int i, cla = 0;
wpa_s->global->p2p_24ghz_social_channels = 1;
os_memset(cli_chan, 0, sizeof(*cli_chan)); os_memset(cli_chan, 0, sizeof(*cli_chan));
wpa_printf(MSG_DEBUG, "P2P: Enable operating classes for 2.4 GHz " wpa_printf(MSG_DEBUG, "P2P: Enable operating classes for 2.4 GHz "
@ -3669,6 +3687,8 @@ static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s,
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, o->mode); mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, o->mode);
if (mode == NULL) if (mode == NULL)
continue; continue;
if (mode->mode == HOSTAPD_MODE_IEEE80211G)
wpa_s->global->p2p_24ghz_social_channels = 1;
for (ch = o->min_chan; ch <= o->max_chan; ch += o->inc) { for (ch = o->min_chan; ch <= o->max_chan; ch += o->inc) {
enum chan_allowed res; enum chan_allowed res;
res = wpas_p2p_verify_channel(wpa_s, mode, ch, o->bw); res = wpas_p2p_verify_channel(wpa_s, mode, ch, o->bw);

View file

@ -273,6 +273,7 @@ struct wpa_global {
} conc_pref; } conc_pref;
unsigned int p2p_per_sta_psk:1; unsigned int p2p_per_sta_psk:1;
unsigned int p2p_fail_on_wps_complete:1; unsigned int p2p_fail_on_wps_complete:1;
unsigned int p2p_24ghz_social_channels:1;
#ifdef CONFIG_WIFI_DISPLAY #ifdef CONFIG_WIFI_DISPLAY
int wifi_display; int wifi_display;