aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c120
1 files changed, 3 insertions, 117 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index b3ce28d35611..4e1fdcfacb0c 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -135,48 +135,6 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
135 return -EOPNOTSUPP; 135 return -EOPNOTSUPP;
136} 136}
137 137
138static int ieee80211_ioctl_giwname(struct net_device *dev,
139 struct iw_request_info *info,
140 char *name, char *extra)
141{
142 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
143 struct ieee80211_supported_band *sband;
144 u8 is_ht = 0, is_a = 0, is_b = 0, is_g = 0;
145
146
147 sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ];
148 if (sband) {
149 is_a = 1;
150 is_ht |= sband->ht_cap.ht_supported;
151 }
152
153 sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ];
154 if (sband) {
155 int i;
156 /* Check for mandatory rates */
157 for (i = 0; i < sband->n_bitrates; i++) {
158 if (sband->bitrates[i].bitrate == 10)
159 is_b = 1;
160 if (sband->bitrates[i].bitrate == 60)
161 is_g = 1;
162 }
163 is_ht |= sband->ht_cap.ht_supported;
164 }
165
166 strcpy(name, "IEEE 802.11");
167 if (is_a)
168 strcat(name, "a");
169 if (is_b)
170 strcat(name, "b");
171 if (is_g)
172 strcat(name, "g");
173 if (is_ht)
174 strcat(name, "n");
175
176 return 0;
177}
178
179
180static int ieee80211_ioctl_giwrange(struct net_device *dev, 138static int ieee80211_ioctl_giwrange(struct net_device *dev,
181 struct iw_request_info *info, 139 struct iw_request_info *info,
182 struct iw_point *data, char *extra) 140 struct iw_point *data, char *extra)
@@ -266,78 +224,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
266} 224}
267 225
268 226
269static int ieee80211_ioctl_siwmode(struct net_device *dev,
270 struct iw_request_info *info,
271 __u32 *mode, char *extra)
272{
273 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
274 struct ieee80211_local *local = sdata->local;
275 int type;
276
277 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
278 return -EOPNOTSUPP;
279
280 switch (*mode) {
281 case IW_MODE_INFRA:
282 type = NL80211_IFTYPE_STATION;
283 break;
284 case IW_MODE_ADHOC:
285 /* Setting ad-hoc mode on non ibss channel is not
286 * supported.
287 */
288 if (local->oper_channel &&
289 (local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS))
290 return -EOPNOTSUPP;
291
292 type = NL80211_IFTYPE_ADHOC;
293 break;
294 case IW_MODE_REPEAT:
295 type = NL80211_IFTYPE_WDS;
296 break;
297 case IW_MODE_MONITOR:
298 type = NL80211_IFTYPE_MONITOR;
299 break;
300 default:
301 return -EINVAL;
302 }
303
304 return ieee80211_if_change_type(sdata, type);
305}
306
307
308static int ieee80211_ioctl_giwmode(struct net_device *dev,
309 struct iw_request_info *info,
310 __u32 *mode, char *extra)
311{
312 struct ieee80211_sub_if_data *sdata;
313
314 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
315 switch (sdata->vif.type) {
316 case NL80211_IFTYPE_AP:
317 *mode = IW_MODE_MASTER;
318 break;
319 case NL80211_IFTYPE_STATION:
320 *mode = IW_MODE_INFRA;
321 break;
322 case NL80211_IFTYPE_ADHOC:
323 *mode = IW_MODE_ADHOC;
324 break;
325 case NL80211_IFTYPE_MONITOR:
326 *mode = IW_MODE_MONITOR;
327 break;
328 case NL80211_IFTYPE_WDS:
329 *mode = IW_MODE_REPEAT;
330 break;
331 case NL80211_IFTYPE_AP_VLAN:
332 *mode = IW_MODE_SECOND; /* FIXME */
333 break;
334 default:
335 *mode = IW_MODE_AUTO;
336 break;
337 }
338 return 0;
339}
340
341static int ieee80211_ioctl_siwfreq(struct net_device *dev, 227static int ieee80211_ioctl_siwfreq(struct net_device *dev,
342 struct iw_request_info *info, 228 struct iw_request_info *info,
343 struct iw_freq *freq, char *extra) 229 struct iw_freq *freq, char *extra)
@@ -1146,13 +1032,13 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1146static const iw_handler ieee80211_handler[] = 1032static const iw_handler ieee80211_handler[] =
1147{ 1033{
1148 (iw_handler) NULL, /* SIOCSIWCOMMIT */ 1034 (iw_handler) NULL, /* SIOCSIWCOMMIT */
1149 (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */ 1035 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
1150 (iw_handler) NULL, /* SIOCSIWNWID */ 1036 (iw_handler) NULL, /* SIOCSIWNWID */
1151 (iw_handler) NULL, /* SIOCGIWNWID */ 1037 (iw_handler) NULL, /* SIOCGIWNWID */
1152 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ 1038 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
1153 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ 1039 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
1154 (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */ 1040 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
1155 (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */ 1041 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
1156 (iw_handler) NULL, /* SIOCSIWSENS */ 1042 (iw_handler) NULL, /* SIOCSIWSENS */
1157 (iw_handler) NULL, /* SIOCGIWSENS */ 1043 (iw_handler) NULL, /* SIOCGIWSENS */
1158 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ 1044 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */