diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-09-10 18:01:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-15 16:48:23 -0400 |
commit | 05c914fe330fa8e1cc67870dc0d3809dfd96c107 (patch) | |
tree | df53bcab47335f3361c09478d6b1447b7d298536 /net/mac80211/wext.c | |
parent | 96dd22ac06b0dbfb069fdf530c72046a941e9694 (diff) |
mac80211: use nl80211 interface types
There's really no reason for mac80211 to be using its
own interface type defines. Use the nl80211 types and
simplify the configuration code a bit: there's no need
to translate them any more now.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 77b68ed8b832..aef9707700fd 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -122,8 +122,8 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev, | |||
122 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) | 122 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) |
123 | return -EOPNOTSUPP; | 123 | return -EOPNOTSUPP; |
124 | 124 | ||
125 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 125 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
126 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 126 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
127 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); | 127 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); |
128 | if (ret) | 128 | if (ret) |
129 | return ret; | 129 | return ret; |
@@ -273,21 +273,21 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev, | |||
273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
274 | int type; | 274 | int type; |
275 | 275 | ||
276 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | 276 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
277 | return -EOPNOTSUPP; | 277 | return -EOPNOTSUPP; |
278 | 278 | ||
279 | switch (*mode) { | 279 | switch (*mode) { |
280 | case IW_MODE_INFRA: | 280 | case IW_MODE_INFRA: |
281 | type = IEEE80211_IF_TYPE_STA; | 281 | type = NL80211_IFTYPE_STATION; |
282 | break; | 282 | break; |
283 | case IW_MODE_ADHOC: | 283 | case IW_MODE_ADHOC: |
284 | type = IEEE80211_IF_TYPE_IBSS; | 284 | type = NL80211_IFTYPE_ADHOC; |
285 | break; | 285 | break; |
286 | case IW_MODE_REPEAT: | 286 | case IW_MODE_REPEAT: |
287 | type = IEEE80211_IF_TYPE_WDS; | 287 | type = NL80211_IFTYPE_WDS; |
288 | break; | 288 | break; |
289 | case IW_MODE_MONITOR: | 289 | case IW_MODE_MONITOR: |
290 | type = IEEE80211_IF_TYPE_MNTR; | 290 | type = NL80211_IFTYPE_MONITOR; |
291 | break; | 291 | break; |
292 | default: | 292 | default: |
293 | return -EINVAL; | 293 | return -EINVAL; |
@@ -305,22 +305,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
305 | 305 | ||
306 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 306 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
307 | switch (sdata->vif.type) { | 307 | switch (sdata->vif.type) { |
308 | case IEEE80211_IF_TYPE_AP: | 308 | case NL80211_IFTYPE_AP: |
309 | *mode = IW_MODE_MASTER; | 309 | *mode = IW_MODE_MASTER; |
310 | break; | 310 | break; |
311 | case IEEE80211_IF_TYPE_STA: | 311 | case NL80211_IFTYPE_STATION: |
312 | *mode = IW_MODE_INFRA; | 312 | *mode = IW_MODE_INFRA; |
313 | break; | 313 | break; |
314 | case IEEE80211_IF_TYPE_IBSS: | 314 | case NL80211_IFTYPE_ADHOC: |
315 | *mode = IW_MODE_ADHOC; | 315 | *mode = IW_MODE_ADHOC; |
316 | break; | 316 | break; |
317 | case IEEE80211_IF_TYPE_MNTR: | 317 | case NL80211_IFTYPE_MONITOR: |
318 | *mode = IW_MODE_MONITOR; | 318 | *mode = IW_MODE_MONITOR; |
319 | break; | 319 | break; |
320 | case IEEE80211_IF_TYPE_WDS: | 320 | case NL80211_IFTYPE_WDS: |
321 | *mode = IW_MODE_REPEAT; | 321 | *mode = IW_MODE_REPEAT; |
322 | break; | 322 | break; |
323 | case IEEE80211_IF_TYPE_VLAN: | 323 | case NL80211_IFTYPE_AP_VLAN: |
324 | *mode = IW_MODE_SECOND; /* FIXME */ | 324 | *mode = IW_MODE_SECOND; /* FIXME */ |
325 | break; | 325 | break; |
326 | default: | 326 | default: |
@@ -336,13 +336,13 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
336 | { | 336 | { |
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->vif.type == IEEE80211_IF_TYPE_STA) | 339 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
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->vif.type == IEEE80211_IF_TYPE_STA) | 345 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
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; |
@@ -386,8 +386,8 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
386 | len--; | 386 | len--; |
387 | 387 | ||
388 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 388 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
389 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 389 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
390 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 390 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
391 | int ret; | 391 | int ret; |
392 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { | 392 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
393 | if (len > IEEE80211_MAX_SSID_LEN) | 393 | if (len > IEEE80211_MAX_SSID_LEN) |
@@ -407,7 +407,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 410 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
411 | memcpy(sdata->u.ap.ssid, ssid, len); | 411 | memcpy(sdata->u.ap.ssid, ssid, len); |
412 | memset(sdata->u.ap.ssid + len, 0, | 412 | memset(sdata->u.ap.ssid + len, 0, |
413 | IEEE80211_MAX_SSID_LEN - len); | 413 | IEEE80211_MAX_SSID_LEN - len); |
@@ -426,8 +426,8 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
426 | 426 | ||
427 | struct ieee80211_sub_if_data *sdata; | 427 | struct ieee80211_sub_if_data *sdata; |
428 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 428 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
429 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 429 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
430 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 430 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
431 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); | 431 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); |
432 | if (res == 0) { | 432 | if (res == 0) { |
433 | data->length = len; | 433 | data->length = len; |
@@ -437,7 +437,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
437 | return res; | 437 | return res; |
438 | } | 438 | } |
439 | 439 | ||
440 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 440 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
441 | len = sdata->u.ap.ssid_len; | 441 | len = sdata->u.ap.ssid_len; |
442 | if (len > IW_ESSID_MAX_SIZE) | 442 | if (len > IW_ESSID_MAX_SIZE) |
443 | len = IW_ESSID_MAX_SIZE; | 443 | len = IW_ESSID_MAX_SIZE; |
@@ -457,8 +457,8 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
457 | struct ieee80211_sub_if_data *sdata; | 457 | struct ieee80211_sub_if_data *sdata; |
458 | 458 | ||
459 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 459 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
460 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 460 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
461 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 461 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
462 | int ret; | 462 | int ret; |
463 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { | 463 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
464 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, | 464 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, |
@@ -477,7 +477,7 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
477 | return ret; | 477 | return ret; |
478 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); | 478 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
479 | return 0; | 479 | return 0; |
480 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 480 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
481 | /* | 481 | /* |
482 | * If it is necessary to update the WDS peer address | 482 | * If it is necessary to update the WDS peer address |
483 | * while the interface is running, then we need to do | 483 | * while the interface is running, then we need to do |
@@ -505,8 +505,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
505 | struct ieee80211_sub_if_data *sdata; | 505 | struct ieee80211_sub_if_data *sdata; |
506 | 506 | ||
507 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 507 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
508 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 508 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
509 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 509 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
510 | if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED || | 510 | if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED || |
511 | sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) { | 511 | sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) { |
512 | ap_addr->sa_family = ARPHRD_ETHER; | 512 | ap_addr->sa_family = ARPHRD_ETHER; |
@@ -516,7 +516,7 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
516 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | 516 | memset(&ap_addr->sa_data, 0, ETH_ALEN); |
517 | return 0; | 517 | return 0; |
518 | } | 518 | } |
519 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 519 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
520 | ap_addr->sa_family = ARPHRD_ETHER; | 520 | ap_addr->sa_family = ARPHRD_ETHER; |
521 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 521 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |
522 | return 0; | 522 | return 0; |
@@ -538,10 +538,10 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev, | |||
538 | if (!netif_running(dev)) | 538 | if (!netif_running(dev)) |
539 | return -ENETDOWN; | 539 | return -ENETDOWN; |
540 | 540 | ||
541 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 541 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
542 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 542 | sdata->vif.type != NL80211_IFTYPE_ADHOC && |
543 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT && | 543 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
544 | sdata->vif.type != IEEE80211_IF_TYPE_AP) | 544 | sdata->vif.type != NL80211_IFTYPE_AP) |
545 | return -EOPNOTSUPP; | 545 | return -EOPNOTSUPP; |
546 | 546 | ||
547 | /* if SSID was specified explicitly then use that */ | 547 | /* if SSID was specified explicitly then use that */ |
@@ -627,7 +627,7 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
627 | 627 | ||
628 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 628 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
629 | 629 | ||
630 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 630 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
631 | return -EOPNOTSUPP; | 631 | return -EOPNOTSUPP; |
632 | 632 | ||
633 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 633 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
@@ -858,8 +858,8 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev, | |||
858 | struct iw_mlme *mlme = (struct iw_mlme *) extra; | 858 | struct iw_mlme *mlme = (struct iw_mlme *) extra; |
859 | 859 | ||
860 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 860 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
861 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 861 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
862 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 862 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
863 | return -EINVAL; | 863 | return -EINVAL; |
864 | 864 | ||
865 | switch (mlme->cmd) { | 865 | switch (mlme->cmd) { |
@@ -954,7 +954,7 @@ static int ieee80211_ioctl_giwencode(struct net_device *dev, | |||
954 | erq->length = sdata->keys[idx]->conf.keylen; | 954 | erq->length = sdata->keys[idx]->conf.keylen; |
955 | erq->flags |= IW_ENCODE_ENABLED; | 955 | erq->flags |= IW_ENCODE_ENABLED; |
956 | 956 | ||
957 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 957 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
958 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 958 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
959 | switch (ifsta->auth_alg) { | 959 | switch (ifsta->auth_alg) { |
960 | case WLAN_AUTH_OPEN: | 960 | case WLAN_AUTH_OPEN: |
@@ -1028,7 +1028,7 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
1028 | sdata->drop_unencrypted = !!data->value; | 1028 | sdata->drop_unencrypted = !!data->value; |
1029 | break; | 1029 | break; |
1030 | case IW_AUTH_PRIVACY_INVOKED: | 1030 | case IW_AUTH_PRIVACY_INVOKED: |
1031 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 1031 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1032 | ret = -EINVAL; | 1032 | ret = -EINVAL; |
1033 | else { | 1033 | else { |
1034 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | 1034 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
@@ -1043,8 +1043,8 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
1043 | } | 1043 | } |
1044 | break; | 1044 | break; |
1045 | case IW_AUTH_80211_AUTH_ALG: | 1045 | case IW_AUTH_80211_AUTH_ALG: |
1046 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1046 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1047 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1047 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1048 | sdata->u.sta.auth_algs = data->value; | 1048 | sdata->u.sta.auth_algs = data->value; |
1049 | else | 1049 | else |
1050 | ret = -EOPNOTSUPP; | 1050 | ret = -EOPNOTSUPP; |
@@ -1066,8 +1066,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev | |||
1066 | 1066 | ||
1067 | rcu_read_lock(); | 1067 | rcu_read_lock(); |
1068 | 1068 | ||
1069 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1069 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1070 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1070 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1071 | sta = sta_info_get(local, sdata->u.sta.bssid); | 1071 | sta = sta_info_get(local, sdata->u.sta.bssid); |
1072 | if (!sta) { | 1072 | if (!sta) { |
1073 | wstats->discard.fragment = 0; | 1073 | wstats->discard.fragment = 0; |
@@ -1097,8 +1097,8 @@ static int ieee80211_ioctl_giwauth(struct net_device *dev, | |||
1097 | 1097 | ||
1098 | switch (data->flags & IW_AUTH_INDEX) { | 1098 | switch (data->flags & IW_AUTH_INDEX) { |
1099 | case IW_AUTH_80211_AUTH_ALG: | 1099 | case IW_AUTH_80211_AUTH_ALG: |
1100 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1100 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1101 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1101 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1102 | data->value = sdata->u.sta.auth_algs; | 1102 | data->value = sdata->u.sta.auth_algs; |
1103 | else | 1103 | else |
1104 | ret = -EOPNOTSUPP; | 1104 | ret = -EOPNOTSUPP; |