From d0f61a4beafd7b33ae93eeb70c33a7c330924faf Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 19 Nov 2013 12:26:16 +0200 Subject: [PATCH] P2P: Fix p2p_ignore_shared_freq=1 when inviting a peer 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 when inviting a peer to re-invoke a persistent group. This case needs special handling since the peer's channel list is not available to perform channel reselection and the operating channel indicated in the Invitation Request frames ends up getting used as the operating channel if the transmitted of that frames becomes the GO. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 04101a597..20eee0ab4 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -5285,6 +5285,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, u8 *bssid = NULL; int force_freq = 0; int res; + int no_pref_freq_given = pref_freq == 0; wpa_s->global->p2p_invite_group = NULL; if (peer_addr) @@ -5331,6 +5332,15 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) return -1; + if (wpa_s->parent->conf->p2p_ignore_shared_freq && + no_pref_freq_given && pref_freq > 0 && + wpa_s->num_multichan_concurrent > 1 && + wpas_p2p_num_unused_channels(wpa_s) > 0) { + wpa_printf(MSG_DEBUG, "P2P: Ignore own channel preference %d MHz for invitation due to p2p_ignore_shared_freq=1 configuration", + pref_freq); + pref_freq = 0; + } + return p2p_invite(wpa_s->global->p2p, peer_addr, role, bssid, ssid->ssid, ssid->ssid_len, force_freq, go_dev_addr, 1, pref_freq);