]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix persistent P2P connection failure in case channel list changes
authorMahesh A Saptasagar <c_msapta@qti.qualcomm.com>
Mon, 27 Jan 2014 14:46:02 +0000 (20:16 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 7 Feb 2014 13:44:41 +0000 (15:44 +0200)
P2P persistent connection may fail due to 802.11d channel change event
invalidating support of the operating frequency sent in the invitation
request, before receiving the invitation response. If the operating
frequency is invalid at the time the invitation response is processed
and there is no forced frequency provided by user, allow frequency
re-selection.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/ctrl_iface.c
wpa_supplicant/dbus/dbus_new_handlers_p2p.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h

index c0ad1c1f2589b8603256cf3935b4292c8a5b0638..ddddad378e4bb8c0ba25a365f56920768e9e50b2 100644 (file)
@@ -4391,7 +4391,7 @@ static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s,
                return -1;
        }
 
-       return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, ht40, vht,
+       return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, ht40, vht,
                                             NULL, 0);
 }
 
index 5150a76bdade45a7af89fcdde881b1fed249525a..2b83637e61250b677f1ae4ac4d3c1041f2091814 100644 (file)
@@ -346,7 +346,7 @@ DBusMessage * wpas_dbus_handler_p2p_group_add(DBusMessage *message,
                if (ssid == NULL || ssid->disabled != 2)
                        goto inv_args;
 
-               if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, 0,
+               if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, 0, 0,
                                                  NULL, 0)) {
                        reply = wpas_dbus_error_unknown_error(
                                message,
index 2928b6fe04aac23bdaaa1239f319d47f7b4ca8dd..113ef834791e7d354dab33f806c8e53c40526022 100644 (file)
@@ -3055,7 +3055,7 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
                if (s) {
                        int go = s->mode == WPAS_MODE_P2P_GO;
                        wpas_p2p_group_add_persistent(
-                               wpa_s, s, go, go ? op_freq : 0, 0, 0, NULL,
+                               wpa_s, s, go, 0, go ? op_freq : 0, 0, 0, NULL,
                                go ? P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : 0);
                } else if (bssid) {
                        wpa_s->user_initiated_pd = 0;
@@ -3168,7 +3168,6 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
 {
        struct wpa_supplicant *wpa_s = ctx;
        struct wpa_ssid *ssid;
-       int freq;
 
        if (bssid) {
                wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
@@ -3224,17 +3223,10 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
                "starting persistent group");
        os_sleep(0, 50000);
 
-       freq = wpa_s->p2p_persistent_go_freq;
-       if (neg_freq > 0 && ssid->mode == WPAS_MODE_P2P_GO &&
-           freq_included(channels, neg_freq)) {
-               wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use frequence %d MHz from invitation for GO mode",
-                       neg_freq);
-               freq = neg_freq;
-       }
-
        wpas_p2p_group_add_persistent(wpa_s, ssid,
                                      ssid->mode == WPAS_MODE_P2P_GO,
-                                     freq,
+                                     wpa_s->p2p_persistent_go_freq,
+                                     neg_freq,
                                      wpa_s->p2p_go_ht40, wpa_s->p2p_go_vht,
                                      channels,
                                      ssid->mode == WPAS_MODE_P2P_GO ?
@@ -5174,12 +5166,12 @@ static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s,
 
 int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
                                  struct wpa_ssid *ssid, int addr_allocated,
-                                 int freq, int ht40, int vht,
-                                 const struct p2p_channels *channels,
+                                 int force_freq, int neg_freq, int ht40,
+                                 int vht, const struct p2p_channels *channels,
                                  int connection_timeout)
 {
        struct p2p_go_neg_results params;
-       int go = 0;
+       int go = 0, freq;
 
        if (ssid->disabled != 2 || ssid->ssid == NULL)
                return -1;
@@ -5205,9 +5197,15 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
        if (ssid->mode != WPAS_MODE_P2P_GO)
                return -1;
 
-       freq = wpas_p2p_select_go_freq(wpa_s, freq);
-       if (freq < 0)
-               return -1;
+       if (force_freq > 0) {
+               freq = wpas_p2p_select_go_freq(wpa_s, force_freq);
+               if (freq < 0)
+                       return -1;
+       } else {
+               freq = wpas_p2p_select_go_freq(wpa_s, neg_freq);
+               if (freq < 0 || (freq > 0 && !freq_included(channels, freq)))
+                       freq = 0;
+       }
 
        if (wpas_p2p_init_go_params(wpa_s, &params, freq, ht40, vht, channels))
                return -1;
index 685313c6f181b891ddfba896199e6c34f0247140..d3d36b1d238169251ce956351c5aa0e9077eddfb 100644 (file)
@@ -36,8 +36,8 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
                       int freq, int ht40, int vht);
 int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
                                  struct wpa_ssid *ssid, int addr_allocated,
-                                 int freq, int ht40, int vht,
-                                 const struct p2p_channels *channels,
+                                 int force_freq, int neg_freq, int ht40,
+                                 int vht, const struct p2p_channels *channels,
                                  int connection_timeout);
 struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
                                       struct wpa_ssid *ssid);