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

wpa_supplicant/p2p_supplicant.c

index 77b296a6b1f230a879713c558fbf477c8337997f..04101a597486eb79bd0fdd89bbe62ae46095d9cb 100644 (file)
@@ -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 &&