From 21e491f2f60643a423bf40438955b62806ec6467 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 19 Nov 2013 12:15:45 +0200 Subject: [PATCH] P2P: Fix p2p_ignore_shared_freq=1 during invitation processing p2p_ignore_shared_freq=1 was supposed to allow a MCC-capable device to ignore a preference for using the same channel on multiple interfaces. However, it was not used during processing of an Invitation Request. Fix that case to use channel preference instead of channel forcing if free channels are available. This allows p2p_ignore_shared_freq=1 case to ignore the preference. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 77b296a6b..04101a597 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -179,8 +179,11 @@ static void wpas_p2p_set_own_freq_preference(struct wpa_supplicant *wpa_s, return; if (freq > 0 && wpa_s->num_multichan_concurrent > 1 && wpas_p2p_num_unused_channels(wpa_s) > 0 && - wpa_s->parent->conf->p2p_ignore_shared_freq) + wpa_s->parent->conf->p2p_ignore_shared_freq) { + wpa_printf(MSG_DEBUG, "P2P: Ignore own channel preference %d MHz due to p2p_ignore_shared_freq=1 configuration", + freq); freq = 0; + } p2p_set_own_freq_preference(wpa_s->global->p2p, freq); } @@ -2688,9 +2691,14 @@ accept_inv: /* Get one of the frequencies currently in use */ if (wpas_p2p_valid_oper_freqs(wpa_s, &res, 1) > 0) { - wpa_printf(MSG_DEBUG, "P2P: Trying to force channel to match a channel already used by one of the interfaces"); - *force_freq = res; + wpa_printf(MSG_DEBUG, "P2P: Trying to prefer a channel already used by one of the interfaces"); wpas_p2p_set_own_freq_preference(wpa_s, res); + + if (wpa_s->num_multichan_concurrent < 2 || + wpas_p2p_num_unused_channels(wpa_s) < 1) { + wpa_printf(MSG_DEBUG, "P2P: No extra channels available - trying to force channel to match a channel already used by one of the interfaces"); + *force_freq = res; + } } if (*force_freq > 0 && wpa_s->num_multichan_concurrent > 1 &&