[RFC 1/3] supplicant: Allow concurrent association by sharing scan results.

greearb at candelatech.com greearb
Mon May 12 22:27:50 PDT 2014


From: Ben Greear <greearb at candelatech.com>

This allows one to share scan results and have multiple stations
associate at the same time.  May cause bugs in some drivers
so it remains disabled by default.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 wpa_supplicant/config.c |    3 +++
 wpa_supplicant/config.h |    8 ++++++++
 wpa_supplicant/events.c |    7 ++++++-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 154add9..015036c 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -3348,6 +3348,8 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
 	if (driver_param)
 		config->driver_param = os_strdup(driver_param);
 
+	config->concurrent_assoc_ok = DEFAULT_CONCURRENT_ASSOC_OK;
+
 	return config;
 }
 
@@ -3963,6 +3965,7 @@ static const struct global_parse_data global_fields[] = {
 	{ INT(tdls_external_control), 0},
 	{ STR(osu_dir), 0 },
 	{ STR(wowlan_triggers), 0 },
+	{ INT(concurrent_assoc_ok), 0 },
 };
 
 #undef FUNC
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 61f1e47..845d15b 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -28,6 +28,7 @@
 #define DEFAULT_SCAN_CUR_FREQ 0
 #define DEFAULT_MIN_SCAN_GAP 0
 #define DEFAULT_MAX_ASSOC_PER_SCAN 25
+#define DEFAULT_CONCURRENT_ASSOC_OK 0
 
 #include "config_ssid.h"
 #include "wps/wps.h"
@@ -787,6 +788,13 @@ struct wpa_config {
 	 */
 	int can_scan_one;
 
+	/* By default, scans are no longer shared once one of the stations starts
+	 * to associate.  This makes bringing up lots of vifs take a long time.
+	 * This override below lets us propagate scans even if a station is
+	 * associating.
+	 */
+	int concurrent_assoc_ok;
+
 	/**
 	 * disassoc_low_ack - Disassocicate stations with massive packet loss
 	 */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 9b0e5db..0a1d50d 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1349,6 +1349,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 	if (wpa_s->conf->min_scan_gap &&
 	    eloop_is_timeout_registered(wpa_supplicant_scan, wpa_s, NULL)) {
 		/* Min gap will be applied as needed */
+		wpa_dbg(wpa_s, MSG_DEBUG, "Re-requesting scan to apply min-gap");
 		wpa_supplicant_req_scan(wpa_s, 1, 0);
 	}
 
@@ -1520,10 +1521,12 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 					      union wpa_event_data *data)
 {
 	struct wpa_supplicant *ifs;
+	int res;
 
 	num_assoc_reqs = 0;
 
-	if (_wpa_supplicant_event_scan_results(wpa_s, data, 1) != 0) {
+	if (((res = _wpa_supplicant_event_scan_results(wpa_s, data, 1)) < 0) ||
+	    ((res > 0) && !wpa_s->conf->concurrent_assoc_ok)) {
 		/*
 		 * If no scan results could be fetched, then no need to
 		 * notify those interfaces that did not actually request
@@ -1531,6 +1534,8 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 		 * interface, do not notify other interfaces to avoid concurrent
 		 * operations during a connection attempt.
 		 */
+		wpa_printf(MSG_DEBUG, "event-scan-results not sharable: %d",
+			   res);
 		return;
 	}
 
-- 
1.7.3.4




More information about the Hostap mailing list