Commit a9409093 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Johannes Berg

mac80211: notify the driver about authentication status

This can allow the driver to take action based on the
success / failure of the authentication.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent a8182929
...@@ -303,9 +303,11 @@ enum ieee80211_bss_change { ...@@ -303,9 +303,11 @@ enum ieee80211_bss_change {
/** /**
* enum ieee80211_event_type - event to be notified to the low level driver * enum ieee80211_event_type - event to be notified to the low level driver
* @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver. * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
* @MLME_EVENT: event related to MLME
*/ */
enum ieee80211_event_type { enum ieee80211_event_type {
RSSI_EVENT, RSSI_EVENT,
MLME_EVENT,
}; };
/** /**
...@@ -326,15 +328,49 @@ struct ieee80211_rssi_event { ...@@ -326,15 +328,49 @@ struct ieee80211_rssi_event {
enum ieee80211_rssi_event_data data; enum ieee80211_rssi_event_data data;
}; };
/**
* enum ieee80211_mlme_event_data - relevant when event type is %MLME_EVENT
* @AUTH_EVENT: the MLME operation is authentication
*/
enum ieee80211_mlme_event_data {
AUTH_EVENT,
};
/**
* enum ieee80211_mlme_event_status - relevant when event type is %MLME_EVENT
* @MLME_SUCCESS: the MLME operation completed successfully.
* @MLME_DENIED: the MLME operation was denied by the peer.
* @MLME_TIMEOUT: the MLME operation timed out.
*/
enum ieee80211_mlme_event_status {
MLME_SUCCESS,
MLME_DENIED,
MLME_TIMEOUT,
};
/**
* enum ieee80211_mlme_event - data attached to an %MLME_EVENT
* @data: See &enum ieee80211_mlme_event_data
* @status: See &enum ieee80211_mlme_event_status
* @reason: the reason code if applicable
*/
struct ieee80211_mlme_event {
enum ieee80211_mlme_event_data data;
enum ieee80211_mlme_event_status status;
u16 reason;
};
/** /**
* struct ieee80211_event - event to be sent to the driver * struct ieee80211_event - event to be sent to the driver
* @type The event itself. See &enum ieee80211_event_type. * @type The event itself. See &enum ieee80211_event_type.
* @rssi: relevant if &type is %RSSI_EVENT * @rssi: relevant if &type is %RSSI_EVENT
* @mlme: relevant if &type is %AUTH_EVENT
*/ */
struct ieee80211_event { struct ieee80211_event {
enum ieee80211_event_type type; enum ieee80211_event_type type;
union { union {
struct ieee80211_rssi_event rssi; struct ieee80211_rssi_event rssi;
struct ieee80211_mlme_event mlme;
} u; } u;
}; };
......
...@@ -2495,6 +2495,10 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2495,6 +2495,10 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u16 auth_alg, auth_transaction, status_code; u16 auth_alg, auth_transaction, status_code;
struct sta_info *sta; struct sta_info *sta;
struct ieee80211_event event = {
.type = MLME_EVENT,
.u.mlme.data = AUTH_EVENT,
};
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
...@@ -2527,6 +2531,9 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2527,6 +2531,9 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
mgmt->sa, status_code); mgmt->sa, status_code);
ieee80211_destroy_auth_data(sdata, false); ieee80211_destroy_auth_data(sdata, false);
cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
event.u.mlme.status = MLME_DENIED;
event.u.mlme.reason = status_code;
drv_event_callback(sdata->local, sdata, &event);
return; return;
} }
...@@ -2549,6 +2556,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2549,6 +2556,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
return; return;
} }
event.u.mlme.status = MLME_SUCCESS;
drv_event_callback(sdata->local, sdata, &event);
sdata_info(sdata, "authenticated\n"); sdata_info(sdata, "authenticated\n");
ifmgd->auth_data->done = true; ifmgd->auth_data->done = true;
ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
...@@ -3805,12 +3814,18 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) ...@@ -3805,12 +3814,18 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
ieee80211_destroy_auth_data(sdata, false); ieee80211_destroy_auth_data(sdata, false);
} else if (ieee80211_probe_auth(sdata)) { } else if (ieee80211_probe_auth(sdata)) {
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
struct ieee80211_event event = {
.type = MLME_EVENT,
.u.mlme.data = AUTH_EVENT,
.u.mlme.status = MLME_TIMEOUT,
};
memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
ieee80211_destroy_auth_data(sdata, false); ieee80211_destroy_auth_data(sdata, false);
cfg80211_auth_timeout(sdata->dev, bssid); cfg80211_auth_timeout(sdata->dev, bssid);
drv_event_callback(sdata->local, sdata, &event);
} }
} else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started)
run_again(sdata, ifmgd->auth_data->timeout); run_again(sdata, ifmgd->auth_data->timeout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment