P2P: wpas_p2p_select_go_freq() to check for supported pref_freq

This commit is similar to the commit
783c2920cc ('P2P: Check if the pref_freq
reported by the driver supports P2P') but extends the check for
supported pref_freq to wpas_p2p_select_go_freq().

This avoids issues with P2P_GROUP_ADD ending up selecting an unexpected
channel when get_pref_freq_list() (i.e.,
QCA_NL80211_VENDOR_SUBCMD_GET_PREFERRED_FREQ_LIST) is used. Filter the
list by removing channels that do not allow P2P operation at all.
Previously, only the explicitly disallowed channels were removed and
that could have resulted in selecting an operating channel that is not
allowed for P2P and failing to complete the operation to start the
group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Sunil Dutt 2017-05-24 21:10:53 +05:30 committed by Jouni Malinen
parent c01de21932
commit 3c2bd55f03

View file

@ -5616,8 +5616,10 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
if (!res && size > 0) { if (!res && size > 0) {
i = 0; i = 0;
while (i < size && while (i < size &&
wpas_p2p_disallowed_freq(wpa_s->global, (!p2p_supported_freq(wpa_s->global->p2p,
pref_freq_list[i])) { pref_freq_list[i]) ||
wpas_p2p_disallowed_freq(wpa_s->global,
pref_freq_list[i]))) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"P2P: preferred_freq_list[%d]=%d is disallowed", "P2P: preferred_freq_list[%d]=%d is disallowed",
i, pref_freq_list[i]); i, pref_freq_list[i]);