aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-08-17 13:39:33 (GMT)
committerJouni Malinen <j@w1.fi>2010-09-05 14:29:08 (GMT)
commit10928cd1085a38b055f63a12924e729789f2da35 (patch)
treea188de66ae4c7ce6840450880670b094d1ef0840
parentac8c05ca76636c112ba793c2603af5b7de9a1dd4 (diff)
downloadhostap-07-10928cd1085a38b055f63a12924e729789f2da35.zip
hostap-07-10928cd1085a38b055f63a12924e729789f2da35.tar.gz
hostap-07-10928cd1085a38b055f63a12924e729789f2da35.tar.bz2
sme: Try all authentication algorithms when the first one fails
When passing several authentication algorithms through auth_alg, we should try all of them when the first one fails. The wext driver goes through the connect nl80211 command and the retries are then handled by the kernel. The nl80211 doesn't and we have to handle that from userspace. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> (cherry picked from commit cb1583f64b5a50ebc542719e41c569926a62f718)
-rw-r--r--src/drivers/driver_nl80211.c4
-rw-r--r--wpa_supplicant/sme.c28
2 files changed, 27 insertions, 5 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 72c1569..364158c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2437,10 +2437,6 @@ retry:
wpa_hexdump(MSG_DEBUG, " * IEs", params->ie, params->ie_len);
if (params->ie)
NLA_PUT(msg, NL80211_ATTR_IE, params->ie_len, params->ie);
- /*
- * TODO: if multiple auth_alg options enabled, try them one by one if
- * the AP rejects authentication due to unknown auth alg
- */
if (params->auth_alg & WPA_AUTH_ALG_OPEN)
type = NL80211_AUTHTYPE_OPEN_SYSTEM;
else if (params->auth_alg & WPA_AUTH_ALG_SHARED)
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index b5927c5..7cf3cc1 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -274,7 +274,33 @@ void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
if (data->auth.status_code != WLAN_STATUS_SUCCESS) {
wpa_printf(MSG_DEBUG, "SME: Authentication failed (status "
"code %d)", data->auth.status_code);
- return;
+
+ if (data->auth.status_code !=
+ WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG ||
+ wpa_s->sme.auth_alg == data->auth.auth_type ||
+ wpa_s->current_ssid->auth_alg == WPA_AUTH_ALG_LEAP)
+ return;
+
+ switch (data->auth.auth_type) {
+ case WLAN_AUTH_OPEN:
+ wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_SHARED;
+
+ wpa_printf(MSG_DEBUG, "SME: Trying SHARED auth");
+ wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
+ wpa_s->current_ssid);
+ return;
+
+ case WLAN_AUTH_SHARED_KEY:
+ wpa_s->current_ssid->auth_alg = WPA_AUTH_ALG_LEAP;
+
+ wpa_printf(MSG_DEBUG, "SME: Trying LEAP auth");
+ wpa_supplicant_associate(wpa_s, wpa_s->current_bss,
+ wpa_s->current_ssid);
+ return;
+
+ default:
+ return;
+ }
}
#ifdef CONFIG_IEEE80211R