Allow driver wrappers to indicate whether result codes are sane

Some drivers are not providing exactly reliable error codes (e.g.,
with WEXT), but others may actually indicate reliable information.
Allow driver wrappers to indicate if that is the case and use
optimizations if so. For now, this improves nl80211 with
NL80211_CMD_CONNECT for a case where connection request fails.
This commit is contained in:
Jouni Malinen 2010-11-26 17:41:21 +02:00 committed by Jouni Malinen
parent df89c1c8d1
commit 871f4dd069
3 changed files with 17 additions and 0 deletions

View file

@ -553,6 +553,12 @@ struct wpa_driver_capa {
* P2P group operations. * P2P group operations.
*/ */
#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000 #define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
/*
* Driver is known to use sane error codes, i.e., when it indicates that
* something (e.g., association) fails, there was indeed a failure and the
* operation does not end up getting completed successfully later.
*/
#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
unsigned int flags; unsigned int flags;
int max_scan_ssids; int max_scan_ssids;

View file

@ -1489,6 +1489,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
return -1; return -1;
} }
drv->capa.flags |= WPA_DRIVER_FLAGS_SANE_ERROR_CODES;
drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE; drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE; drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
drv->capa.max_remain_on_chan = 5000; drv->capa.max_remain_on_chan = 5000;

View file

@ -1304,6 +1304,16 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
if (ret < 0) { if (ret < 0) {
wpa_msg(wpa_s, MSG_INFO, "Association request to the driver " wpa_msg(wpa_s, MSG_INFO, "Association request to the driver "
"failed"); "failed");
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SANE_ERROR_CODES) {
/*
* The driver is known to mean what is saying, so we
* can stop right here; the association will not
* succeed.
*/
wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
return;
}
/* try to continue anyway; new association will be tried again /* try to continue anyway; new association will be tried again
* after timeout */ * after timeout */
assoc_failed = 1; assoc_failed = 1;