]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Do not inform other virtual interfaces of scan results in all cases
authorJouni Malinen <j@w1.fi>
Fri, 14 Sep 2012 01:07:02 +0000 (18:07 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 14 Sep 2012 01:07:02 +0000 (18:07 -0700)
If a connection operation is started on an interface based on scan
results, other virtual interfaces should not be information about the
results to avoid potential concurrent operations during the association
steps. Since the sibling notification of scan results received was added
as an optimization, skipping it for this type of cases is the simplest
way of avoiding unnecessary concurrent operations.

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

wpa_supplicant/events.c
wpa_supplicant/interworking.c

index 64a555452f39a215a440749342b1bd2ac2feee0d..17db4082d4bd11d633e5df81ccadd62e25ccb4cb 100644 (file)
@@ -1030,7 +1030,7 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
 }
 
 
-/* Return < 0 if no scan results could be fetched or if scan results should not
+/* Return != 0 if no scan results could be fetched or if scan results should not
  * be shared with other virtual interfaces. */
 static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
                                              union wpa_event_data *data)
@@ -1175,6 +1175,11 @@ int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s)
                        return -1;
                }
                wpa_supplicant_rsn_preauth_scan_results(wpa_s);
+               /*
+                * Do not notify other virtual radios of scan results since we do not
+                * want them to start other associations at the same time.
+                */
+               return 1;
        } else {
                wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found");
                ssid = wpa_supplicant_pick_new_network(wpa_s);
@@ -1211,7 +1216,7 @@ int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s)
                                wpa_s->network_select = 1;
                                wpa_s->auto_network_select = 1;
                                interworking_start_fetch_anqp(wpa_s);
-                               return 0;
+                               return 1;
                        }
 #endif /* CONFIG_INTERWORKING */
                        if (wpa_supplicant_req_sched_scan(wpa_s))
@@ -1229,11 +1234,13 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
        const char *rn, *rn2;
        struct wpa_supplicant *ifs;
 
-       if (_wpa_supplicant_event_scan_results(wpa_s, data) < 0) {
+       if (_wpa_supplicant_event_scan_results(wpa_s, data) != 0) {
                /*
                 * If no scan results could be fetched, then no need to
                 * notify those interfaces that did not actually request
-                * this scan.
+                * this scan. Similarly, if scan results started a new operation on this
+                * interface, do not notify other interfaces to avoid concurrent
+                * operations during a connection attempt.
                 */
                return;
        }
index b362bcba3a2187d9ad64f4eaaf6427a9a0feeee3..22f709f81f060af34e0e089151078fc9c2c12b8e 100644 (file)
@@ -59,7 +59,7 @@ static void interworking_reconnect(struct wpa_supplicant *wpa_s)
                if (now.sec - wpa_s->last_scan.sec <= 5) {
                        wpa_printf(MSG_DEBUG, "Interworking: Old scan results "
                                   "are fresh - connect without new scan");
-                       if (wpas_select_network_from_last_scan(wpa_s) == 0)
+                       if (wpas_select_network_from_last_scan(wpa_s) >= 0)
                                return;
                }
        }