aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-11-26 16:36:31 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-05 09:32:13 -0500
commitfee52678dbda2099a25243e79da98dc390e1939a (patch)
tree4bf459c869e89cf2bb0be2869be3e6a720f9a218 /net/wireless/wext-compat.c
parentf650470a8f506bc33a15778432ebb8cdcf89175b (diff)
cfg80211: handle SIOCGIWNAME
This patch moves the SIOCGIWNAME handling from mac80211 to cfg80211. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
new file mode 100644
index 000000000000..a5db4551a31a
--- /dev/null
+++ b/net/wireless/wext-compat.c
@@ -0,0 +1,60 @@
1/*
2 * cfg80211 - wext compat code
3 *
4 * This is temporary code until all wireless functionality is migrated
5 * into cfg80211, when that happens all the exports here go away and
6 * we directly assign the wireless handlers of wireless interfaces.
7 *
8 * Copyright 2008 Johannes Berg <johannes@sipsolutions.net>
9 */
10
11#include <linux/wireless.h>
12#include <linux/nl80211.h>
13#include <net/iw_handler.h>
14#include <net/wireless.h>
15#include <net/cfg80211.h>
16#include "core.h"
17
18int cfg80211_wext_giwname(struct net_device *dev,
19 struct iw_request_info *info,
20 char *name, char *extra)
21{
22 struct wireless_dev *wdev = dev->ieee80211_ptr;
23 struct ieee80211_supported_band *sband;
24 bool is_ht = false, is_a = false, is_b = false, is_g = false;
25
26 if (!wdev)
27 return -EOPNOTSUPP;
28
29 sband = wdev->wiphy->bands[IEEE80211_BAND_5GHZ];
30 if (sband) {
31 is_a = true;
32 is_ht |= sband->ht_cap.ht_supported;
33 }
34
35 sband = wdev->wiphy->bands[IEEE80211_BAND_2GHZ];
36 if (sband) {
37 int i;
38 /* Check for mandatory rates */
39 for (i = 0; i < sband->n_bitrates; i++) {
40 if (sband->bitrates[i].bitrate == 10)
41 is_b = true;
42 if (sband->bitrates[i].bitrate == 60)
43 is_g = true;
44 }
45 is_ht |= sband->ht_cap.ht_supported;
46 }
47
48 strcpy(name, "IEEE 802.11");
49 if (is_a)
50 strcat(name, "a");
51 if (is_b)
52 strcat(name, "b");
53 if (is_g)
54 strcat(name, "g");
55 if (is_ht)
56 strcat(name, "n");
57
58 return 0;
59}
60EXPORT_SYMBOL(cfg80211_wext_giwname);