aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-03-16 17:23:35 -0400
committerJohannes Berg <johannes.berg@intel.com>2015-03-30 04:17:10 -0400
commita9409093d23c822d13a73f8d2df7e6fa987ae485 (patch)
tree55cb607c2b20ae7338e5abfdd6f0b9dd14b88c21
parenta818292952bbfad12ec5a32ab01330cb1ceed013 (diff)
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: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/mac80211.h36
-rw-r--r--net/mac80211/mlme.c15
2 files changed, 51 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7a966f3ed67a..6cddf7725bf2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -303,9 +303,11 @@ enum ieee80211_bss_change {
303/** 303/**
304 * enum ieee80211_event_type - event to be notified to the low level driver 304 * enum ieee80211_event_type - event to be notified to the low level driver
305 * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver. 305 * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
306 * @MLME_EVENT: event related to MLME
306 */ 307 */
307enum ieee80211_event_type { 308enum ieee80211_event_type {
308 RSSI_EVENT, 309 RSSI_EVENT,
310 MLME_EVENT,
309}; 311};
310 312
311/** 313/**
@@ -327,14 +329,48 @@ struct ieee80211_rssi_event {
327}; 329};
328 330
329/** 331/**
332 * enum ieee80211_mlme_event_data - relevant when event type is %MLME_EVENT
333 * @AUTH_EVENT: the MLME operation is authentication
334 */
335enum ieee80211_mlme_event_data {
336 AUTH_EVENT,
337};
338
339/**
340 * enum ieee80211_mlme_event_status - relevant when event type is %MLME_EVENT
341 * @MLME_SUCCESS: the MLME operation completed successfully.
342 * @MLME_DENIED: the MLME operation was denied by the peer.
343 * @MLME_TIMEOUT: the MLME operation timed out.
344 */
345enum ieee80211_mlme_event_status {
346 MLME_SUCCESS,
347 MLME_DENIED,
348 MLME_TIMEOUT,
349};
350
351/**
352 * enum ieee80211_mlme_event - data attached to an %MLME_EVENT
353 * @data: See &enum ieee80211_mlme_event_data
354 * @status: See &enum ieee80211_mlme_event_status
355 * @reason: the reason code if applicable
356 */
357struct ieee80211_mlme_event {
358 enum ieee80211_mlme_event_data data;
359 enum ieee80211_mlme_event_status status;
360 u16 reason;
361};
362
363/**
330 * struct ieee80211_event - event to be sent to the driver 364 * struct ieee80211_event - event to be sent to the driver
331 * @type The event itself. See &enum ieee80211_event_type. 365 * @type The event itself. See &enum ieee80211_event_type.
332 * @rssi: relevant if &type is %RSSI_EVENT 366 * @rssi: relevant if &type is %RSSI_EVENT
367 * @mlme: relevant if &type is %AUTH_EVENT
333 */ 368 */
334struct ieee80211_event { 369struct ieee80211_event {
335 enum ieee80211_event_type type; 370 enum ieee80211_event_type type;
336 union { 371 union {
337 struct ieee80211_rssi_event rssi; 372 struct ieee80211_rssi_event rssi;
373 struct ieee80211_mlme_event mlme;
338 } u; 374 } u;
339}; 375};
340 376
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a8c8fe4c9f49..7865998d69dd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2495,6 +2495,10 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
2495 u8 bssid[ETH_ALEN]; 2495 u8 bssid[ETH_ALEN];
2496 u16 auth_alg, auth_transaction, status_code; 2496 u16 auth_alg, auth_transaction, status_code;
2497 struct sta_info *sta; 2497 struct sta_info *sta;
2498 struct ieee80211_event event = {
2499 .type = MLME_EVENT,
2500 .u.mlme.data = AUTH_EVENT,
2501 };
2498 2502
2499 sdata_assert_lock(sdata); 2503 sdata_assert_lock(sdata);
2500 2504
@@ -2527,6 +2531,9 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
2527 mgmt->sa, status_code); 2531 mgmt->sa, status_code);
2528 ieee80211_destroy_auth_data(sdata, false); 2532 ieee80211_destroy_auth_data(sdata, false);
2529 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); 2533 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
2534 event.u.mlme.status = MLME_DENIED;
2535 event.u.mlme.reason = status_code;
2536 drv_event_callback(sdata->local, sdata, &event);
2530 return; 2537 return;
2531 } 2538 }
2532 2539
@@ -2549,6 +2556,8 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
2549 return; 2556 return;
2550 } 2557 }
2551 2558
2559 event.u.mlme.status = MLME_SUCCESS;
2560 drv_event_callback(sdata->local, sdata, &event);
2552 sdata_info(sdata, "authenticated\n"); 2561 sdata_info(sdata, "authenticated\n");
2553 ifmgd->auth_data->done = true; 2562 ifmgd->auth_data->done = true;
2554 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; 2563 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
@@ -3805,12 +3814,18 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
3805 ieee80211_destroy_auth_data(sdata, false); 3814 ieee80211_destroy_auth_data(sdata, false);
3806 } else if (ieee80211_probe_auth(sdata)) { 3815 } else if (ieee80211_probe_auth(sdata)) {
3807 u8 bssid[ETH_ALEN]; 3816 u8 bssid[ETH_ALEN];
3817 struct ieee80211_event event = {
3818 .type = MLME_EVENT,
3819 .u.mlme.data = AUTH_EVENT,
3820 .u.mlme.status = MLME_TIMEOUT,
3821 };
3808 3822
3809 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); 3823 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
3810 3824
3811 ieee80211_destroy_auth_data(sdata, false); 3825 ieee80211_destroy_auth_data(sdata, false);
3812 3826
3813 cfg80211_auth_timeout(sdata->dev, bssid); 3827 cfg80211_auth_timeout(sdata->dev, bssid);
3828 drv_event_callback(sdata->local, sdata, &event);
3814 } 3829 }
3815 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) 3830 } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started)
3816 run_again(sdata, ifmgd->auth_data->timeout); 3831 run_again(sdata, ifmgd->auth_data->timeout);