]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Start GO without extra scan step
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 21 Jun 2011 08:47:03 +0000 (11:47 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 21 Jun 2011 08:47:03 +0000 (11:47 +0300)
There are some corner cases, where the wpa_supplicant_req_scan() call
may end up scheduling a scan even if we are about to start a GO. Avoid
this by explicitly marking the GO network to be selected for the next
connection.

wpa_supplicant/p2p_supplicant.c
wpa_supplicant/scan.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index af1de8a52ea75b14fdd3a639f6978980da1c649b..345a7ff6cf151e1e051437b4fe08e7057e981e26 100644 (file)
@@ -926,7 +926,7 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
        wpa_s->ap_configured_cb = p2p_go_configured;
        wpa_s->ap_configured_cb_ctx = wpa_s;
        wpa_s->ap_configured_cb_data = wpa_s->go_params;
-       wpa_s->connect_without_scan = 1;
+       wpa_s->connect_without_scan = ssid;
        wpa_s->reassociate = 1;
        wpa_s->disconnected = 0;
        wpa_supplicant_req_scan(wpa_s, 0, 0);
index 4fb9befcc534e6cd2ad32b9da09fbb806fbdb3ec..7689ff6a33f011d91c2899573d8d393b04b908f9 100644 (file)
@@ -307,6 +307,20 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
            wpa_s->wpa_state == WPA_INACTIVE)
                wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
 
+       if (scan_req != 2 && wpa_s->connect_without_scan) {
+               for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
+                       if (ssid == wpa_s->connect_without_scan)
+                               break;
+               }
+               wpa_s->connect_without_scan = NULL;
+               if (ssid) {
+                       wpa_printf(MSG_DEBUG, "Start a pre-selected network "
+                                  "without scan step");
+                       wpa_supplicant_associate(wpa_s, NULL, ssid);
+                       return;
+               }
+       }
+
        /* Find the starting point from which to continue scanning */
        ssid = wpa_s->conf->ssid;
        if (wpa_s->prev_scan_ssid != WILDCARD_SSID_SCAN) {
@@ -319,9 +333,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
                }
        }
 
-       if (scan_req != 2 && (wpa_s->conf->ap_scan == 2 ||
-                             wpa_s->connect_without_scan)) {
-               wpa_s->connect_without_scan = 0;
+       if (scan_req != 2 && wpa_s->conf->ap_scan == 2) {
+               wpa_s->connect_without_scan = NULL;
                wpa_supplicant_assoc_try(wpa_s, ssid);
                return;
        } else if (wpa_s->conf->ap_scan == 2) {
index 0352c13e728830750847565f1cd343d383224d9e..f303b4079eff6b972bf993f01c6bd72ba7ddf991 100644 (file)
@@ -1634,6 +1634,7 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
                if (was_disabled != other_ssid->disabled)
                        wpas_notify_network_enabled_changed(wpa_s, other_ssid);
        }
+       wpa_s->connect_without_scan = NULL;
        wpa_s->disconnected = 0;
        wpa_s->reassociate = 1;
        wpa_supplicant_req_scan(wpa_s, 0, 0);
index 281c5f6717eacf7e688836df9b28638cf692f274..c4d70f3fc8ce15369f1e4cb2898ea7dde15ab2fe 100644 (file)
@@ -549,7 +549,7 @@ struct wpa_supplicant {
        const struct bgscan_ops *bgscan;
        void *bgscan_priv;
 
-       int connect_without_scan;
+       struct wpa_ssid *connect_without_scan;
 
        int after_wps;
        unsigned int wps_freq;