Commit ce470613 authored by Holger Schurig's avatar Holger Schurig Committed by John W. Linville

cfg80211: no cookies in cfg80211_send_XXX()

Get rid of cookies in cfg80211_send_XXX() functions.
Signed-off-by: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b54853f1
...@@ -1809,30 +1809,45 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); ...@@ -1809,30 +1809,45 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
* @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
* @cookie: cookie from ->deauth if called within that callback,
* %NULL otherwise
* *
* This function is called whenever deauthentication has been processed in * This function is called whenever deauthentication has been processed in
* station mode. This includes both received deauthentication frames and * station mode. This includes both received deauthentication frames and
* locally generated ones. This function may sleep. * locally generated ones. This function may sleep.
*/ */
void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
void *cookie);
/**
* __cfg80211_send_deauth - notification of processed deauthentication
* @dev: network device
* @buf: deauthentication frame (header + body)
* @len: length of the frame data
*
* Like cfg80211_send_deauth(), but doesn't take the wdev lock.
*/
void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
/** /**
* cfg80211_send_disassoc - notification of processed disassociation * cfg80211_send_disassoc - notification of processed disassociation
* @dev: network device * @dev: network device
* @buf: disassociation response frame (header + body) * @buf: disassociation response frame (header + body)
* @len: length of the frame data * @len: length of the frame data
* @cookie: cookie from ->disassoc if called within that callback,
* %NULL otherwise
* *
* This function is called whenever disassociation has been processed in * This function is called whenever disassociation has been processed in
* station mode. This includes both received disassociation frames and locally * station mode. This includes both received disassociation frames and locally
* generated ones. This function may sleep. * generated ones. This function may sleep.
*/ */
void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
void *cookie);
/**
* __cfg80211_send_disassoc - notification of processed disassociation
* @dev: network device
* @buf: disassociation response frame (header + body)
* @len: length of the frame data
*
* Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
*/
void __cfg80211_send_disassoc(struct net_device *dev, 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)
......
...@@ -458,9 +458,15 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -458,9 +458,15 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
mgmt->u.deauth.reason_code = cpu_to_le16(reason); mgmt->u.deauth.reason_code = cpu_to_le16(reason);
if (stype == IEEE80211_STYPE_DEAUTH) if (stype == IEEE80211_STYPE_DEAUTH)
cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, cookie); if (cookie)
__cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
else else
cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len, cookie); cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
else
if (cookie)
__cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
else
cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED); ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED);
} }
...@@ -1959,12 +1965,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, ...@@ -1959,12 +1965,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
/* no action */ /* no action */
break; break;
case RX_MGMT_CFG80211_DEAUTH: case RX_MGMT_CFG80211_DEAUTH:
cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
NULL);
break; break;
case RX_MGMT_CFG80211_DISASSOC: case RX_MGMT_CFG80211_DISASSOC:
cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len, cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
NULL);
break; break;
default: default:
WARN(1, "unexpected: %d", rma); WARN(1, "unexpected: %d", rma);
...@@ -2019,7 +2023,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, ...@@ -2019,7 +2023,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len); cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len);
break; break;
case RX_MGMT_CFG80211_DEAUTH: case RX_MGMT_CFG80211_DEAUTH:
cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, NULL); cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
break; break;
default: default:
WARN(1, "unexpected: %d", rma); WARN(1, "unexpected: %d", rma);
......
...@@ -121,7 +121,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len) ...@@ -121,7 +121,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
} }
EXPORT_SYMBOL(cfg80211_send_rx_assoc); EXPORT_SYMBOL(cfg80211_send_rx_assoc);
static void __cfg80211_send_deauth(struct net_device *dev, void __cfg80211_send_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;
...@@ -177,27 +177,19 @@ static void __cfg80211_send_deauth(struct net_device *dev, ...@@ -177,27 +177,19 @@ static void __cfg80211_send_deauth(struct net_device *dev,
false, NULL); false, NULL);
} }
} }
EXPORT_SYMBOL(__cfg80211_send_deauth);
void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len)
void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len,
void *cookie)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
BUG_ON(cookie && wdev != cookie);
if (cookie) {
/* called within callback */
__cfg80211_send_deauth(dev, buf, len);
} else {
wdev_lock(wdev); wdev_lock(wdev);
__cfg80211_send_deauth(dev, buf, len); __cfg80211_send_deauth(dev, buf, len);
wdev_unlock(wdev); wdev_unlock(wdev);
}
} }
EXPORT_SYMBOL(cfg80211_send_deauth); EXPORT_SYMBOL(cfg80211_send_deauth);
static void __cfg80211_send_disassoc(struct net_device *dev, void __cfg80211_send_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;
...@@ -238,22 +230,15 @@ static void __cfg80211_send_disassoc(struct net_device *dev, ...@@ -238,22 +230,15 @@ static void __cfg80211_send_disassoc(struct net_device *dev,
from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0; from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
__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_disassoc(struct net_device *dev, const u8 *buf, size_t len, void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len)
void *cookie)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
BUG_ON(cookie && wdev != cookie);
if (cookie) {
/* called within callback */
__cfg80211_send_disassoc(dev, buf, len);
} else {
wdev_lock(wdev); wdev_lock(wdev);
__cfg80211_send_disassoc(dev, buf, len); __cfg80211_send_disassoc(dev, buf, len);
wdev_unlock(wdev); wdev_unlock(wdev);
}
} }
EXPORT_SYMBOL(cfg80211_send_disassoc); EXPORT_SYMBOL(cfg80211_send_disassoc);
......
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