]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix p2p_ignore_shared_freq=1 when inviting a peer
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 19 Nov 2013 10:26:16 +0000 (12:26 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 19 Nov 2013 10:26:16 +0000 (12:26 +0200)
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 <jouni@qca.qualcomm.com>

wpa_supplicant/p2p_supplicant.c

index 04101a597486eb79bd0fdd89bbe62ae46095d9cb..20eee0ab4c06d6ef8070a0cfd685231ec4eccf4e 100644 (file)
@@ -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);