]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix Operating Channel in Invitation Request for operating group
authorJouni Malinen <j@w1.fi>
Sun, 20 Oct 2013 15:33:17 +0000 (18:33 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 20 Oct 2013 18:38:02 +0000 (21:38 +0300)
When a GO or P2P Client invites a peer device to join an already
operating group, the Operating Channel in Invitation Request needs to be
forced to the current operating channel of the group.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/p2p_supplicant.c

index 3b544db2e7372cac0b887281bb7fa33894f8e575..95ebdfd6f53004ba18dae99a64431dc97c675558 100644 (file)
@@ -5203,7 +5203,7 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname,
        u8 *bssid = NULL;
        struct wpa_ssid *ssid;
        int persistent;
-       int force_freq = 0, pref_freq = 0;
+       int freq = 0, force_freq = 0, pref_freq = 0;
        int res;
 
        wpa_s->p2p_persistent_go_freq = 0;
@@ -5235,6 +5235,7 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname,
                bssid = wpa_s->own_addr;
                if (go_dev_addr == NULL)
                        go_dev_addr = wpa_s->global->p2p_dev_addr;
+               freq = ssid->frequency;
        } else {
                role = P2P_INVITE_ROLE_CLIENT;
                if (wpa_s->wpa_state < WPA_ASSOCIATED) {
@@ -5246,6 +5247,8 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname,
                if (go_dev_addr == NULL &&
                    !is_zero_ether_addr(wpa_s->go_dev_addr))
                        go_dev_addr = wpa_s->go_dev_addr;
+               freq = wpa_s->current_bss ? wpa_s->current_bss->freq :
+                       (int) wpa_s->assoc_freq;
        }
        wpa_s->parent->pending_invite_ssid_id = -1;
 
@@ -5257,7 +5260,7 @@ int wpas_p2p_invite_group(struct wpa_supplicant *wpa_s, const char *ifname,
        if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
                return -1;
 
-       res = wpas_p2p_setup_freqs(wpa_s, 0, &force_freq, &pref_freq);
+       res = wpas_p2p_setup_freqs(wpa_s, freq, &force_freq, &pref_freq);
        if (res)
                return res;
        wpas_p2p_set_own_freq_preference(wpa_s, force_freq);