diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 15:26:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:51 -0400 |
commit | f21293549f60f88c74fcb9944737f11048896dc4 (patch) | |
tree | d4a00663f87816c0c742e74d7b2c9bad31a18816 /net/wireless/sme.c | |
parent | 6829c878ecd24ff0ae41b4668c7e9d0f11b66942 (diff) |
cfg80211: managed mode wext compatibility
This adds code to make it possible to use the cfg80211
connect() API with wireless extensions, and because the
previous patch added emulation of that API with auth()
and assoc(), by extension also supports wext on that.
At the same time, removes code from mac80211 for wext,
but doesn't yet clean up mac80211's mlme code more.
Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/sme.c')
-rw-r--r-- | net/wireless/sme.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 3abb04729873..f272ebf94303 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -273,10 +273,10 @@ void cfg80211_sme_rx_auth(struct net_device *dev, const u8 *buf, size_t len) | |||
273 | } | 273 | } |
274 | } | 274 | } |
275 | 275 | ||
276 | void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | 276 | static void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, |
277 | const u8 *req_ie, size_t req_ie_len, | 277 | const u8 *req_ie, size_t req_ie_len, |
278 | const u8 *resp_ie, size_t resp_ie_len, | 278 | const u8 *resp_ie, size_t resp_ie_len, |
279 | u16 status, gfp_t gfp) | 279 | u16 status, bool wextev, gfp_t gfp) |
280 | { | 280 | { |
281 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 281 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
282 | struct cfg80211_bss *bss; | 282 | struct cfg80211_bss *bss; |
@@ -321,25 +321,36 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
321 | status, gfp); | 321 | status, gfp); |
322 | 322 | ||
323 | #ifdef CONFIG_WIRELESS_EXT | 323 | #ifdef CONFIG_WIRELESS_EXT |
324 | if (req_ie && status == WLAN_STATUS_SUCCESS) { | 324 | if (wextev) { |
325 | memset(&wrqu, 0, sizeof(wrqu)); | 325 | if (req_ie && status == WLAN_STATUS_SUCCESS) { |
326 | wrqu.data.length = req_ie_len; | 326 | memset(&wrqu, 0, sizeof(wrqu)); |
327 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, req_ie); | 327 | wrqu.data.length = req_ie_len; |
328 | } | 328 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, req_ie); |
329 | } | ||
330 | |||
331 | if (resp_ie && status == WLAN_STATUS_SUCCESS) { | ||
332 | memset(&wrqu, 0, sizeof(wrqu)); | ||
333 | wrqu.data.length = resp_ie_len; | ||
334 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, resp_ie); | ||
335 | } | ||
329 | 336 | ||
330 | if (resp_ie && status == WLAN_STATUS_SUCCESS) { | ||
331 | memset(&wrqu, 0, sizeof(wrqu)); | 337 | memset(&wrqu, 0, sizeof(wrqu)); |
332 | wrqu.data.length = resp_ie_len; | 338 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
333 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, resp_ie); | 339 | if (bssid && status == WLAN_STATUS_SUCCESS) |
340 | memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN); | ||
341 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | ||
334 | } | 342 | } |
335 | |||
336 | memset(&wrqu, 0, sizeof(wrqu)); | ||
337 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
338 | if (bssid && status == WLAN_STATUS_SUCCESS) | ||
339 | memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN); | ||
340 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | ||
341 | #endif | 343 | #endif |
342 | } | 344 | } |
345 | |||
346 | void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | ||
347 | const u8 *req_ie, size_t req_ie_len, | ||
348 | const u8 *resp_ie, size_t resp_ie_len, | ||
349 | u16 status, gfp_t gfp) | ||
350 | { | ||
351 | bool wextev = status == WLAN_STATUS_SUCCESS; | ||
352 | __cfg80211_connect_result(dev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, wextev, gfp); | ||
353 | } | ||
343 | EXPORT_SYMBOL(cfg80211_connect_result); | 354 | EXPORT_SYMBOL(cfg80211_connect_result); |
344 | 355 | ||
345 | void cfg80211_roamed(struct net_device *dev, const u8 *bssid, | 356 | void cfg80211_roamed(struct net_device *dev, const u8 *bssid, |
@@ -540,7 +551,7 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
540 | } | 551 | } |
541 | 552 | ||
542 | int cfg80211_disconnect(struct cfg80211_registered_device *rdev, | 553 | int cfg80211_disconnect(struct cfg80211_registered_device *rdev, |
543 | struct net_device *dev, u16 reason) | 554 | struct net_device *dev, u16 reason, bool wextev) |
544 | { | 555 | { |
545 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 556 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
546 | int err; | 557 | int err; |
@@ -585,9 +596,9 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev, | |||
585 | if (wdev->sme_state == CFG80211_SME_CONNECTED) | 596 | if (wdev->sme_state == CFG80211_SME_CONNECTED) |
586 | __cfg80211_disconnected(dev, GFP_KERNEL, NULL, 0, 0, false); | 597 | __cfg80211_disconnected(dev, GFP_KERNEL, NULL, 0, 0, false); |
587 | else if (wdev->sme_state == CFG80211_SME_CONNECTING) | 598 | else if (wdev->sme_state == CFG80211_SME_CONNECTING) |
588 | cfg80211_connect_result(dev, NULL, NULL, 0, NULL, 0, | 599 | __cfg80211_connect_result(dev, NULL, NULL, 0, NULL, 0, |
589 | WLAN_STATUS_UNSPECIFIED_FAILURE, | 600 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
590 | GFP_KERNEL); | 601 | wextev, GFP_KERNEL); |
591 | 602 | ||
592 | return 0; | 603 | return 0; |
593 | } | 604 | } |