Skip to content

Commit fee5267

Browse files
jmberglinvjw
authored andcommitted
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>
1 parent f650470 commit fee5267

4 files changed

Lines changed: 69 additions & 43 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <linux/skbuff.h>
66
#include <linux/nl80211.h>
77
#include <net/genetlink.h>
8+
/* remove once we remove the wext stuff */
9+
#include <net/iw_handler.h>
810

911
/*
1012
* 802.11 configuration in-kernel interface
@@ -524,4 +526,9 @@ struct cfg80211_ops {
524526
enum nl80211_sec_chan_offset);
525527
};
526528

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+
527534
#endif /* __NET_CFG80211_H */

‎net/mac80211/wext.c‎

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -135,48 +135,6 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
135135
return -EOPNOTSUPP;
136136
}
137137

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-
180138
static int ieee80211_ioctl_giwrange(struct net_device *dev,
181139
struct iw_request_info *info,
182140
struct iw_point *data, char *extra)
@@ -1146,7 +1104,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
11461104
static const iw_handler ieee80211_handler[] =
11471105
{
11481106
(iw_handler) NULL, /* SIOCSIWCOMMIT */
1149-
(iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
1107+
(iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
11501108
(iw_handler) NULL, /* SIOCSIWNWID */
11511109
(iw_handler) NULL, /* SIOCGIWNWID */
11521110
(iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */

‎net/wireless/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o
66
obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o
77

88
cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o
9+
cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o
910
cfg80211-$(CONFIG_NL80211) += nl80211.o

‎net/wireless/wext-compat.c‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

0 commit comments

Comments
 (0)