Commit 6ff57cf8 authored by Johannes Berg's avatar Johannes Berg

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: default avatarJohannes Berg <johannes.berg@intel.com>
parent 51217cee
...@@ -3432,59 +3432,66 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); ...@@ -3432,59 +3432,66 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
/** /**
* cfg80211_send_rx_auth - notification of processed authentication * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
* @dev: network device * @dev: network device
* @buf: authentication frame (header + body) * @buf: authentication frame (header + body)
* @len: length of the frame data * @len: length of the frame data
* *
* This function is called whenever an authentication has been processed in * This function is called whenever an authentication, disassociation or
* station mode. The driver is required to call either this function or * deauthentication frame has been received and processed in station mode.
* cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() * After being asked to authenticate via cfg80211_ops::auth() the driver must
* call. This function may sleep. The caller must hold the corresponding wdev's * call either this function or cfg80211_auth_timeout().
* mutex. * After being asked to associate via cfg80211_ops::assoc() the driver must
* call either this function or cfg80211_auth_timeout().
* While connected, the driver must calls this for received and processed
* disassociation and deauthentication frames. If the frame couldn't be used
* because it was unprotected, the driver must call the function
* cfg80211_rx_unprot_mlme_mgmt() instead.
*
* This function may sleep. The caller must hold the corresponding wdev's mutex.
*/ */
void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
/** /**
* cfg80211_send_auth_timeout - notification of timed out authentication * cfg80211_auth_timeout - notification of timed out authentication
* @dev: network device * @dev: network device
* @addr: The MAC address of the device with which the authentication timed out * @addr: The MAC address of the device with which the authentication timed out
* *
* This function may sleep. The caller must hold the corresponding wdev's * This function may sleep. The caller must hold the corresponding wdev's
* mutex. * mutex.
*/ */
void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
/** /**
* cfg80211_send_rx_assoc - notification of processed association * cfg80211_rx_assoc_resp - notification of processed association response
* @dev: network device * @dev: network device
* @bss: the BSS struct association was requested for, the struct reference * @bss: the BSS that association was requested with, ownership of the pointer
* is owned by cfg80211 after this call * moves to cfg80211 in this call
* @buf: (re)association response frame (header + body) * @buf: authentication frame (header + body)
* @len: length of the frame data * @len: length of the frame data
* *
* This function is called whenever a (re)association response has been * After being asked to associate via cfg80211_ops::assoc() the driver must
* processed in station mode. The driver is required to call either this * call either this function or cfg80211_auth_timeout().
* function or cfg80211_send_assoc_timeout() to indicate the result of *
* cfg80211_ops::assoc() call. This function may sleep. The caller must hold * This function may sleep. The caller must hold the corresponding wdev's mutex.
* the corresponding wdev's mutex.
*/ */
void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, void cfg80211_rx_assoc_resp(struct net_device *dev,
struct cfg80211_bss *bss,
const u8 *buf, size_t len); const u8 *buf, size_t len);
/** /**
* cfg80211_send_assoc_timeout - notification of timed out association * cfg80211_assoc_timeout - notification of timed out association
* @dev: network device * @dev: network device
* @addr: The MAC address of the device with which the association timed out * @addr: The MAC address of the device with which the association timed out
* *
* This function may sleep. The caller must hold the corresponding wdev's mutex. * This function may sleep. The caller must hold the corresponding wdev's mutex.
*/ */
void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); void cfg80211_assoc_timeout(struct net_device *dev, const u8 *addr);
/** /**
* cfg80211_send_deauth - notification of processed deauthentication * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
* @dev: network device * @dev: network device
* @buf: deauthentication frame (header + body) * @buf: 802.11 frame (header + body)
* @len: length of the frame data * @len: length of the frame data
* *
* This function is called whenever deauthentication has been processed in * This function is called whenever deauthentication has been processed in
...@@ -3492,46 +3499,20 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); ...@@ -3492,46 +3499,20 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
* locally generated ones. This function may sleep. The caller must hold the * locally generated ones. This function may sleep. The caller must hold the
* corresponding wdev's mutex. * corresponding wdev's mutex.
*/ */
void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
/** /**
* cfg80211_send_disassoc - notification of processed disassociation * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
* @dev: network device
* @buf: disassociation response frame (header + body)
* @len: length of the frame data
*
* This function is called whenever disassociation has been processed in
* station mode. This includes both received disassociation frames and locally
* generated ones. This function may sleep. The caller must hold the
* corresponding wdev's mutex.
*/
void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
/**
* cfg80211_send_unprot_deauth - notification of unprotected deauthentication
* @dev: network device * @dev: network device
* @buf: deauthentication frame (header + body) * @buf: deauthentication frame (header + body)
* @len: length of the frame data * @len: length of the frame data
* *
* This function is called whenever a received Deauthentication frame has been * This function is called whenever a received deauthentication or dissassoc
* dropped in station mode because of MFP being used but the Deauthentication * frame has been dropped in station mode because of MFP being used but the
* frame was not protected. This function may sleep.
*/
void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
size_t len);
/**
* cfg80211_send_unprot_disassoc - notification of unprotected disassociation
* @dev: network device
* @buf: disassociation frame (header + body)
* @len: length of the frame data
*
* This function is called whenever a received Disassociation frame has been
* dropped in station mode because of MFP being used but the Disassociation
* frame was not protected. This function may sleep. * frame was not protected. This function may sleep.
*/ */
void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
size_t len); const u8 *buf, size_t len);
/** /**
* cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
......
...@@ -2155,7 +2155,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -2155,7 +2155,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
IEEE80211_MAX_QUEUE_MAP, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
cfg80211_send_deauth(sdata->dev, frame_buf, IEEE80211_DEAUTH_FRAME_LEN); cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
IEEE80211_DEAUTH_FRAME_LEN);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -2302,7 +2303,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2302,7 +2303,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
sdata_info(sdata, "%pM denied authentication (status %d)\n", sdata_info(sdata, "%pM denied authentication (status %d)\n",
mgmt->sa, status_code); mgmt->sa, status_code);
ieee80211_destroy_auth_data(sdata, false); ieee80211_destroy_auth_data(sdata, false);
cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return; return;
} }
...@@ -2337,7 +2338,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2337,7 +2338,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
* Report auth frame to user space for processing since another * Report auth frame to user space for processing since another
* round of Authentication frames is still needed. * round of Authentication frames is still needed.
*/ */
cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return; return;
} }
...@@ -2354,7 +2355,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, ...@@ -2354,7 +2355,7 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
} }
mutex_unlock(&sdata->local->sta_mtx); mutex_unlock(&sdata->local->sta_mtx);
cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
return; return;
out_err: out_err:
mutex_unlock(&sdata->local->sta_mtx); mutex_unlock(&sdata->local->sta_mtx);
...@@ -2387,7 +2388,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, ...@@ -2387,7 +2388,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, 0, 0, false, NULL); ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
} }
...@@ -2413,7 +2414,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -2413,7 +2414,7 @@ static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, 0, 0, false, NULL); ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, len); cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
} }
static void ieee80211_get_rates(struct ieee80211_supported_band *sband, 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,7 +2712,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
/* oops -- internal error -- send timeout for now */ /* oops -- internal error -- send timeout for now */
ieee80211_destroy_assoc_data(sdata, false); ieee80211_destroy_assoc_data(sdata, false);
cfg80211_put_bss(sdata->local->hw.wiphy, bss); cfg80211_put_bss(sdata->local->hw.wiphy, bss);
cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid); cfg80211_assoc_timeout(sdata->dev, mgmt->bssid);
return; return;
} }
sdata_info(sdata, "associated\n"); sdata_info(sdata, "associated\n");
...@@ -2724,7 +2725,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, ...@@ -2724,7 +2725,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
ieee80211_destroy_assoc_data(sdata, true); ieee80211_destroy_assoc_data(sdata, true);
} }
cfg80211_send_rx_assoc(sdata->dev, bss, (u8 *)mgmt, len); cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len);
} }
static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, 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,8 +3118,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
WLAN_REASON_DEAUTH_LEAVING, WLAN_REASON_DEAUTH_LEAVING,
true, deauth_buf); true, deauth_buf);
cfg80211_send_deauth(sdata->dev, deauth_buf, cfg80211_tx_mlme_mgmt(sdata->dev, deauth_buf,
sizeof(deauth_buf)); sizeof(deauth_buf));
return; return;
} }
...@@ -3236,7 +3237,8 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, ...@@ -3236,7 +3237,8 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
tx, frame_buf); tx, frame_buf);
cfg80211_send_deauth(sdata->dev, frame_buf, IEEE80211_DEAUTH_FRAME_LEN); cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
IEEE80211_DEAUTH_FRAME_LEN);
} }
static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) 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,7 +3429,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
ieee80211_destroy_auth_data(sdata, false); ieee80211_destroy_auth_data(sdata, false);
cfg80211_send_auth_timeout(sdata->dev, bssid); cfg80211_auth_timeout(sdata->dev, bssid);
} }
} 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);
...@@ -3443,7 +3445,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) ...@@ -3443,7 +3445,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
ieee80211_destroy_assoc_data(sdata, false); ieee80211_destroy_assoc_data(sdata, false);
cfg80211_send_assoc_timeout(sdata->dev, bssid); cfg80211_assoc_timeout(sdata->dev, bssid);
} }
} else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started) } else if (ifmgd->assoc_data && ifmgd->assoc_data->timeout_started)
run_again(sdata, ifmgd->assoc_data->timeout); run_again(sdata, ifmgd->assoc_data->timeout);
...@@ -3992,8 +3994,8 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -3992,8 +3994,8 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
WLAN_REASON_UNSPECIFIED, WLAN_REASON_UNSPECIFIED,
false, frame_buf); false, frame_buf);
cfg80211_send_deauth(sdata->dev, frame_buf, cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
sizeof(frame_buf)); sizeof(frame_buf));
} }
sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid); 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,8 +4057,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
WLAN_REASON_UNSPECIFIED, WLAN_REASON_UNSPECIFIED,
false, frame_buf); false, frame_buf);
cfg80211_send_deauth(sdata->dev, frame_buf, cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
sizeof(frame_buf)); sizeof(frame_buf));
} }
if (ifmgd->auth_data && !ifmgd->auth_data->done) { if (ifmgd->auth_data && !ifmgd->auth_data->done) {
...@@ -4309,8 +4311,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, ...@@ -4309,8 +4311,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
out: out:
if (report_frame) if (report_frame)
cfg80211_send_deauth(sdata->dev, frame_buf, cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
IEEE80211_DEAUTH_FRAME_LEN); IEEE80211_DEAUTH_FRAME_LEN);
return 0; return 0;
} }
...@@ -4340,8 +4342,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -4340,8 +4342,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
req->reason_code, !req->local_state_change, req->reason_code, !req->local_state_change,
frame_buf); frame_buf);
cfg80211_send_disassoc(sdata->dev, frame_buf, cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
IEEE80211_DEAUTH_FRAME_LEN); IEEE80211_DEAUTH_FRAME_LEN);
return 0; return 0;
} }
......
...@@ -1747,27 +1747,21 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx) ...@@ -1747,27 +1747,21 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
if (unlikely(!ieee80211_has_protected(fc) && if (unlikely(!ieee80211_has_protected(fc) &&
ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && ieee80211_is_unicast_robust_mgmt_frame(rx->skb) &&
rx->key)) { rx->key)) {
if (ieee80211_is_deauth(fc)) if (ieee80211_is_deauth(fc) ||
cfg80211_send_unprot_deauth(rx->sdata->dev, ieee80211_is_disassoc(fc))
rx->skb->data, cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
rx->skb->len); rx->skb->data,
else if (ieee80211_is_disassoc(fc)) rx->skb->len);
cfg80211_send_unprot_disassoc(rx->sdata->dev,
rx->skb->data,
rx->skb->len);
return -EACCES; return -EACCES;
} }
/* BIP does not use Protected field, so need to check MMIE */ /* BIP does not use Protected field, so need to check MMIE */
if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) && if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) &&
ieee80211_get_mmie_keyidx(rx->skb) < 0)) { ieee80211_get_mmie_keyidx(rx->skb) < 0)) {
if (ieee80211_is_deauth(fc)) if (ieee80211_is_deauth(fc) ||
cfg80211_send_unprot_deauth(rx->sdata->dev, ieee80211_is_disassoc(fc))
rx->skb->data, cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev,
rx->skb->len); rx->skb->data,
else if (ieee80211_is_disassoc(fc)) rx->skb->len);
cfg80211_send_unprot_disassoc(rx->sdata->dev,
rx->skb->data,
rx->skb->len);
return -EACCES; return -EACCES;
} }
/* /*
......
...@@ -18,20 +18,7 @@ ...@@ -18,20 +18,7 @@
#include "rdev-ops.h" #include "rdev-ops.h"
void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len) void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
trace_cfg80211_send_rx_auth(dev);
nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
cfg80211_sme_rx_auth(dev, buf, len);
}
EXPORT_SYMBOL(cfg80211_send_rx_auth);
void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
const u8 *buf, size_t len) const u8 *buf, size_t len)
{ {
u16 status_code; u16 status_code;
...@@ -84,10 +71,10 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, ...@@ -84,10 +71,10 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
status_code, status_code,
status_code == WLAN_STATUS_SUCCESS, bss); status_code == WLAN_STATUS_SUCCESS, bss);
} }
EXPORT_SYMBOL(cfg80211_send_rx_assoc); EXPORT_SYMBOL(cfg80211_rx_assoc_resp);
void cfg80211_send_deauth(struct net_device *dev, static void cfg80211_process_deauth(struct net_device *dev,
const u8 *buf, size_t len) const u8 *buf, size_t len)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy; struct wiphy *wiphy = wdev->wiphy;
...@@ -96,9 +83,6 @@ void cfg80211_send_deauth(struct net_device *dev, ...@@ -96,9 +83,6 @@ void cfg80211_send_deauth(struct net_device *dev,
const u8 *bssid = mgmt->bssid; const u8 *bssid = mgmt->bssid;
bool was_current = false; bool was_current = false;
trace_cfg80211_send_deauth(dev);
ASSERT_WDEV_LOCK(wdev);
if (wdev->current_bss && if (wdev->current_bss &&
ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) { ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
cfg80211_unhold_bss(wdev->current_bss); cfg80211_unhold_bss(wdev->current_bss);
...@@ -123,10 +107,9 @@ void cfg80211_send_deauth(struct net_device *dev, ...@@ -123,10 +107,9 @@ void cfg80211_send_deauth(struct net_device *dev,
false, NULL); false, NULL);
} }
} }
EXPORT_SYMBOL(cfg80211_send_deauth);
void cfg80211_send_disassoc(struct net_device *dev, static void cfg80211_process_disassoc(struct net_device *dev,
const u8 *buf, size_t len) const u8 *buf, size_t len)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy; struct wiphy *wiphy = wdev->wiphy;
...@@ -136,9 +119,6 @@ void cfg80211_send_disassoc(struct net_device *dev, ...@@ -136,9 +119,6 @@ void cfg80211_send_disassoc(struct net_device *dev,
u16 reason_code; u16 reason_code;
bool from_ap; bool from_ap;
trace_cfg80211_send_disassoc(dev);
ASSERT_WDEV_LOCK(wdev);
nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL); nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL);
if (wdev->sme_state != CFG80211_SME_CONNECTED) if (wdev->sme_state != CFG80211_SME_CONNECTED)
...@@ -153,15 +133,38 @@ void cfg80211_send_disassoc(struct net_device *dev, ...@@ -153,15 +133,38 @@ void cfg80211_send_disassoc(struct net_device *dev,
} else } else
WARN_ON(1); WARN_ON(1);
reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr); from_ap = !ether_addr_equal(mgmt->sa, dev->dev_addr);
__cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap); __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
} }
EXPORT_SYMBOL(cfg80211_send_disassoc);
void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr) void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct ieee80211_mgmt *mgmt = (void *)buf;
ASSERT_WDEV_LOCK(wdev);
trace_cfg80211_rx_mlme_mgmt(dev, buf, len);
if (WARN_ON(len < 2))
return;
if (ieee80211_is_auth(mgmt->frame_control)) {
nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
cfg80211_sme_rx_auth(dev, buf, len);
} else if (ieee80211_is_deauth(mgmt->frame_control)) {
cfg80211_process_deauth(dev, buf, len);
} else if (ieee80211_is_disassoc(mgmt->frame_control)) {
cfg80211_process_disassoc(dev, buf, len);
}
}
EXPORT_SYMBOL(cfg80211_rx_mlme_mgmt);
void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy; struct wiphy *wiphy = wdev->wiphy;
...@@ -175,9 +178,9 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr) ...@@ -175,9 +178,9 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
WLAN_STATUS_UNSPECIFIED_FAILURE, WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL); false, NULL);
} }
EXPORT_SYMBOL(cfg80211_send_auth_timeout); EXPORT_SYMBOL(cfg80211_auth_timeout);
void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr) void cfg80211_assoc_timeout(struct net_device *dev, const u8 *addr)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy; struct wiphy *wiphy = wdev->wiphy;
...@@ -191,7 +194,26 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr) ...@@ -191,7 +194,26 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
WLAN_STATUS_UNSPECIFIED_FAILURE, WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL); false, NULL);
} }
EXPORT_SYMBOL(cfg80211_send_assoc_timeout); EXPORT_SYMBOL(cfg80211_assoc_timeout);
void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct ieee80211_mgmt *mgmt = (void *)buf;
ASSERT_WDEV_LOCK(wdev);
trace_cfg80211_tx_mlme_mgmt(dev, buf, len);
if (WARN_ON(len < 2))
return;
if (ieee80211_is_deauth(mgmt->frame_control))
cfg80211_process_deauth(dev, buf, len);
else
cfg80211_process_disassoc(dev, buf, len);
}
EXPORT_SYMBOL(cfg80211_tx_mlme_mgmt);
void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
enum nl80211_key_type key_type, int key_id, enum nl80211_key_type key_type, int key_id,
......
...@@ -9313,31 +9313,27 @@ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, ...@@ -9313,31 +9313,27 @@ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
NL80211_CMD_DISASSOCIATE, gfp); NL80211_CMD_DISASSOCIATE, gfp);
} }
void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf,
size_t len) size_t len)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy; struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
const struct ieee80211_mgmt *mgmt = (void *)buf;
u32 cmd;
trace_cfg80211_send_unprot_deauth(dev); if (WARN_ON(len < 2))
nl80211_send_mlme_event(rdev, dev, buf, len, return;
NL80211_CMD_UNPROT_DEAUTHENTICATE, GFP_ATOMIC);
}
EXPORT_SYMBOL(cfg80211_send_unprot_deauth);
void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, if (ieee80211_is_deauth(mgmt->frame_control))
size_t len) cmd = NL80211_CMD_UNPROT_DEAUTHENTICATE;
{ else
struct wireless_dev *wdev = dev->ieee80211_ptr; cmd = NL80211_CMD_UNPROT_DISASSOCIATE;
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
trace_cfg80211_send_unprot_disassoc(dev); trace_cfg80211_rx_unprot_mlme_mgmt(dev, buf, len);
nl80211_send_mlme_event(rdev, dev, buf, len, nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC);
NL80211_CMD_UNPROT_DISASSOCIATE, GFP_ATOMIC);
} }
EXPORT_SYMBOL(cfg80211_send_unprot_disassoc); EXPORT_SYMBOL(cfg80211_rx_unprot_mlme_mgmt);
static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev,
struct net_device *netdev, int cmd, struct net_device *netdev, int cmd,
......
...@@ -1911,24 +1911,46 @@ TRACE_EVENT(cfg80211_send_rx_assoc, ...@@ -1911,24 +1911,46 @@ TRACE_EVENT(cfg80211_send_rx_assoc,
NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG) NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG)
); );
DEFINE_EVENT(netdev_evt_only, cfg80211_send_deauth, DECLARE_EVENT_CLASS(netdev_frame_event,
TP_PROTO(struct net_device *netdev), TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
TP_ARGS(netdev) TP_ARGS(netdev, buf, len),
TP_STRUCT__entry(
NETDEV_ENTRY
__dynamic_array(u8, frame, len)
),
TP_fast_assign(
NETDEV_ASSIGN;
memcpy(__get_dynamic_array(frame), buf, len);
),
TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x",
NETDEV_PR_ARG,
le16_to_cpup((__le16 *)__get_dynamic_array(frame)))
); );
DEFINE_EVENT(netdev_evt_only, cfg80211_send_disassoc, DEFINE_EVENT(netdev_frame_event, cfg80211_rx_unprot_mlme_mgmt,
TP_PROTO(struct net_device *netdev), TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
TP_ARGS(netdev) TP_ARGS(netdev, buf, len)
); );
DEFINE_EVENT(netdev_evt_only, cfg80211_send_unprot_deauth, DEFINE_EVENT(netdev_frame_event, cfg80211_rx_mlme_mgmt,
TP_PROTO(struct net_device *netdev), TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
TP_ARGS(netdev) TP_ARGS(netdev, buf, len)
); );
DEFINE_EVENT(netdev_evt_only, cfg80211_send_unprot_disassoc, TRACE_EVENT(cfg80211_tx_mlme_mgmt,
TP_PROTO(struct net_device *netdev), TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
TP_ARGS(netdev) TP_ARGS(netdev, buf, len),
TP_STRUCT__entry(
NETDEV_ENTRY
__dynamic_array(u8, frame, len)
),
TP_fast_assign(
NETDEV_ASSIGN;
memcpy(__get_dynamic_array(frame), buf, len);
),
TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x",
NETDEV_PR_ARG,
le16_to_cpup((__le16 *)__get_dynamic_array(frame)))
); );
DECLARE_EVENT_CLASS(netdev_mac_evt, DECLARE_EVENT_CLASS(netdev_mac_evt,
......
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