aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-12-18 19:31:27 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:37 -0500
commit51fb61e76d952e6bc2fbdd9f0d38425fbab1cf31 (patch)
tree09618b395aae1b91fbc8dec7ea9397a9654a9f0f /net/mac80211/ieee80211_ioctl.c
parent32bfd35d4b63bd63de4bb0d791ef049c3c868726 (diff)
mac80211: move interface type to vif structure
Drivers that support mixed AP/STA operation may well need to know the type of a virtual interface when iterating over them. The easiest way to support that is to move the interface type variable into the vif structure. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r--net/mac80211/ieee80211_ioctl.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 2604e21c05a8..5024d3733834 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -112,8 +112,8 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
112 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) 112 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
113 return -EOPNOTSUPP; 113 return -EOPNOTSUPP;
114 114
115 if (sdata->type == IEEE80211_IF_TYPE_STA || 115 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
116 sdata->type == IEEE80211_IF_TYPE_IBSS) { 116 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
117 int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); 117 int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
118 if (ret) 118 if (ret)
119 return ret; 119 return ret;
@@ -232,7 +232,7 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev,
232 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 232 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
233 int type; 233 int type;
234 234
235 if (sdata->type == IEEE80211_IF_TYPE_VLAN) 235 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
236 return -EOPNOTSUPP; 236 return -EOPNOTSUPP;
237 237
238 switch (*mode) { 238 switch (*mode) {
@@ -249,7 +249,7 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev,
249 return -EINVAL; 249 return -EINVAL;
250 } 250 }
251 251
252 if (type == sdata->type) 252 if (type == sdata->vif.type)
253 return 0; 253 return 0;
254 if (netif_running(dev)) 254 if (netif_running(dev))
255 return -EBUSY; 255 return -EBUSY;
@@ -268,7 +268,7 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
268 struct ieee80211_sub_if_data *sdata; 268 struct ieee80211_sub_if_data *sdata;
269 269
270 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 270 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
271 switch (sdata->type) { 271 switch (sdata->vif.type) {
272 case IEEE80211_IF_TYPE_AP: 272 case IEEE80211_IF_TYPE_AP:
273 *mode = IW_MODE_MASTER; 273 *mode = IW_MODE_MASTER;
274 break; 274 break;
@@ -336,13 +336,13 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
336 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 336 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
337 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 337 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
338 338
339 if (sdata->type == IEEE80211_IF_TYPE_STA) 339 if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
340 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; 340 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
341 341
342 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ 342 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
343 if (freq->e == 0) { 343 if (freq->e == 0) {
344 if (freq->m < 0) { 344 if (freq->m < 0) {
345 if (sdata->type == IEEE80211_IF_TYPE_STA) 345 if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
346 sdata->u.sta.flags |= 346 sdata->u.sta.flags |=
347 IEEE80211_STA_AUTO_CHANNEL_SEL; 347 IEEE80211_STA_AUTO_CHANNEL_SEL;
348 return 0; 348 return 0;
@@ -388,8 +388,8 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
388 len--; 388 len--;
389 389
390 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 390 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
391 if (sdata->type == IEEE80211_IF_TYPE_STA || 391 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
392 sdata->type == IEEE80211_IF_TYPE_IBSS) { 392 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
393 int ret; 393 int ret;
394 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { 394 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
395 if (len > IEEE80211_MAX_SSID_LEN) 395 if (len > IEEE80211_MAX_SSID_LEN)
@@ -409,7 +409,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
409 return 0; 409 return 0;
410 } 410 }
411 411
412 if (sdata->type == IEEE80211_IF_TYPE_AP) { 412 if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
413 memcpy(sdata->u.ap.ssid, ssid, len); 413 memcpy(sdata->u.ap.ssid, ssid, len);
414 memset(sdata->u.ap.ssid + len, 0, 414 memset(sdata->u.ap.ssid + len, 0,
415 IEEE80211_MAX_SSID_LEN - len); 415 IEEE80211_MAX_SSID_LEN - len);
@@ -428,8 +428,8 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
428 428
429 struct ieee80211_sub_if_data *sdata; 429 struct ieee80211_sub_if_data *sdata;
430 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 430 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
431 if (sdata->type == IEEE80211_IF_TYPE_STA || 431 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
432 sdata->type == IEEE80211_IF_TYPE_IBSS) { 432 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
433 int res = ieee80211_sta_get_ssid(dev, ssid, &len); 433 int res = ieee80211_sta_get_ssid(dev, ssid, &len);
434 if (res == 0) { 434 if (res == 0) {
435 data->length = len; 435 data->length = len;
@@ -439,7 +439,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
439 return res; 439 return res;
440 } 440 }
441 441
442 if (sdata->type == IEEE80211_IF_TYPE_AP) { 442 if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
443 len = sdata->u.ap.ssid_len; 443 len = sdata->u.ap.ssid_len;
444 if (len > IW_ESSID_MAX_SIZE) 444 if (len > IW_ESSID_MAX_SIZE)
445 len = IW_ESSID_MAX_SIZE; 445 len = IW_ESSID_MAX_SIZE;
@@ -459,8 +459,8 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
459 struct ieee80211_sub_if_data *sdata; 459 struct ieee80211_sub_if_data *sdata;
460 460
461 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 461 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
462 if (sdata->type == IEEE80211_IF_TYPE_STA || 462 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
463 sdata->type == IEEE80211_IF_TYPE_IBSS) { 463 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
464 int ret; 464 int ret;
465 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { 465 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
466 memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, 466 memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data,
@@ -479,7 +479,7 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
479 return ret; 479 return ret;
480 ieee80211_sta_req_auth(dev, &sdata->u.sta); 480 ieee80211_sta_req_auth(dev, &sdata->u.sta);
481 return 0; 481 return 0;
482 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) { 482 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
483 if (memcmp(sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data, 483 if (memcmp(sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
484 ETH_ALEN) == 0) 484 ETH_ALEN) == 0)
485 return 0; 485 return 0;
@@ -497,12 +497,12 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
497 struct ieee80211_sub_if_data *sdata; 497 struct ieee80211_sub_if_data *sdata;
498 498
499 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 499 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
500 if (sdata->type == IEEE80211_IF_TYPE_STA || 500 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
501 sdata->type == IEEE80211_IF_TYPE_IBSS) { 501 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
502 ap_addr->sa_family = ARPHRD_ETHER; 502 ap_addr->sa_family = ARPHRD_ETHER;
503 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); 503 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
504 return 0; 504 return 0;
505 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) { 505 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
506 ap_addr->sa_family = ARPHRD_ETHER; 506 ap_addr->sa_family = ARPHRD_ETHER;
507 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); 507 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
508 return 0; 508 return 0;
@@ -524,11 +524,10 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
524 if (!netif_running(dev)) 524 if (!netif_running(dev))
525 return -ENETDOWN; 525 return -ENETDOWN;
526 526
527 if (sdata->type != IEEE80211_IF_TYPE_STA && 527 if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
528 sdata->type != IEEE80211_IF_TYPE_IBSS && 528 sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
529 sdata->type != IEEE80211_IF_TYPE_AP) { 529 sdata->vif.type != IEEE80211_IF_TYPE_AP)
530 return -EOPNOTSUPP; 530 return -EOPNOTSUPP;
531 }
532 531
533 /* if SSID was specified explicitly then use that */ 532 /* if SSID was specified explicitly then use that */
534 if (wrqu->data.length == sizeof(struct iw_scan_req) && 533 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
@@ -606,7 +605,7 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev,
606 struct ieee80211_sub_if_data *sdata; 605 struct ieee80211_sub_if_data *sdata;
607 606
608 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 607 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
609 if (sdata->type == IEEE80211_IF_TYPE_STA) 608 if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
610 sta = sta_info_get(local, sdata->u.sta.bssid); 609 sta = sta_info_get(local, sdata->u.sta.bssid);
611 else 610 else
612 return -EOPNOTSUPP; 611 return -EOPNOTSUPP;
@@ -820,8 +819,8 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev,
820 struct iw_mlme *mlme = (struct iw_mlme *) extra; 819 struct iw_mlme *mlme = (struct iw_mlme *) extra;
821 820
822 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 821 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
823 if (sdata->type != IEEE80211_IF_TYPE_STA && 822 if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
824 sdata->type != IEEE80211_IF_TYPE_IBSS) 823 sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
825 return -EINVAL; 824 return -EINVAL;
826 825
827 switch (mlme->cmd) { 826 switch (mlme->cmd) {
@@ -938,7 +937,7 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
938 sdata->drop_unencrypted = !!data->value; 937 sdata->drop_unencrypted = !!data->value;
939 break; 938 break;
940 case IW_AUTH_PRIVACY_INVOKED: 939 case IW_AUTH_PRIVACY_INVOKED:
941 if (sdata->type != IEEE80211_IF_TYPE_STA) 940 if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
942 ret = -EINVAL; 941 ret = -EINVAL;
943 else { 942 else {
944 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; 943 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
@@ -953,8 +952,8 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
953 } 952 }
954 break; 953 break;
955 case IW_AUTH_80211_AUTH_ALG: 954 case IW_AUTH_80211_AUTH_ALG:
956 if (sdata->type == IEEE80211_IF_TYPE_STA || 955 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
957 sdata->type == IEEE80211_IF_TYPE_IBSS) 956 sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
958 sdata->u.sta.auth_algs = data->value; 957 sdata->u.sta.auth_algs = data->value;
959 else 958 else
960 ret = -EOPNOTSUPP; 959 ret = -EOPNOTSUPP;
@@ -974,8 +973,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev
974 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 973 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
975 struct sta_info *sta = NULL; 974 struct sta_info *sta = NULL;
976 975
977 if (sdata->type == IEEE80211_IF_TYPE_STA || 976 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
978 sdata->type == IEEE80211_IF_TYPE_IBSS) 977 sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
979 sta = sta_info_get(local, sdata->u.sta.bssid); 978 sta = sta_info_get(local, sdata->u.sta.bssid);
980 if (!sta) { 979 if (!sta) {
981 wstats->discard.fragment = 0; 980 wstats->discard.fragment = 0;
@@ -1003,8 +1002,8 @@ static int ieee80211_ioctl_giwauth(struct net_device *dev,
1003 1002
1004 switch (data->flags & IW_AUTH_INDEX) { 1003 switch (data->flags & IW_AUTH_INDEX) {
1005 case IW_AUTH_80211_AUTH_ALG: 1004 case IW_AUTH_80211_AUTH_ALG:
1006 if (sdata->type == IEEE80211_IF_TYPE_STA || 1005 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
1007 sdata->type == IEEE80211_IF_TYPE_IBSS) 1006 sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
1008 data->value = sdata->u.sta.auth_algs; 1007 data->value = sdata->u.sta.auth_algs;
1009 else 1008 else
1010 ret = -EOPNOTSUPP; 1009 ret = -EOPNOTSUPP;