From 9f2217c51388ce66149bfb8e3e32e836366b99a2 Mon Sep 17 00:00:00 2001 From: Sreeramya Soratkal Date: Tue, 3 Aug 2021 10:58:44 +0530 Subject: [PATCH] P2P: Consider p2p_no_go_freq for GO preferred frequency Currently while selecting a preferred frequency when no preference is known, p2p_no_go_freq is not considered for 5 GHz and 60 GHz channels. This results in starting GO on the channels that are configured not to allow the local device as GO. Use wpas_p2p_supported_freq_go api to check if the p2p_no_go_freq configuration before selecting the preferred frequency for GO. Signed-off-by: Sreeramya Soratkal --- wpa_supplicant/p2p_supplicant.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 1e70ad6d1..07e1101fc 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -6268,34 +6268,26 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s, /* try all channels in operating class 115 */ for (i = 0; i < 4; i++) { params->freq = 5180 + i * 20; - if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) && - freq_included(wpa_s, channels, params->freq) && - p2p_supported_freq(wpa_s->global->p2p, params->freq)) + if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq)) goto out; } /* try all channels in operating class 124 */ for (i = 0; i < 4; i++) { params->freq = 5745 + i * 20; - if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) && - freq_included(wpa_s, channels, params->freq) && - p2p_supported_freq(wpa_s->global->p2p, params->freq)) + if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq)) goto out; } /* try social channel class 180 channel 2 */ params->freq = 58320 + 1 * 2160; - if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) && - freq_included(wpa_s, channels, params->freq) && - p2p_supported_freq(wpa_s->global->p2p, params->freq)) + if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq)) goto out; /* try all channels in reg. class 180 */ for (i = 0; i < 4; i++) { params->freq = 58320 + i * 2160; - if (!wpas_p2p_disallowed_freq(wpa_s->global, params->freq) && - freq_included(wpa_s, channels, params->freq) && - p2p_supported_freq(wpa_s->global->p2p, params->freq)) + if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq)) goto out; }