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.
This commit is contained in:
Dan Williams 2008-09-29 16:45:49 +03:00 committed by Jouni Malinen
parent 1a647aaa69
commit ec5f180a24
7 changed files with 34 additions and 6 deletions

View file

@ -2226,8 +2226,6 @@ static int wpa_driver_nl80211_associate(
wpa_driver_nl80211_set_bssid(drv, NULL) < 0)
ret = -1;
if (wpa_driver_nl80211_set_mode(drv, params->mode) < 0)
ret = -1;
/* TODO: should consider getting wpa version and cipher/key_mgmt suites
* from configuration, not from here, where only the selected suite is
* available */
@ -2859,6 +2857,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.get_scan_results2 = wpa_driver_nl80211_get_scan_results,
.deauthenticate = wpa_driver_nl80211_deauthenticate,
.disassociate = wpa_driver_nl80211_disassociate,
.set_mode = wpa_driver_nl80211_set_mode,
.associate = wpa_driver_nl80211_associate,
.set_auth_alg = wpa_driver_nl80211_set_auth_alg,
.init = wpa_driver_nl80211_init,