diff options
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index 10ec05624a67..e1c4502b26bf 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c | |||
@@ -26,6 +26,41 @@ | |||
26 | #include "wpa.h" | 26 | #include "wpa.h" |
27 | #include "aes_ccm.h" | 27 | #include "aes_ccm.h" |
28 | 28 | ||
29 | |||
30 | /* | ||
31 | * Wow. This ioctl interface is such crap, it's tied | ||
32 | * to internal definitions. I hope it dies soon. | ||
33 | */ | ||
34 | static int mode_to_hostapd_mode(enum ieee80211_phymode mode) | ||
35 | { | ||
36 | switch (mode) { | ||
37 | case MODE_IEEE80211A: | ||
38 | return 0; | ||
39 | case MODE_IEEE80211B: | ||
40 | return 1; | ||
41 | case MODE_IEEE80211G: | ||
42 | return 3; | ||
43 | case NUM_IEEE80211_MODES: | ||
44 | WARN_ON(1); | ||
45 | break; | ||
46 | } | ||
47 | WARN_ON(1); | ||
48 | return -1; | ||
49 | } | ||
50 | |||
51 | static enum ieee80211_phymode hostapd_mode_to_mode(int hostapd_mode) | ||
52 | { | ||
53 | switch (hostapd_mode) { | ||
54 | case 0: | ||
55 | return MODE_IEEE80211A; | ||
56 | case 1: | ||
57 | return MODE_IEEE80211B; | ||
58 | case 3: | ||
59 | return MODE_IEEE80211G; | ||
60 | } | ||
61 | return NUM_IEEE80211_MODES; | ||
62 | } | ||
63 | |||
29 | static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | 64 | static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, |
30 | int idx, int alg, int set_tx_key, | 65 | int idx, int alg, int set_tx_key, |
31 | const u8 *_key, size_t key_len) | 66 | const u8 *_key, size_t key_len) |
@@ -141,9 +176,6 @@ static int ieee80211_ioctl_giwname(struct net_device *dev, | |||
141 | case MODE_IEEE80211G: | 176 | case MODE_IEEE80211G: |
142 | strcpy(name, "IEEE 802.11g"); | 177 | strcpy(name, "IEEE 802.11g"); |
143 | break; | 178 | break; |
144 | case MODE_ATHEROS_TURBO: | ||
145 | strcpy(name, "5GHz Turbo"); | ||
146 | break; | ||
147 | default: | 179 | default: |
148 | strcpy(name, "IEEE 802.11"); | 180 | strcpy(name, "IEEE 802.11"); |
149 | break; | 181 | break; |
@@ -594,9 +626,6 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev, | |||
594 | struct ieee80211_rate *rates = &mode->rates[i]; | 626 | struct ieee80211_rate *rates = &mode->rates[i]; |
595 | int this_rate = rates->rate; | 627 | int this_rate = rates->rate; |
596 | 628 | ||
597 | if (mode->mode == MODE_ATHEROS_TURBO || | ||
598 | mode->mode == MODE_ATHEROS_TURBOG) | ||
599 | this_rate *= 2; | ||
600 | if (target_rate == this_rate) { | 629 | if (target_rate == this_rate) { |
601 | sdata->bss->max_ratectrl_rateidx = i; | 630 | sdata->bss->max_ratectrl_rateidx = i; |
602 | if (rate->fixed) | 631 | if (rate->fixed) |
@@ -786,6 +815,7 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, | |||
786 | int param = *i; | 815 | int param = *i; |
787 | int value = *(i + 1); | 816 | int value = *(i + 1); |
788 | int ret = 0; | 817 | int ret = 0; |
818 | int mode; | ||
789 | 819 | ||
790 | if (!capable(CAP_NET_ADMIN)) | 820 | if (!capable(CAP_NET_ADMIN)) |
791 | return -EPERM; | 821 | return -EPERM; |
@@ -840,7 +870,7 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, | |||
840 | break; | 870 | break; |
841 | 871 | ||
842 | case PRISM2_PARAM_NEXT_MODE: | 872 | case PRISM2_PARAM_NEXT_MODE: |
843 | local->next_mode = value; | 873 | local->next_mode = hostapd_mode_to_mode(value); |
844 | break; | 874 | break; |
845 | 875 | ||
846 | case PRISM2_PARAM_KEY_TX_RX_THRESHOLD: | 876 | case PRISM2_PARAM_KEY_TX_RX_THRESHOLD: |
@@ -868,7 +898,15 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev, | |||
868 | break; | 898 | break; |
869 | 899 | ||
870 | case PRISM2_PARAM_HW_MODES: | 900 | case PRISM2_PARAM_HW_MODES: |
871 | local->enabled_modes = value; | 901 | mode = 1; |
902 | local->enabled_modes = 0; | ||
903 | while (value) { | ||
904 | if (value & 1) | ||
905 | local->enabled_modes |= | ||
906 | hostapd_mode_to_mode(mode); | ||
907 | mode <<= 1; | ||
908 | value >>= 1; | ||
909 | } | ||
872 | break; | 910 | break; |
873 | 911 | ||
874 | case PRISM2_PARAM_CREATE_IBSS: | 912 | case PRISM2_PARAM_CREATE_IBSS: |
@@ -909,6 +947,7 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev, | |||
909 | struct ieee80211_sub_if_data *sdata; | 947 | struct ieee80211_sub_if_data *sdata; |
910 | int *param = (int *) extra; | 948 | int *param = (int *) extra; |
911 | int ret = 0; | 949 | int ret = 0; |
950 | int mode; | ||
912 | 951 | ||
913 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 952 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
914 | 953 | ||
@@ -946,7 +985,13 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev, | |||
946 | break; | 985 | break; |
947 | 986 | ||
948 | case PRISM2_PARAM_HW_MODES: | 987 | case PRISM2_PARAM_HW_MODES: |
949 | *param = local->enabled_modes; | 988 | mode = 0; |
989 | *param = 0; | ||
990 | while (mode < NUM_IEEE80211_MODES) { | ||
991 | if (local->enabled_modes & (1<<mode)) | ||
992 | *param |= mode_to_hostapd_mode(1<<mode); | ||
993 | mode++; | ||
994 | } | ||
950 | break; | 995 | break; |
951 | 996 | ||
952 | case PRISM2_PARAM_CREATE_IBSS: | 997 | case PRISM2_PARAM_CREATE_IBSS: |