[PATCH] wait for IBSS join events for drivers that support them

Dan Williams dcbw
Thu Aug 5 14:49:39 PDT 2010


Wait for the join event to come through before indicating COMPLETED
state, otherwise the driver isn't ready yet and often hasn't even
started the IBSS yet because it's still scanning for candidates.

Signed-off-by: Dan Williams <dcbw at redhat.com>
---
Diff against 0.7.  Please apply to 0.6 too when you get the chance,
thanks!

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index fa49da4..daa6565 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -502,6 +502,8 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_AP		0x00000040
 /* Driver needs static WEP key setup after association has been completed */
 #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE	0x00000080
+/* Driver signals successful IBSS join/create events */
+#define WPA_DRIVER_FLAGS_SIGNALS_IBSS_JOIN	0x00000100
 	unsigned int flags;
 
 	int max_scan_ssids;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index a123327..6eb0deb 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1225,7 +1225,9 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 		return -1;
 	}
 
-	drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
+	drv->capa.flags |= (WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE |
+				WPA_DRIVER_FLAGS_SIGNALS_IBSS_JOIN);
+
 	drv->capa.max_remain_on_chan = 5000;
 
 	return 0;
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index 2614f23..ed3df59 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -1419,6 +1419,11 @@ static int wpa_driver_wext_get_range(void *priv)
 			WPA_DRIVER_AUTH_LEAP;
 		drv->capa.max_scan_ssids = 1;
 
+		/* WEXT expects drivers to send SIOCSIWAP events on successful
+		 * IBSS join/create.
+		 */
+		drv->capa.flags |= WPA_DRIVER_FLAGS_SIGNALS_IBSS_JOIN;
+
 		wpa_printf(MSG_DEBUG, "  capabilities: key_mgmt 0x%x enc 0x%x "
 			   "flags 0x%x",
 			   drv->capa.key_mgmt, drv->capa.enc, drv->capa.flags);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5563f0b..acd0497 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1237,7 +1237,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 		assoc_failed = 1;
 	}
 
-	if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) {
+	if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE &&
+	    !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SIGNALS_IBSS_JOIN)) {
 		/* Set the key after the association just in case association
 		 * cleared the previously configured key. */
 		wpa_supplicant_set_wpa_none_key(wpa_s, ssid);




More information about the Hostap mailing list