aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2009-10-13 07:28:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:16 -0400
commitce470613cdfde70f25419cc52a4816315825f5d9 (patch)
tree0b5d002515bdf4fc34452eb836c57278f27a826b
parentb54853f1b157a173fe5ac9145623670c66a9e7b9 (diff)
cfg80211: no cookies in cfg80211_send_XXX()
Get rid of cookies in cfg80211_send_XXX() functions. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/cfg80211.h31
-rw-r--r--net/mac80211/mlme.c18
-rw-r--r--net/wireless/mlme.c39
3 files changed, 46 insertions, 42 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 6f4862b3ec2c..ff67865de231 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1809,30 +1809,45 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1809 * @dev: network device 1809 * @dev: network device
1810 * @buf: deauthentication frame (header + body) 1810 * @buf: deauthentication frame (header + body)
1811 * @len: length of the frame data 1811 * @len: length of the frame data
1812 * @cookie: cookie from ->deauth if called within that callback,
1813 * %NULL otherwise
1814 * 1812 *
1815 * This function is called whenever deauthentication has been processed in 1813 * This function is called whenever deauthentication has been processed in
1816 * station mode. This includes both received deauthentication frames and 1814 * station mode. This includes both received deauthentication frames and
1817 * locally generated ones. This function may sleep. 1815 * locally generated ones. This function may sleep.
1818 */ 1816 */
1819void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, 1817void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
1820 void *cookie); 1818
1819/**
1820 * __cfg80211_send_deauth - notification of processed deauthentication
1821 * @dev: network device
1822 * @buf: deauthentication frame (header + body)
1823 * @len: length of the frame data
1824 *
1825 * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
1826 */
1827void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
1821 1828
1822/** 1829/**
1823 * cfg80211_send_disassoc - notification of processed disassociation 1830 * cfg80211_send_disassoc - notification of processed disassociation
1824 * @dev: network device 1831 * @dev: network device
1825 * @buf: disassociation response frame (header + body) 1832 * @buf: disassociation response frame (header + body)
1826 * @len: length of the frame data 1833 * @len: length of the frame data
1827 * @cookie: cookie from ->disassoc if called within that callback,
1828 * %NULL otherwise
1829 * 1834 *
1830 * This function is called whenever disassociation has been processed in 1835 * This function is called whenever disassociation has been processed in
1831 * station mode. This includes both received disassociation frames and locally 1836 * station mode. This includes both received disassociation frames and locally
1832 * generated ones. This function may sleep. 1837 * generated ones. This function may sleep.
1833 */ 1838 */
1834void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, 1839void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
1835 void *cookie); 1840
1841/**
1842 * __cfg80211_send_disassoc - notification of processed disassociation
1843 * @dev: network device
1844 * @buf: disassociation response frame (header + body)
1845 * @len: length of the frame data
1846 *
1847 * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
1848 */
1849void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf,
1850 size_t len);
1836 1851
1837/** 1852/**
1838 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1853 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 8d26e9bf8964..33a696f5f305 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -458,9 +458,15 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
458 mgmt->u.deauth.reason_code = cpu_to_le16(reason); 458 mgmt->u.deauth.reason_code = cpu_to_le16(reason);
459 459
460 if (stype == IEEE80211_STYPE_DEAUTH) 460 if (stype == IEEE80211_STYPE_DEAUTH)
461 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, cookie); 461 if (cookie)
462 __cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
463 else
464 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
462 else 465 else
463 cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len, cookie); 466 if (cookie)
467 __cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
468 else
469 cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
464 ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED); 470 ieee80211_tx_skb(sdata, skb, ifmgd->flags & IEEE80211_STA_MFP_ENABLED);
465} 471}
466 472
@@ -1959,12 +1965,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1959 /* no action */ 1965 /* no action */
1960 break; 1966 break;
1961 case RX_MGMT_CFG80211_DEAUTH: 1967 case RX_MGMT_CFG80211_DEAUTH:
1962 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, 1968 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
1963 NULL);
1964 break; 1969 break;
1965 case RX_MGMT_CFG80211_DISASSOC: 1970 case RX_MGMT_CFG80211_DISASSOC:
1966 cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len, 1971 cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len);
1967 NULL);
1968 break; 1972 break;
1969 default: 1973 default:
1970 WARN(1, "unexpected: %d", rma); 1974 WARN(1, "unexpected: %d", rma);
@@ -2019,7 +2023,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
2019 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len); 2023 cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len);
2020 break; 2024 break;
2021 case RX_MGMT_CFG80211_DEAUTH: 2025 case RX_MGMT_CFG80211_DEAUTH:
2022 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, NULL); 2026 cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len);
2023 break; 2027 break;
2024 default: 2028 default:
2025 WARN(1, "unexpected: %d", rma); 2029 WARN(1, "unexpected: %d", rma);
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index ceb2c14c8f47..a13a71205240 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -121,7 +121,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
121} 121}
122EXPORT_SYMBOL(cfg80211_send_rx_assoc); 122EXPORT_SYMBOL(cfg80211_send_rx_assoc);
123 123
124static void __cfg80211_send_deauth(struct net_device *dev, 124void __cfg80211_send_deauth(struct net_device *dev,
125 const u8 *buf, size_t len) 125 const u8 *buf, size_t len)
126{ 126{
127 struct wireless_dev *wdev = dev->ieee80211_ptr; 127 struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -177,27 +177,19 @@ static void __cfg80211_send_deauth(struct net_device *dev,
177 false, NULL); 177 false, NULL);
178 } 178 }
179} 179}
180EXPORT_SYMBOL(__cfg80211_send_deauth);
180 181
181 182void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len)
182void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len,
183 void *cookie)
184{ 183{
185 struct wireless_dev *wdev = dev->ieee80211_ptr; 184 struct wireless_dev *wdev = dev->ieee80211_ptr;
186 185
187 BUG_ON(cookie && wdev != cookie); 186 wdev_lock(wdev);
188 187 __cfg80211_send_deauth(dev, buf, len);
189 if (cookie) { 188 wdev_unlock(wdev);
190 /* called within callback */
191 __cfg80211_send_deauth(dev, buf, len);
192 } else {
193 wdev_lock(wdev);
194 __cfg80211_send_deauth(dev, buf, len);
195 wdev_unlock(wdev);
196 }
197} 189}
198EXPORT_SYMBOL(cfg80211_send_deauth); 190EXPORT_SYMBOL(cfg80211_send_deauth);
199 191
200static void __cfg80211_send_disassoc(struct net_device *dev, 192void __cfg80211_send_disassoc(struct net_device *dev,
201 const u8 *buf, size_t len) 193 const u8 *buf, size_t len)
202{ 194{
203 struct wireless_dev *wdev = dev->ieee80211_ptr; 195 struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -238,22 +230,15 @@ static void __cfg80211_send_disassoc(struct net_device *dev,
238 from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0; 230 from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
239 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap); 231 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
240} 232}
233EXPORT_SYMBOL(__cfg80211_send_disassoc);
241 234
242void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, 235void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len)
243 void *cookie)
244{ 236{
245 struct wireless_dev *wdev = dev->ieee80211_ptr; 237 struct wireless_dev *wdev = dev->ieee80211_ptr;
246 238
247 BUG_ON(cookie && wdev != cookie); 239 wdev_lock(wdev);
248 240 __cfg80211_send_disassoc(dev, buf, len);
249 if (cookie) { 241 wdev_unlock(wdev);
250 /* called within callback */
251 __cfg80211_send_disassoc(dev, buf, len);
252 } else {
253 wdev_lock(wdev);
254 __cfg80211_send_disassoc(dev, buf, len);
255 wdev_unlock(wdev);
256 }
257} 242}
258EXPORT_SYMBOL(cfg80211_send_disassoc); 243EXPORT_SYMBOL(cfg80211_send_disassoc);
259 244