aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-19 13:57:45 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:17 -0400
commit691597cb26f236ac7471f1adf925a134c86799d6 (patch)
treee89d91e496af082711b7c0789aaf0a985e7ba964
parentd726405af6c8c81d2ee5e6a29301c68b9d4c574f (diff)
cfg80211/mac80211: move wext SIWMLME into cfg80211
Since we have ->deauth and ->disassoc we can support the wext SIWMLME call directly without driver wext handlers. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/cfg80211.h3
-rw-r--r--net/mac80211/cfg.c12
-rw-r--r--net/mac80211/mlme.c6
-rw-r--r--net/mac80211/wext.c25
-rw-r--r--net/wireless/wext-compat.c46
5 files changed, 53 insertions, 39 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d303c269a693..019a41efa0bb 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -833,6 +833,9 @@ int cfg80211_wext_siwscan(struct net_device *dev,
833int cfg80211_wext_giwscan(struct net_device *dev, 833int cfg80211_wext_giwscan(struct net_device *dev,
834 struct iw_request_info *info, 834 struct iw_request_info *info,
835 struct iw_point *data, char *extra); 835 struct iw_point *data, char *extra);
836int cfg80211_wext_siwmlme(struct net_device *dev,
837 struct iw_request_info *info,
838 struct iw_point *data, char *extra);
836int cfg80211_wext_giwrange(struct net_device *dev, 839int cfg80211_wext_giwrange(struct net_device *dev,
837 struct iw_request_info *info, 840 struct iw_request_info *info,
838 struct iw_point *data, char *extra); 841 struct iw_point *data, char *extra);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 520efa8a0791..daf75287e92a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1268,22 +1268,18 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1268static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev, 1268static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev,
1269 struct cfg80211_deauth_request *req) 1269 struct cfg80211_deauth_request *req)
1270{ 1270{
1271 struct ieee80211_sub_if_data *sdata; 1271 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1272
1273 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1274 1272
1275 /* TODO: req->ie */ 1273 /* TODO: req->ie, req->peer_addr */
1276 return ieee80211_sta_deauthenticate(sdata, req->reason_code); 1274 return ieee80211_sta_deauthenticate(sdata, req->reason_code);
1277} 1275}
1278 1276
1279static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev, 1277static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
1280 struct cfg80211_disassoc_request *req) 1278 struct cfg80211_disassoc_request *req)
1281{ 1279{
1282 struct ieee80211_sub_if_data *sdata; 1280 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1283
1284 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1285 1281
1286 /* TODO: req->ie */ 1282 /* TODO: req->ie, req->peer_addr */
1287 return ieee80211_sta_disassociate(sdata, req->reason_code); 1283 return ieee80211_sta_disassociate(sdata, req->reason_code);
1288} 1284}
1289 1285
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a16c9d724be1..428742d7f440 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2338,9 +2338,6 @@ int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason
2338 printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", 2338 printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n",
2339 sdata->dev->name, reason); 2339 sdata->dev->name, reason);
2340 2340
2341 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2342 return -EINVAL;
2343
2344 ieee80211_set_disassoc(sdata, true, true, reason); 2341 ieee80211_set_disassoc(sdata, true, true, reason);
2345 return 0; 2342 return 0;
2346} 2343}
@@ -2352,9 +2349,6 @@ int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason)
2352 printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", 2349 printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n",
2353 sdata->dev->name, reason); 2350 sdata->dev->name, reason);
2354 2351
2355 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2356 return -EINVAL;
2357
2358 if (!(ifmgd->flags & IEEE80211_STA_ASSOCIATED)) 2352 if (!(ifmgd->flags & IEEE80211_STA_ASSOCIATED))
2359 return -ENOLINK; 2353 return -ENOLINK;
2360 2354
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 1c4664b8b1a0..896704cf94e1 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -612,29 +612,6 @@ static int ieee80211_ioctl_giwretry(struct net_device *dev,
612 return 0; 612 return 0;
613} 613}
614 614
615static int ieee80211_ioctl_siwmlme(struct net_device *dev,
616 struct iw_request_info *info,
617 struct iw_point *data, char *extra)
618{
619 struct ieee80211_sub_if_data *sdata;
620 struct iw_mlme *mlme = (struct iw_mlme *) extra;
621
622 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
623 if (!(sdata->vif.type == NL80211_IFTYPE_STATION))
624 return -EINVAL;
625
626 switch (mlme->cmd) {
627 case IW_MLME_DEAUTH:
628 /* TODO: mlme->addr.sa_data */
629 return ieee80211_sta_deauthenticate(sdata, mlme->reason_code);
630 case IW_MLME_DISASSOC:
631 /* TODO: mlme->addr.sa_data */
632 return ieee80211_sta_disassociate(sdata, mlme->reason_code);
633 default:
634 return -EOPNOTSUPP;
635 }
636}
637
638 615
639static int ieee80211_ioctl_siwencode(struct net_device *dev, 616static int ieee80211_ioctl_siwencode(struct net_device *dev,
640 struct iw_request_info *info, 617 struct iw_request_info *info,
@@ -1076,7 +1053,7 @@ static const iw_handler ieee80211_handler[] =
1076 (iw_handler) NULL, /* SIOCGIWTHRSPY */ 1053 (iw_handler) NULL, /* SIOCGIWTHRSPY */
1077 (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */ 1054 (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
1078 (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */ 1055 (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
1079 (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */ 1056 (iw_handler) cfg80211_wext_siwmlme, /* SIOCSIWMLME */
1080 (iw_handler) NULL, /* SIOCGIWAPLIST */ 1057 (iw_handler) NULL, /* SIOCGIWAPLIST */
1081 (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */ 1058 (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */
1082 (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */ 1059 (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 0fd1db6e95bb..6fd7bf7b4481 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/wireless.h> 11#include <linux/wireless.h>
12#include <linux/nl80211.h> 12#include <linux/nl80211.h>
13#include <linux/if_arp.h>
13#include <net/iw_handler.h> 14#include <net/iw_handler.h>
14#include <net/wireless.h> 15#include <net/wireless.h>
15#include <net/cfg80211.h> 16#include <net/cfg80211.h>
@@ -206,7 +207,6 @@ int cfg80211_wext_giwrange(struct net_device *dev,
206 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | 207 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
207 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; 208 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
208 209
209
210 for (band = 0; band < IEEE80211_NUM_BANDS; band ++) { 210 for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
211 int i; 211 int i;
212 struct ieee80211_supported_band *sband; 212 struct ieee80211_supported_band *sband;
@@ -241,3 +241,47 @@ int cfg80211_wext_giwrange(struct net_device *dev,
241 return 0; 241 return 0;
242} 242}
243EXPORT_SYMBOL(cfg80211_wext_giwrange); 243EXPORT_SYMBOL(cfg80211_wext_giwrange);
244
245int cfg80211_wext_siwmlme(struct net_device *dev,
246 struct iw_request_info *info,
247 struct iw_point *data, char *extra)
248{
249 struct wireless_dev *wdev = dev->ieee80211_ptr;
250 struct iw_mlme *mlme = (struct iw_mlme *)extra;
251 struct cfg80211_registered_device *rdev;
252 union {
253 struct cfg80211_disassoc_request disassoc;
254 struct cfg80211_deauth_request deauth;
255 } cmd;
256
257 if (!wdev)
258 return -EOPNOTSUPP;
259
260 rdev = wiphy_to_dev(wdev->wiphy);
261
262 if (wdev->iftype != NL80211_IFTYPE_STATION)
263 return -EINVAL;
264
265 if (mlme->addr.sa_family != ARPHRD_ETHER)
266 return -EINVAL;
267
268 memset(&cmd, 0, sizeof(cmd));
269
270 switch (mlme->cmd) {
271 case IW_MLME_DEAUTH:
272 if (!rdev->ops->deauth)
273 return -EOPNOTSUPP;
274 cmd.deauth.peer_addr = mlme->addr.sa_data;
275 cmd.deauth.reason_code = mlme->reason_code;
276 return rdev->ops->deauth(wdev->wiphy, dev, &cmd.deauth);
277 case IW_MLME_DISASSOC:
278 if (!rdev->ops->disassoc)
279 return -EOPNOTSUPP;
280 cmd.disassoc.peer_addr = mlme->addr.sa_data;
281 cmd.disassoc.reason_code = mlme->reason_code;
282 return rdev->ops->disassoc(wdev->wiphy, dev, &cmd.disassoc);
283 default:
284 return -EOPNOTSUPP;
285 }
286}
287EXPORT_SYMBOL(cfg80211_wext_siwmlme);