SME: Add processing for rejected associations

This commit is contained in:
Jouni Malinen 2009-04-01 17:10:36 +03:00 committed by Jouni Malinen
parent c0a6190815
commit efa4607800
5 changed files with 79 additions and 6 deletions

View file

@ -1299,7 +1299,16 @@ typedef enum wpa_event_type {
* to receiving deauthenticate frame from the AP or when sending that
* frame to the current AP.
*/
EVENT_DEAUTH
EVENT_DEAUTH,
/**
* EVENT_ASSOC_REJECT - Association rejected
*
* This event should be called when (re)association attempt has been
* rejected by the AP. Information about authentication result is
* included in union wpa_event_data::assoc_reject.
*/
EVENT_ASSOC_REJECT
} wpa_event_type;
@ -1448,6 +1457,34 @@ union wpa_event_data {
const u8 *ies;
size_t ies_len;
} auth;
/**
* struct assoc_reject - Data for EVENT_ASSOC_REJECT events
*/
struct assoc_reject {
/**
* resp_ies - (Re)Association Response IEs
*
* Optional association data from the driver. This data is not
* required WPA, but may be useful for some protocols and as
* such, should be reported if this is available to the driver
* interface.
*
* This should start with the first IE (fixed fields before IEs
* are not included).
*/
u8 *resp_ies;
/**
* resp_ies_len - Length of resp_ies in bytes
*/
size_t resp_ies_len;
/**
* status_code - Status Code from (Re)association Response
*/
u16 status_code;
} assoc_reject;
};
/**

View file

@ -586,10 +586,16 @@ static void mlme_event_assoc(struct wpa_driver_nl80211_data *drv,
status = le_to_host16(mgmt->u.assoc_resp.status_code);
if (status != WLAN_STATUS_SUCCESS) {
wpa_printf(MSG_DEBUG, "nl80211: Association failed: status "
"code %d", status);
/* TODO: notify SME so that things like SA Query and comeback
* time can be implemented */
os_memset(&event, 0, sizeof(event));
if (len > 24 + sizeof(mgmt->u.assoc_resp)) {
event.assoc_reject.resp_ies =
(u8 *) mgmt->u.assoc_resp.variable;
event.assoc_reject.resp_ies_len =
len - 24 - sizeof(mgmt->u.assoc_resp);
}
event.assoc_reject.status_code = status;
wpa_supplicant_event(drv->ctx, EVENT_ASSOC_REJECT, &event);
return;
}
@ -600,7 +606,7 @@ static void mlme_event_assoc(struct wpa_driver_nl80211_data *drv,
if (len > 24 + sizeof(mgmt->u.assoc_resp)) {
event.assoc_info.resp_ies = (u8 *) mgmt->u.assoc_resp.variable;
event.assoc_info.resp_ies_len =
len - 24 - sizeof(mgmt->u.assoc_req);
len - 24 - sizeof(mgmt->u.assoc_resp);
}
wpa_supplicant_event(drv->ctx, EVENT_ASSOC, &event);