Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2002-2005, Instant802 Networks, Inc. |
| 3 | * Copyright 2005-2006, Devicescape Software, Inc. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation. |
| 8 | */ |
| 9 | |
| 10 | #include <linux/module.h> |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/netdevice.h> |
| 13 | #include <linux/types.h> |
| 14 | #include <linux/slab.h> |
| 15 | #include <linux/skbuff.h> |
| 16 | #include <linux/etherdevice.h> |
| 17 | #include <linux/if_arp.h> |
| 18 | #include <linux/wireless.h> |
| 19 | #include <net/iw_handler.h> |
| 20 | #include <asm/uaccess.h> |
| 21 | |
| 22 | #include <net/mac80211.h> |
| 23 | #include "ieee80211_i.h" |
Johannes Berg | 2c8dccc | 2008-04-08 15:14:40 -0400 | [diff] [blame] | 24 | #include "led.h" |
| 25 | #include "rate.h" |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 26 | #include "wpa.h" |
| 27 | #include "aes_ccm.h" |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 28 | |
Johannes Berg | b708e61 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 29 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 30 | static int ieee80211_ioctl_siwgenie(struct net_device *dev, |
| 31 | struct iw_request_info *info, |
| 32 | struct iw_point *data, char *extra) |
| 33 | { |
| 34 | struct ieee80211_sub_if_data *sdata; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 35 | |
| 36 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | ddd3d2b | 2007-09-26 17:53:20 +0200 | [diff] [blame] | 37 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 38 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 39 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); |
Johannes Berg | 175427c | 2009-05-19 22:16:25 +0200 | [diff] [blame] | 40 | if (ret && ret != -EALREADY) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 41 | return ret; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 42 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
Jouni Malinen | 636a5d3 | 2009-03-19 13:39:22 +0200 | [diff] [blame] | 43 | sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; |
Jouni Malinen | 3f77316c | 2009-05-11 21:57:57 +0300 | [diff] [blame] | 44 | sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; |
Johannes Berg | 175427c | 2009-05-19 22:16:25 +0200 | [diff] [blame] | 45 | if (ret != -EALREADY) |
| 46 | ieee80211_sta_req_auth(sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 47 | return 0; |
| 48 | } |
| 49 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 50 | return -EOPNOTSUPP; |
| 51 | } |
| 52 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 53 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, |
| 54 | struct iw_request_info *info, |
| 55 | struct iw_freq *freq, char *extra) |
| 56 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 57 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 58 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 59 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 60 | return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra); |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 61 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 62 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 63 | |
| 64 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ |
| 65 | if (freq->e == 0) { |
| 66 | if (freq->m < 0) { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 67 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 68 | sdata->u.mgd.flags |= |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 69 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 70 | return 0; |
| 71 | } else |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 72 | return ieee80211_set_freq(sdata, |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 73 | ieee80211_channel_to_frequency(freq->m)); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 74 | } else { |
| 75 | int i, div = 1000000; |
| 76 | for (i = 0; i < freq->e; i++) |
| 77 | div /= 10; |
| 78 | if (div > 0) |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 79 | return ieee80211_set_freq(sdata, freq->m / div); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 80 | else |
| 81 | return -EINVAL; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | |
| 86 | static int ieee80211_ioctl_giwfreq(struct net_device *dev, |
| 87 | struct iw_request_info *info, |
| 88 | struct iw_freq *freq, char *extra) |
| 89 | { |
| 90 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 91 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 92 | |
| 93 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 94 | return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 95 | |
Johannes Berg | 7738231 | 2009-05-04 17:52:10 +0200 | [diff] [blame] | 96 | freq->m = local->oper_channel->center_freq; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 97 | freq->e = 6; |
| 98 | |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | |
| 103 | static int ieee80211_ioctl_siwessid(struct net_device *dev, |
| 104 | struct iw_request_info *info, |
| 105 | struct iw_point *data, char *ssid) |
| 106 | { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 107 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 108 | size_t len = data->length; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 109 | int ret; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 110 | |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 111 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 112 | return cfg80211_ibss_wext_siwessid(dev, info, data, ssid); |
| 113 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 114 | /* iwconfig uses nul termination in SSID.. */ |
| 115 | if (len > 0 && ssid[len - 1] == '\0') |
| 116 | len--; |
| 117 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 118 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 119 | if (data->flags) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 120 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 121 | else |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 122 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL; |
| 123 | |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 124 | ret = ieee80211_sta_set_ssid(sdata, ssid, len); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 125 | if (ret) |
| 126 | return ret; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 127 | |
Jouni Malinen | 636a5d3 | 2009-03-19 13:39:22 +0200 | [diff] [blame] | 128 | sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; |
Jouni Malinen | 3f77316c | 2009-05-11 21:57:57 +0300 | [diff] [blame] | 129 | sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 130 | ieee80211_sta_req_auth(sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 131 | return 0; |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 132 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 133 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 134 | return -EOPNOTSUPP; |
| 135 | } |
| 136 | |
| 137 | |
| 138 | static int ieee80211_ioctl_giwessid(struct net_device *dev, |
| 139 | struct iw_request_info *info, |
| 140 | struct iw_point *data, char *ssid) |
| 141 | { |
| 142 | size_t len; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 143 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 144 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 145 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 146 | |
| 147 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 148 | return cfg80211_ibss_wext_giwessid(dev, info, data, ssid); |
| 149 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 150 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 151 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 152 | if (res == 0) { |
| 153 | data->length = len; |
| 154 | data->flags = 1; |
| 155 | } else |
| 156 | data->flags = 0; |
| 157 | return res; |
| 158 | } |
| 159 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 160 | return -EOPNOTSUPP; |
| 161 | } |
| 162 | |
| 163 | |
| 164 | static int ieee80211_ioctl_siwap(struct net_device *dev, |
| 165 | struct iw_request_info *info, |
| 166 | struct sockaddr *ap_addr, char *extra) |
| 167 | { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 168 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 169 | |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 170 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 171 | return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra); |
| 172 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 173 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 174 | int ret; |
Johannes Berg | 7986cf9 | 2009-03-21 17:08:43 +0100 | [diff] [blame] | 175 | |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 176 | if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 177 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_BSSID_SEL | |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 178 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
| 179 | else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data)) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 180 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_BSSID_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 181 | else |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 182 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 183 | ret = ieee80211_sta_set_bssid(sdata, (u8 *) &ap_addr->sa_data); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 184 | if (ret) |
| 185 | return ret; |
Jouni Malinen | 636a5d3 | 2009-03-19 13:39:22 +0200 | [diff] [blame] | 186 | sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; |
Jouni Malinen | 3f77316c | 2009-05-11 21:57:57 +0300 | [diff] [blame] | 187 | sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 188 | ieee80211_sta_req_auth(sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 189 | return 0; |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 190 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
Johannes Berg | 44213b5 | 2008-02-25 16:27:49 +0100 | [diff] [blame] | 191 | /* |
| 192 | * If it is necessary to update the WDS peer address |
| 193 | * while the interface is running, then we need to do |
| 194 | * more work here, namely if it is running we need to |
| 195 | * add a new and remove the old STA entry, this is |
| 196 | * normally handled by _open() and _stop(). |
| 197 | */ |
| 198 | if (netif_running(dev)) |
| 199 | return -EBUSY; |
| 200 | |
| 201 | memcpy(&sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data, |
| 202 | ETH_ALEN); |
| 203 | |
| 204 | return 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | return -EOPNOTSUPP; |
| 208 | } |
| 209 | |
| 210 | |
| 211 | static int ieee80211_ioctl_giwap(struct net_device *dev, |
| 212 | struct iw_request_info *info, |
| 213 | struct sockaddr *ap_addr, char *extra) |
| 214 | { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 215 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 216 | |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 217 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 218 | return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra); |
| 219 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 220 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
| 221 | if (sdata->u.mgd.state == IEEE80211_STA_MLME_ASSOCIATED) { |
Abhijeet Kolekar | d4231ca | 2008-05-23 10:15:26 -0700 | [diff] [blame] | 222 | ap_addr->sa_family = ARPHRD_ETHER; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 223 | memcpy(&ap_addr->sa_data, sdata->u.mgd.bssid, ETH_ALEN); |
| 224 | } else |
Abhijeet Kolekar | d4231ca | 2008-05-23 10:15:26 -0700 | [diff] [blame] | 225 | memset(&ap_addr->sa_data, 0, ETH_ALEN); |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 226 | return 0; |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 227 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 228 | ap_addr->sa_family = ARPHRD_ETHER; |
| 229 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |
| 230 | return 0; |
| 231 | } |
| 232 | |
| 233 | return -EOPNOTSUPP; |
| 234 | } |
| 235 | |
| 236 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 237 | static int ieee80211_ioctl_siwrate(struct net_device *dev, |
| 238 | struct iw_request_info *info, |
| 239 | struct iw_param *rate, char *extra) |
| 240 | { |
| 241 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 242 | int i, err = -EINVAL; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 243 | u32 target_rate = rate->value / 100000; |
| 244 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 245 | struct ieee80211_supported_band *sband; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 246 | |
| 247 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 248 | |
| 249 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 250 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 251 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates |
| 252 | * target_rate = X, rate->fixed = 1 means only rate X |
| 253 | * target_rate = X, rate->fixed = 0 means all rates <= X */ |
Johannes Berg | 3e122be | 2008-07-09 14:40:34 +0200 | [diff] [blame] | 254 | sdata->max_ratectrl_rateidx = -1; |
| 255 | sdata->force_unicast_rateidx = -1; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 256 | if (rate->value < 0) |
| 257 | return 0; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 258 | |
| 259 | for (i=0; i< sband->n_bitrates; i++) { |
| 260 | struct ieee80211_rate *brate = &sband->bitrates[i]; |
| 261 | int this_rate = brate->bitrate; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 262 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 263 | if (target_rate == this_rate) { |
Johannes Berg | 3e122be | 2008-07-09 14:40:34 +0200 | [diff] [blame] | 264 | sdata->max_ratectrl_rateidx = i; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 265 | if (rate->fixed) |
Johannes Berg | 3e122be | 2008-07-09 14:40:34 +0200 | [diff] [blame] | 266 | sdata->force_unicast_rateidx = i; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 267 | err = 0; |
| 268 | break; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 269 | } |
| 270 | } |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 271 | return err; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 272 | } |
| 273 | |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 274 | static int ieee80211_ioctl_giwrate(struct net_device *dev, |
| 275 | struct iw_request_info *info, |
| 276 | struct iw_param *rate, char *extra) |
| 277 | { |
| 278 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 279 | struct sta_info *sta; |
| 280 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 281 | struct ieee80211_supported_band *sband; |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 282 | |
| 283 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 284 | |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 285 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 286 | return -EOPNOTSUPP; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 287 | |
| 288 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 289 | |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame] | 290 | rcu_read_lock(); |
| 291 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 292 | sta = sta_info_get(local, sdata->u.mgd.bssid); |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame] | 293 | |
Johannes Berg | e6a9854 | 2008-10-21 12:40:02 +0200 | [diff] [blame] | 294 | if (sta && !(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) |
| 295 | rate->value = sband->bitrates[sta->last_tx_rate.idx].bitrate; |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 296 | else |
| 297 | rate->value = 0; |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame] | 298 | |
| 299 | rcu_read_unlock(); |
| 300 | |
| 301 | if (!sta) |
| 302 | return -ENODEV; |
| 303 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 304 | rate->value *= 100000; |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 305 | |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 306 | return 0; |
| 307 | } |
| 308 | |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 309 | static int ieee80211_ioctl_siwpower(struct net_device *dev, |
| 310 | struct iw_request_info *info, |
| 311 | struct iw_param *wrq, |
| 312 | char *extra) |
| 313 | { |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 314 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 315 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 316 | struct ieee80211_conf *conf = &local->hw.conf; |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 317 | int timeout = 0; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 318 | bool ps; |
| 319 | |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 320 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) |
| 321 | return -EOPNOTSUPP; |
| 322 | |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 323 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
| 324 | return -EINVAL; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 325 | |
| 326 | if (wrq->disabled) { |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 327 | ps = false; |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 328 | timeout = 0; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 329 | goto set; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | switch (wrq->flags & IW_POWER_MODE) { |
| 333 | case IW_POWER_ON: /* If not specified */ |
| 334 | case IW_POWER_MODE: /* If set all mask */ |
| 335 | case IW_POWER_ALL_R: /* If explicitely state all */ |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 336 | ps = true; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 337 | break; |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 338 | default: /* Otherwise we ignore */ |
Johannes Berg | e9aeaba | 2009-01-06 18:12:35 +0100 | [diff] [blame] | 339 | return -EINVAL; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 340 | } |
| 341 | |
Johannes Berg | e9aeaba | 2009-01-06 18:12:35 +0100 | [diff] [blame] | 342 | if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT)) |
| 343 | return -EINVAL; |
| 344 | |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 345 | if (wrq->flags & IW_POWER_TIMEOUT) |
| 346 | timeout = wrq->value / 1000; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 347 | |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 348 | set: |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 349 | if (ps == sdata->u.mgd.powersave && timeout == conf->dynamic_ps_timeout) |
| 350 | return 0; |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 351 | |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 352 | sdata->u.mgd.powersave = ps; |
Johannes Berg | 46f2c4b | 2009-01-06 18:13:18 +0100 | [diff] [blame] | 353 | conf->dynamic_ps_timeout = timeout; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 354 | |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 355 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) |
Johannes Berg | e255d5e | 2009-04-22 12:40:07 +0200 | [diff] [blame] | 356 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 357 | |
Johannes Berg | 10f644a | 2009-04-16 13:17:25 +0200 | [diff] [blame] | 358 | ieee80211_recalc_ps(local, -1); |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 359 | |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 360 | return 0; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 361 | } |
| 362 | |
| 363 | static int ieee80211_ioctl_giwpower(struct net_device *dev, |
| 364 | struct iw_request_info *info, |
| 365 | union iwreq_data *wrqu, |
| 366 | char *extra) |
| 367 | { |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 368 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 369 | |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 370 | wrqu->power.disabled = !sdata->u.mgd.powersave; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 371 | |
| 372 | return 0; |
| 373 | } |
| 374 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 375 | static int ieee80211_ioctl_siwauth(struct net_device *dev, |
| 376 | struct iw_request_info *info, |
| 377 | struct iw_param *data, char *extra) |
| 378 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 379 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 380 | int ret = 0; |
| 381 | |
| 382 | switch (data->flags & IW_AUTH_INDEX) { |
| 383 | case IW_AUTH_WPA_VERSION: |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 384 | case IW_AUTH_CIPHER_GROUP: |
| 385 | case IW_AUTH_WPA_ENABLED: |
| 386 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 387 | case IW_AUTH_KEY_MGMT: |
Jouni Malinen | 54604d3 | 2009-01-08 13:32:03 +0200 | [diff] [blame] | 388 | case IW_AUTH_CIPHER_GROUP_MGMT: |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 389 | break; |
Vasanthakumar Thiagarajan | eb46936 | 2008-12-23 21:30:50 +0530 | [diff] [blame] | 390 | case IW_AUTH_CIPHER_PAIRWISE: |
| 391 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
| 392 | if (data->value & (IW_AUTH_CIPHER_WEP40 | |
| 393 | IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_TKIP)) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 394 | sdata->u.mgd.flags |= |
Vasanthakumar Thiagarajan | eb46936 | 2008-12-23 21:30:50 +0530 | [diff] [blame] | 395 | IEEE80211_STA_TKIP_WEP_USED; |
| 396 | else |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 397 | sdata->u.mgd.flags &= |
Vasanthakumar Thiagarajan | eb46936 | 2008-12-23 21:30:50 +0530 | [diff] [blame] | 398 | ~IEEE80211_STA_TKIP_WEP_USED; |
| 399 | } |
| 400 | break; |
Johannes Berg | b1357a8 | 2007-11-28 11:04:21 +0100 | [diff] [blame] | 401 | case IW_AUTH_DROP_UNENCRYPTED: |
| 402 | sdata->drop_unencrypted = !!data->value; |
| 403 | break; |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 404 | case IW_AUTH_PRIVACY_INVOKED: |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 405 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 406 | ret = -EINVAL; |
| 407 | else { |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 408 | sdata->u.mgd.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 409 | /* |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 410 | * Privacy invoked by wpa_supplicant, store the |
| 411 | * value and allow associating to a protected |
| 412 | * network without having a key up front. |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 413 | */ |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 414 | if (data->value) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 415 | sdata->u.mgd.flags |= |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 416 | IEEE80211_STA_PRIVACY_INVOKED; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 417 | } |
| 418 | break; |
| 419 | case IW_AUTH_80211_AUTH_ALG: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 420 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 421 | sdata->u.mgd.auth_algs = data->value; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 422 | else |
| 423 | ret = -EOPNOTSUPP; |
| 424 | break; |
Jouni Malinen | fdfacf0 | 2009-01-08 13:32:05 +0200 | [diff] [blame] | 425 | case IW_AUTH_MFP: |
Jouni Malinen | 4375d08 | 2009-01-08 13:32:11 +0200 | [diff] [blame] | 426 | if (!(sdata->local->hw.flags & IEEE80211_HW_MFP_CAPABLE)) { |
| 427 | ret = -EOPNOTSUPP; |
| 428 | break; |
| 429 | } |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 430 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 431 | switch (data->value) { |
| 432 | case IW_AUTH_MFP_DISABLED: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 433 | sdata->u.mgd.mfp = IEEE80211_MFP_DISABLED; |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 434 | break; |
| 435 | case IW_AUTH_MFP_OPTIONAL: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 436 | sdata->u.mgd.mfp = IEEE80211_MFP_OPTIONAL; |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 437 | break; |
| 438 | case IW_AUTH_MFP_REQUIRED: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 439 | sdata->u.mgd.mfp = IEEE80211_MFP_REQUIRED; |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 440 | break; |
| 441 | default: |
| 442 | ret = -EINVAL; |
| 443 | } |
| 444 | } else |
Jouni Malinen | fdfacf0 | 2009-01-08 13:32:05 +0200 | [diff] [blame] | 445 | ret = -EOPNOTSUPP; |
| 446 | break; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 447 | default: |
| 448 | ret = -EOPNOTSUPP; |
| 449 | break; |
| 450 | } |
| 451 | return ret; |
| 452 | } |
| 453 | |
| 454 | /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ |
| 455 | static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev) |
| 456 | { |
| 457 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 458 | struct iw_statistics *wstats = &local->wstats; |
| 459 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 460 | struct sta_info *sta = NULL; |
| 461 | |
Johannes Berg | 98dd6a5 | 2008-04-10 15:36:09 +0200 | [diff] [blame] | 462 | rcu_read_lock(); |
| 463 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 464 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 465 | sta = sta_info_get(local, sdata->u.mgd.bssid); |
| 466 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 467 | if (!sta) { |
| 468 | wstats->discard.fragment = 0; |
| 469 | wstats->discard.misc = 0; |
| 470 | wstats->qual.qual = 0; |
| 471 | wstats->qual.level = 0; |
| 472 | wstats->qual.noise = 0; |
| 473 | wstats->qual.updated = IW_QUAL_ALL_INVALID; |
| 474 | } else { |
Johannes Berg | 24776cf | 2009-02-27 16:33:55 -0600 | [diff] [blame] | 475 | wstats->qual.updated = 0; |
| 476 | /* |
| 477 | * mirror what cfg80211 does for iwrange/scan results, |
| 478 | * otherwise userspace gets confused. |
| 479 | */ |
| 480 | if (local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | |
| 481 | IEEE80211_HW_SIGNAL_DBM)) { |
| 482 | wstats->qual.updated |= IW_QUAL_LEVEL_UPDATED; |
| 483 | wstats->qual.updated |= IW_QUAL_QUAL_UPDATED; |
| 484 | } else { |
| 485 | wstats->qual.updated |= IW_QUAL_LEVEL_INVALID; |
| 486 | wstats->qual.updated |= IW_QUAL_QUAL_INVALID; |
| 487 | } |
| 488 | |
| 489 | if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) { |
| 490 | wstats->qual.level = sta->last_signal; |
| 491 | wstats->qual.qual = sta->last_signal; |
| 492 | } else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) { |
| 493 | int sig = sta->last_signal; |
| 494 | |
| 495 | wstats->qual.updated |= IW_QUAL_DBM; |
| 496 | wstats->qual.level = sig; |
| 497 | if (sig < -110) |
| 498 | sig = -110; |
| 499 | else if (sig > -40) |
| 500 | sig = -40; |
| 501 | wstats->qual.qual = sig + 110; |
| 502 | } |
| 503 | |
| 504 | if (local->hw.flags & IEEE80211_HW_NOISE_DBM) { |
| 505 | /* |
| 506 | * This assumes that if driver reports noise, it also |
| 507 | * reports signal in dBm. |
| 508 | */ |
| 509 | wstats->qual.noise = sta->last_noise; |
| 510 | wstats->qual.updated |= IW_QUAL_NOISE_UPDATED; |
| 511 | } else { |
| 512 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID; |
| 513 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 514 | } |
Johannes Berg | 98dd6a5 | 2008-04-10 15:36:09 +0200 | [diff] [blame] | 515 | |
| 516 | rcu_read_unlock(); |
| 517 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 518 | return wstats; |
| 519 | } |
| 520 | |
| 521 | static int ieee80211_ioctl_giwauth(struct net_device *dev, |
| 522 | struct iw_request_info *info, |
| 523 | struct iw_param *data, char *extra) |
| 524 | { |
| 525 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 526 | int ret = 0; |
| 527 | |
| 528 | switch (data->flags & IW_AUTH_INDEX) { |
| 529 | case IW_AUTH_80211_AUTH_ALG: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 530 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 531 | data->value = sdata->u.mgd.auth_algs; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 532 | else |
| 533 | ret = -EOPNOTSUPP; |
| 534 | break; |
| 535 | default: |
| 536 | ret = -EOPNOTSUPP; |
| 537 | break; |
| 538 | } |
| 539 | return ret; |
| 540 | } |
| 541 | |
| 542 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 543 | /* Structures to export the Wireless Handlers */ |
| 544 | |
| 545 | static const iw_handler ieee80211_handler[] = |
| 546 | { |
| 547 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ |
Johannes Berg | fee5267 | 2008-11-26 22:36:31 +0100 | [diff] [blame] | 548 | (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 549 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 550 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 551 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ |
| 552 | (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ |
Johannes Berg | e60c774 | 2008-11-26 23:31:40 +0100 | [diff] [blame] | 553 | (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */ |
| 554 | (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 555 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 556 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 557 | (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ |
Johannes Berg | 4aa188e | 2009-02-18 19:32:08 +0100 | [diff] [blame] | 558 | (iw_handler) cfg80211_wext_giwrange, /* SIOCGIWRANGE */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 559 | (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */ |
| 560 | (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ |
| 561 | (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ |
| 562 | (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */ |
Johannes Berg | 5d4ecd9 | 2007-09-14 11:10:24 -0400 | [diff] [blame] | 563 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 564 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 565 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 566 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 567 | (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */ |
| 568 | (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */ |
Johannes Berg | 691597c | 2009-04-19 19:57:45 +0200 | [diff] [blame] | 569 | (iw_handler) cfg80211_wext_siwmlme, /* SIOCSIWMLME */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 570 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
Johannes Berg | 2a51931 | 2009-02-10 21:25:55 +0100 | [diff] [blame] | 571 | (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */ |
| 572 | (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 573 | (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */ |
| 574 | (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */ |
| 575 | (iw_handler) NULL, /* SIOCSIWNICKN */ |
| 576 | (iw_handler) NULL, /* SIOCGIWNICKN */ |
| 577 | (iw_handler) NULL, /* -- hole -- */ |
| 578 | (iw_handler) NULL, /* -- hole -- */ |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 579 | (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */ |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 580 | (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */ |
Jouni Malinen | b9a5f8ca | 2009-04-20 18:39:05 +0200 | [diff] [blame] | 581 | (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */ |
| 582 | (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */ |
| 583 | (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */ |
| 584 | (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */ |
Johannes Berg | 7643a2c | 2009-06-02 13:01:39 +0200 | [diff] [blame] | 585 | (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */ |
| 586 | (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */ |
Jouni Malinen | b9a5f8ca | 2009-04-20 18:39:05 +0200 | [diff] [blame] | 587 | (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */ |
| 588 | (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */ |
Johannes Berg | 0864512 | 2009-05-11 13:54:58 +0200 | [diff] [blame] | 589 | (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ |
| 590 | (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */ |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 591 | (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */ |
| 592 | (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 593 | (iw_handler) NULL, /* -- hole -- */ |
| 594 | (iw_handler) NULL, /* -- hole -- */ |
| 595 | (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */ |
| 596 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
| 597 | (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */ |
| 598 | (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */ |
Johannes Berg | 0864512 | 2009-05-11 13:54:58 +0200 | [diff] [blame] | 599 | (iw_handler) cfg80211_wext_siwencodeext, /* SIOCSIWENCODEEXT */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 600 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
| 601 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 602 | (iw_handler) NULL, /* -- hole -- */ |
| 603 | }; |
| 604 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 605 | const struct iw_handler_def ieee80211_iw_handler_def = |
| 606 | { |
| 607 | .num_standard = ARRAY_SIZE(ieee80211_handler), |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 608 | .standard = (iw_handler *) ieee80211_handler, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 609 | .get_wireless_stats = ieee80211_get_wireless_stats, |
| 610 | }; |