diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-03-16 17:23:37 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-03-30 04:17:12 -0400 |
commit | a90faa9d6449f3861428bafeaf4d1fcf2be4ba7f (patch) | |
tree | 19a15bec9152438eecafb2e446b7fc12a00eed43 /net/mac80211/mlme.c | |
parent | d0d1a12f9cc665f3fcac5288ab84429a91abd4e9 (diff) |
mac80211: notify the driver about deauth
This can allow the driver to take action based on the reason
of the deauth.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index b6817c4c4449..22b125913661 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -2345,6 +2345,24 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, | |||
2345 | } | 2345 | } |
2346 | EXPORT_SYMBOL(ieee80211_ap_probereq_get); | 2346 | EXPORT_SYMBOL(ieee80211_ap_probereq_get); |
2347 | 2347 | ||
2348 | static void ieee80211_report_disconnect(struct ieee80211_sub_if_data *sdata, | ||
2349 | const u8 *buf, size_t len, bool tx, | ||
2350 | u16 reason) | ||
2351 | { | ||
2352 | struct ieee80211_event event = { | ||
2353 | .type = MLME_EVENT, | ||
2354 | .u.mlme.data = tx ? DEAUTH_TX_EVENT : DEAUTH_RX_EVENT, | ||
2355 | .u.mlme.reason = reason, | ||
2356 | }; | ||
2357 | |||
2358 | if (tx) | ||
2359 | cfg80211_tx_mlme_mgmt(sdata->dev, buf, len); | ||
2360 | else | ||
2361 | cfg80211_rx_mlme_mgmt(sdata->dev, buf, len); | ||
2362 | |||
2363 | drv_event_callback(sdata->local, sdata, &event); | ||
2364 | } | ||
2365 | |||
2348 | static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | 2366 | static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) |
2349 | { | 2367 | { |
2350 | struct ieee80211_local *local = sdata->local; | 2368 | struct ieee80211_local *local = sdata->local; |
@@ -2370,8 +2388,9 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | |||
2370 | } | 2388 | } |
2371 | mutex_unlock(&local->mtx); | 2389 | mutex_unlock(&local->mtx); |
2372 | 2390 | ||
2373 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 2391 | ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, |
2374 | IEEE80211_DEAUTH_FRAME_LEN); | 2392 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); |
2393 | |||
2375 | sdata_unlock(sdata); | 2394 | sdata_unlock(sdata); |
2376 | } | 2395 | } |
2377 | 2396 | ||
@@ -2676,7 +2695,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | |||
2676 | 2695 | ||
2677 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 2696 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
2678 | 2697 | ||
2679 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); | 2698 | ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, reason_code); |
2680 | } | 2699 | } |
2681 | 2700 | ||
2682 | 2701 | ||
@@ -2702,7 +2721,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
2702 | 2721 | ||
2703 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 2722 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
2704 | 2723 | ||
2705 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); | 2724 | ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, reason_code); |
2706 | } | 2725 | } |
2707 | 2726 | ||
2708 | static void ieee80211_get_rates(struct ieee80211_supported_band *sband, | 2727 | static void ieee80211_get_rates(struct ieee80211_supported_band *sband, |
@@ -3509,8 +3528,9 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3509 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 3528 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
3510 | WLAN_REASON_DEAUTH_LEAVING, | 3529 | WLAN_REASON_DEAUTH_LEAVING, |
3511 | true, deauth_buf); | 3530 | true, deauth_buf); |
3512 | cfg80211_tx_mlme_mgmt(sdata->dev, deauth_buf, | 3531 | ieee80211_report_disconnect(sdata, deauth_buf, |
3513 | sizeof(deauth_buf)); | 3532 | sizeof(deauth_buf), true, |
3533 | WLAN_REASON_DEAUTH_LEAVING); | ||
3514 | return; | 3534 | return; |
3515 | } | 3535 | } |
3516 | 3536 | ||
@@ -3628,8 +3648,8 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, | |||
3628 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, | 3648 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, |
3629 | tx, frame_buf); | 3649 | tx, frame_buf); |
3630 | 3650 | ||
3631 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 3651 | ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, |
3632 | IEEE80211_DEAUTH_FRAME_LEN); | 3652 | reason); |
3633 | } | 3653 | } |
3634 | 3654 | ||
3635 | static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | 3655 | static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) |
@@ -4507,8 +4527,9 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, | |||
4507 | WLAN_REASON_UNSPECIFIED, | 4527 | WLAN_REASON_UNSPECIFIED, |
4508 | false, frame_buf); | 4528 | false, frame_buf); |
4509 | 4529 | ||
4510 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 4530 | ieee80211_report_disconnect(sdata, frame_buf, |
4511 | sizeof(frame_buf)); | 4531 | sizeof(frame_buf), true, |
4532 | WLAN_REASON_UNSPECIFIED); | ||
4512 | } | 4533 | } |
4513 | 4534 | ||
4514 | sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); | 4535 | sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); |
@@ -4608,8 +4629,9 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
4608 | WLAN_REASON_UNSPECIFIED, | 4629 | WLAN_REASON_UNSPECIFIED, |
4609 | false, frame_buf); | 4630 | false, frame_buf); |
4610 | 4631 | ||
4611 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 4632 | ieee80211_report_disconnect(sdata, frame_buf, |
4612 | sizeof(frame_buf)); | 4633 | sizeof(frame_buf), true, |
4634 | WLAN_REASON_UNSPECIFIED); | ||
4613 | } | 4635 | } |
4614 | 4636 | ||
4615 | if (ifmgd->auth_data && !ifmgd->auth_data->done) { | 4637 | if (ifmgd->auth_data && !ifmgd->auth_data->done) { |
@@ -4899,8 +4921,9 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
4899 | req->reason_code, tx, | 4921 | req->reason_code, tx, |
4900 | frame_buf); | 4922 | frame_buf); |
4901 | ieee80211_destroy_auth_data(sdata, false); | 4923 | ieee80211_destroy_auth_data(sdata, false); |
4902 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 4924 | ieee80211_report_disconnect(sdata, frame_buf, |
4903 | IEEE80211_DEAUTH_FRAME_LEN); | 4925 | sizeof(frame_buf), true, |
4926 | req->reason_code); | ||
4904 | 4927 | ||
4905 | return 0; | 4928 | return 0; |
4906 | } | 4929 | } |
@@ -4914,8 +4937,9 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
4914 | 4937 | ||
4915 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 4938 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
4916 | req->reason_code, tx, frame_buf); | 4939 | req->reason_code, tx, frame_buf); |
4917 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 4940 | ieee80211_report_disconnect(sdata, frame_buf, |
4918 | IEEE80211_DEAUTH_FRAME_LEN); | 4941 | sizeof(frame_buf), true, |
4942 | req->reason_code); | ||
4919 | return 0; | 4943 | return 0; |
4920 | } | 4944 | } |
4921 | 4945 | ||
@@ -4947,8 +4971,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
4947 | req->reason_code, !req->local_state_change, | 4971 | req->reason_code, !req->local_state_change, |
4948 | frame_buf); | 4972 | frame_buf); |
4949 | 4973 | ||
4950 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, | 4974 | ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, |
4951 | IEEE80211_DEAUTH_FRAME_LEN); | 4975 | req->reason_code); |
4952 | 4976 | ||
4953 | return 0; | 4977 | return 0; |
4954 | } | 4978 | } |