diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-05-15 18:55:00 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-06-04 07:03:10 -0400 |
commit | 6ff57cf88807dd81300b5b9c623dc5eb6422b9f6 (patch) | |
tree | 8819fea1f493077ff311208986ebfe27bd327623 /net/mac80211 | |
parent | 51217cee3a94d5409d6ee2ac090ae96bc9a06757 (diff) |
cfg80211/mac80211: clean up cfg80211 SME APIs
Do some cleanups in the cfg80211 SME APIs, which are
only used by mac80211.
Most of these functions get a frame passed, and there
isn't really any reason to export multiple functions
as cfg80211 can check the frame type instead, do that.
Additionally, the API functions have confusing names
like cfg80211_send_...() which was meant to indicate
that it sends an event to userspace, but gets a bit
confusing when there's both TX and RX and they're not
all clearly labeled.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/mlme.c | 44 | ||||
-rw-r--r-- | net/mac80211/rx.c | 26 |
2 files changed, 33 insertions, 37 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 9950e13f641b..df8170a80a56 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -2155,7 +2155,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) | |||
2155 | IEEE80211_MAX_QUEUE_MAP, | 2155 | IEEE80211_MAX_QUEUE_MAP, |
2156 | IEEE80211_QUEUE_STOP_REASON_CSA); | 2156 | IEEE80211_QUEUE_STOP_REASON_CSA); |
2157 | 2157 | ||
2158 | cfg80211_send_deauth(sdata->dev, frame_buf, IEEE80211_DEAUTH_FRAME_LEN); | 2158 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
2159 | IEEE80211_DEAUTH_FRAME_LEN); | ||
2159 | sdata_unlock(sdata); | 2160 | sdata_unlock(sdata); |
2160 | } | 2161 | } |
2161 | 2162 | ||
@@ -2302,7 +2303,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
2302 | sdata_info(sdata, "%pM denied authentication (status %d)\n", | 2303 | sdata_info(sdata, "%pM denied authentication (status %d)\n", |
2303 | mgmt->sa, status_code); | 2304 | mgmt->sa, status_code); |
2304 | ieee80211_destroy_auth_data(sdata, false); | 2305 | ieee80211_destroy_auth_data(sdata, false); |
2305 | cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len); | 2306 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); |
2306 | return; | 2307 | return; |
2307 | } | 2308 | } |
2308 | 2309 | ||
@@ -2337,7 +2338,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
2337 | * Report auth frame to user space for processing since another | 2338 | * Report auth frame to user space for processing since another |
2338 | * round of Authentication frames is still needed. | 2339 | * round of Authentication frames is still needed. |
2339 | */ | 2340 | */ |
2340 | cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len); | 2341 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); |
2341 | return; | 2342 | return; |
2342 | } | 2343 | } |
2343 | 2344 | ||
@@ -2354,7 +2355,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, | |||
2354 | } | 2355 | } |
2355 | mutex_unlock(&sdata->local->sta_mtx); | 2356 | mutex_unlock(&sdata->local->sta_mtx); |
2356 | 2357 | ||
2357 | cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len); | 2358 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); |
2358 | return; | 2359 | return; |
2359 | out_err: | 2360 | out_err: |
2360 | mutex_unlock(&sdata->local->sta_mtx); | 2361 | mutex_unlock(&sdata->local->sta_mtx); |
@@ -2387,7 +2388,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | |||
2387 | 2388 | ||
2388 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 2389 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
2389 | 2390 | ||
2390 | cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, len); | 2391 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); |
2391 | } | 2392 | } |
2392 | 2393 | ||
2393 | 2394 | ||
@@ -2413,7 +2414,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
2413 | 2414 | ||
2414 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); | 2415 | ieee80211_set_disassoc(sdata, 0, 0, false, NULL); |
2415 | 2416 | ||
2416 | cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, len); | 2417 | cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); |
2417 | } | 2418 | } |
2418 | 2419 | ||
2419 | static void ieee80211_get_rates(struct ieee80211_supported_band *sband, | 2420 | static void ieee80211_get_rates(struct ieee80211_supported_band *sband, |
@@ -2711,7 +2712,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2711 | /* oops -- internal error -- send timeout for now */ | 2712 | /* oops -- internal error -- send timeout for now */ |
2712 | ieee80211_destroy_assoc_data(sdata, false); | 2713 | ieee80211_destroy_assoc_data(sdata, false); |
2713 | cfg80211_put_bss(sdata->local->hw.wiphy, bss); | 2714 | cfg80211_put_bss(sdata->local->hw.wiphy, bss); |
2714 | cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid); | 2715 | cfg80211_assoc_timeout(sdata->dev, mgmt->bssid); |
2715 | return; | 2716 | return; |
2716 | } | 2717 | } |
2717 | sdata_info(sdata, "associated\n"); | 2718 | sdata_info(sdata, "associated\n"); |
@@ -2724,7 +2725,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2724 | ieee80211_destroy_assoc_data(sdata, true); | 2725 | ieee80211_destroy_assoc_data(sdata, true); |
2725 | } | 2726 | } |
2726 | 2727 | ||
2727 | cfg80211_send_rx_assoc(sdata->dev, bss, (u8 *)mgmt, len); | 2728 | cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len); |
2728 | } | 2729 | } |
2729 | 2730 | ||
2730 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | 2731 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, |
@@ -3117,8 +3118,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3117 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 3118 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
3118 | WLAN_REASON_DEAUTH_LEAVING, | 3119 | WLAN_REASON_DEAUTH_LEAVING, |
3119 | true, deauth_buf); | 3120 | true, deauth_buf); |
3120 | cfg80211_send_deauth(sdata->dev, deauth_buf, | 3121 | cfg80211_tx_mlme_mgmt(sdata->dev, deauth_buf, |
3121 | sizeof(deauth_buf)); | 3122 | sizeof(deauth_buf)); |
3122 | return; | 3123 | return; |
3123 | } | 3124 | } |
3124 | 3125 | ||
@@ -3236,7 +3237,8 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, | |||
3236 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, | 3237 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, |
3237 | tx, frame_buf); | 3238 | tx, frame_buf); |
3238 | 3239 | ||
3239 | cfg80211_send_deauth(sdata->dev, frame_buf, IEEE80211_DEAUTH_FRAME_LEN); | 3240 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
3241 | IEEE80211_DEAUTH_FRAME_LEN); | ||
3240 | } | 3242 | } |
3241 | 3243 | ||
3242 | static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | 3244 | static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) |
@@ -3427,7 +3429,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) | |||
3427 | 3429 | ||
3428 | ieee80211_destroy_auth_data(sdata, false); | 3430 | ieee80211_destroy_auth_data(sdata, false); |
3429 | 3431 | ||
3430 | cfg80211_send_auth_timeout(sdata->dev, bssid); | 3432 | cfg80211_auth_timeout(sdata->dev, bssid); |
3431 | } | 3433 | } |
3432 | } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) | 3434 | } else if (ifmgd->auth_data && ifmgd->auth_data->timeout_started) |
3433 | run_again(sdata, ifmgd->auth_data->timeout); | 3435 | run_again(sdata, ifmgd->auth_data->timeout); |
@@ -3443,7 +3445,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) | |||
3443 | 3445 | ||
3444 | ieee80211_destroy_assoc_data(sdata, false); | 3446 | ieee80211_destroy_assoc_data(sdata, false); |
3445 | 3447 | ||
3446 | cfg80211_send_assoc_timeout(sdata->dev, bssid); | 3448 | cfg80211_assoc_timeout(sdata->dev, bssid); |
3447 | } | 3449 | } |
3448 | } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) | 3450 | } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) |
3449 | run_again(sdata, ifmgd->assoc_data->timeout); | 3451 | run_again(sdata, ifmgd->assoc_data->timeout); |
@@ -3992,8 +3994,8 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, | |||
3992 | WLAN_REASON_UNSPECIFIED, | 3994 | WLAN_REASON_UNSPECIFIED, |
3993 | false, frame_buf); | 3995 | false, frame_buf); |
3994 | 3996 | ||
3995 | cfg80211_send_deauth(sdata->dev, frame_buf, | 3997 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
3996 | sizeof(frame_buf)); | 3998 | sizeof(frame_buf)); |
3997 | } | 3999 | } |
3998 | 4000 | ||
3999 | sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); | 4001 | sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); |
@@ -4055,8 +4057,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
4055 | WLAN_REASON_UNSPECIFIED, | 4057 | WLAN_REASON_UNSPECIFIED, |
4056 | false, frame_buf); | 4058 | false, frame_buf); |
4057 | 4059 | ||
4058 | cfg80211_send_deauth(sdata->dev, frame_buf, | 4060 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
4059 | sizeof(frame_buf)); | 4061 | sizeof(frame_buf)); |
4060 | } | 4062 | } |
4061 | 4063 | ||
4062 | if (ifmgd->auth_data && !ifmgd->auth_data->done) { | 4064 | if (ifmgd->auth_data && !ifmgd->auth_data->done) { |
@@ -4309,8 +4311,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
4309 | 4311 | ||
4310 | out: | 4312 | out: |
4311 | if (report_frame) | 4313 | if (report_frame) |
4312 | cfg80211_send_deauth(sdata->dev, frame_buf, | 4314 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
4313 | IEEE80211_DEAUTH_FRAME_LEN); | 4315 | IEEE80211_DEAUTH_FRAME_LEN); |
4314 | 4316 | ||
4315 | return 0; | 4317 | return 0; |
4316 | } | 4318 | } |
@@ -4340,8 +4342,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
4340 | req->reason_code, !req->local_state_change, | 4342 | req->reason_code, !req->local_state_change, |
4341 | frame_buf); | 4343 | frame_buf); |
4342 | 4344 | ||
4343 | cfg80211_send_disassoc(sdata->dev, frame_buf, | 4345 | cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf, |
4344 | IEEE80211_DEAUTH_FRAME_LEN); | 4346 | IEEE80211_DEAUTH_FRAME_LEN); |
4345 | 4347 | ||
4346 | return 0; | 4348 | return 0; |
4347 | } | 4349 | } |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bdd7b4a719e9..23dbcfc69b3b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1747,27 +1747,21 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx) | |||
1747 | if (unlikely(!ieee80211_has_protected(fc) && | 1747 | if (unlikely(!ieee80211_has_protected(fc) && |
1748 | ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && | 1748 | ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && |
1749 | rx->key)) { | 1749 | rx->key)) { |
1750 | if (ieee80211_is_deauth(fc)) | 1750 | if (ieee80211_is_deauth(fc) || |
1751 | cfg80211_send_unprot_deauth(rx->sdata->dev, | 1751 | ieee80211_is_disassoc(fc)) |
1752 | rx->skb->data, | 1752 | cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev, |
1753 | rx->skb->len); | 1753 | rx->skb->data, |
1754 | else if (ieee80211_is_disassoc(fc)) | 1754 | rx->skb->len); |
1755 | cfg80211_send_unprot_disassoc(rx->sdata->dev, | ||
1756 | rx->skb->data, | ||
1757 | rx->skb->len); | ||
1758 | return -EACCES; | 1755 | return -EACCES; |
1759 | } | 1756 | } |
1760 | /* BIP does not use Protected field, so need to check MMIE */ | 1757 | /* BIP does not use Protected field, so need to check MMIE */ |
1761 | if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) && | 1758 | if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) && |
1762 | ieee80211_get_mmie_keyidx(rx->skb) < 0)) { | 1759 | ieee80211_get_mmie_keyidx(rx->skb) < 0)) { |
1763 | if (ieee80211_is_deauth(fc)) | 1760 | if (ieee80211_is_deauth(fc) || |
1764 | cfg80211_send_unprot_deauth(rx->sdata->dev, | 1761 | ieee80211_is_disassoc(fc)) |
1765 | rx->skb->data, | 1762 | cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev, |
1766 | rx->skb->len); | 1763 | rx->skb->data, |
1767 | else if (ieee80211_is_disassoc(fc)) | 1764 | rx->skb->len); |
1768 | cfg80211_send_unprot_disassoc(rx->sdata->dev, | ||
1769 | rx->skb->data, | ||
1770 | rx->skb->len); | ||
1771 | return -EACCES; | 1765 | return -EACCES; |
1772 | } | 1766 | } |
1773 | /* | 1767 | /* |