path: root/wpa_supplicant/wpa_supplicant.c
diff options
authorDan Williams <dcbw@redhat.com>2008-09-29 13:45:49 (GMT)
committerJouni Malinen <j@w1.fi>2008-09-29 13:45:49 (GMT)
commitec5f180a24cd31ba9d3d7f2abc9dc557fd16602f (patch)
treee2d7399d688bdc38a77dcbdf58eb1fcb07f9f348 /wpa_supplicant/wpa_supplicant.c
parent1a647aaa691d91c4a5ffccce09291592c4340062 (diff)
Add an optional set_mode() driver_ops handler for setting mode before keys
A bug just got reported as a result of this for mac80211 drivers. https://bugzilla.redhat.com/show_bug.cgi?id=459399 The basic problem is that since taking the device down clears the keys from the driver on many mac80211-based cards, and since the mode gets set _after_ the keys have been set in the driver, the keys get cleared on a mode switch and the resulting association is wrong. The report is about ad-hoc mode specifically, but this could happen when switching from adhoc back to managed mode.
Diffstat (limited to 'wpa_supplicant/wpa_supplicant.c')
1 files changed, 5 insertions, 0 deletions
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 4c9482f..a36c65b 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -937,6 +937,11 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
* previous association. */
wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
+ if (wpa_drv_set_mode(wpa_s, ssid->mode)) {
+ wpa_printf(MSG_WARNING, "Failed to set operating mode");
+ assoc_failed = 1;
+ }
#ifdef IEEE8021X_EAPOL
if (ssid->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
if (ssid->leap) {