diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-11-26 16:36:31 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:32:13 -0500 |
commit | fee52678dbda2099a25243e79da98dc390e1939a (patch) | |
tree | 4bf459c869e89cf2bb0be2869be3e6a720f9a218 | |
parent | f650470a8f506bc33a15778432ebb8cdcf89175b (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>
-rw-r--r-- | include/net/cfg80211.h | 7 | ||||
-rw-r--r-- | net/mac80211/wext.c | 44 | ||||
-rw-r--r-- | net/wireless/Makefile | 1 | ||||
-rw-r--r-- | net/wireless/wext-compat.c | 60 |
4 files changed, 69 insertions, 43 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 53b06f6c62ca..c97eac34ec01 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <linux/skbuff.h> | 5 | #include <linux/skbuff.h> |
6 | #include <linux/nl80211.h> | 6 | #include <linux/nl80211.h> |
7 | #include <net/genetlink.h> | 7 | #include <net/genetlink.h> |
8 | /* remove once we remove the wext stuff */ | ||
9 | #include <net/iw_handler.h> | ||
8 | 10 | ||
9 | /* | 11 | /* |
10 | * 802.11 configuration in-kernel interface | 12 | * 802.11 configuration in-kernel interface |
@@ -524,4 +526,9 @@ struct cfg80211_ops { | |||
524 | enum nl80211_sec_chan_offset); | 526 | enum nl80211_sec_chan_offset); |
525 | }; | 527 | }; |
526 | 528 | ||
529 | /* temporary wext handlers */ | ||
530 | int cfg80211_wext_giwname(struct net_device *dev, | ||
531 | struct iw_request_info *info, | ||
532 | char *name, char *extra); | ||
533 | |||
527 | #endif /* __NET_CFG80211_H */ | 534 | #endif /* __NET_CFG80211_H */ |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index b3ce28d35611..b9eee3c903de 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 | ||
138 | static 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 | |||
180 | static int ieee80211_ioctl_giwrange(struct net_device *dev, | 138 | static 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) |
@@ -1146,7 +1104,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev, | |||
1146 | static const iw_handler ieee80211_handler[] = | 1104 | static const iw_handler ieee80211_handler[] = |
1147 | { | 1105 | { |
1148 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ | 1106 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ |
1149 | (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */ | 1107 | (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */ |
1150 | (iw_handler) NULL, /* SIOCSIWNWID */ | 1108 | (iw_handler) NULL, /* SIOCSIWNWID */ |
1151 | (iw_handler) NULL, /* SIOCGIWNWID */ | 1109 | (iw_handler) NULL, /* SIOCGIWNWID */ |
1152 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ | 1110 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ |
diff --git a/net/wireless/Makefile b/net/wireless/Makefile index cc547edb111f..9bc412c83430 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile | |||
@@ -6,4 +6,5 @@ obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o | |||
6 | obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o | 6 | obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o |
7 | 7 | ||
8 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o | 8 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o |
9 | cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o | ||
9 | cfg80211-$(CONFIG_NL80211) += nl80211.o | 10 | cfg80211-$(CONFIG_NL80211) += nl80211.o |
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 | |||
18 | int 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 | } | ||
60 | EXPORT_SYMBOL(cfg80211_wext_giwname); | ||