aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/wext.c73
-rw-r--r--net/wireless/core.h3
-rw-r--r--net/wireless/ibss.c5
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/wireless/wext-compat.c54
-rw-r--r--net/wireless/wext-compat.h21
-rw-r--r--net/wireless/wext-sme.c5
7 files changed, 83 insertions, 80 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 5acb8140ee58..7cd9aa79ef52 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -27,75 +27,6 @@
27#include "aes_ccm.h" 27#include "aes_ccm.h"
28 28
29 29
30static int ieee80211_ioctl_siwfreq(struct net_device *dev,
31 struct iw_request_info *info,
32 struct iw_freq *freq, char *extra)
33{
34 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
35 struct ieee80211_local *local = sdata->local;
36 struct ieee80211_channel *chan;
37
38 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
39 return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
40 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
41 return cfg80211_mgd_wext_siwfreq(dev, info, freq, extra);
42
43 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
44 if (freq->e == 0) {
45 if (freq->m < 0)
46 return -EINVAL;
47 else
48 chan = ieee80211_get_channel(local->hw.wiphy,
49 ieee80211_channel_to_frequency(freq->m));
50 } else {
51 int i, div = 1000000;
52 for (i = 0; i < freq->e; i++)
53 div /= 10;
54 if (div <= 0)
55 return -EINVAL;
56 chan = ieee80211_get_channel(local->hw.wiphy, freq->m / div);
57 }
58
59 if (!chan)
60 return -EINVAL;
61
62 if (chan->flags & IEEE80211_CHAN_DISABLED)
63 return -EINVAL;
64
65 /*
66 * no change except maybe auto -> fixed, ignore the HT
67 * setting so you can fix a channel you're on already
68 */
69 if (local->oper_channel == chan)
70 return 0;
71
72 local->oper_channel = chan;
73 local->oper_channel_type = NL80211_CHAN_NO_HT;
74 ieee80211_hw_config(local, 0);
75
76 return 0;
77}
78
79
80static int ieee80211_ioctl_giwfreq(struct net_device *dev,
81 struct iw_request_info *info,
82 struct iw_freq *freq, char *extra)
83{
84 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
85 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
86
87 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
88 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
89 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
90 return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
91
92 freq->m = local->oper_channel->center_freq;
93 freq->e = 6;
94
95 return 0;
96}
97
98
99static int ieee80211_ioctl_siwessid(struct net_device *dev, 30static int ieee80211_ioctl_siwessid(struct net_device *dev,
100 struct iw_request_info *info, 31 struct iw_request_info *info,
101 struct iw_point *data, char *ssid) 32 struct iw_point *data, char *ssid)
@@ -173,8 +104,8 @@ static const iw_handler ieee80211_handler[] =
173 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */ 104 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
174 (iw_handler) NULL, /* SIOCSIWNWID */ 105 (iw_handler) NULL, /* SIOCSIWNWID */
175 (iw_handler) NULL, /* SIOCGIWNWID */ 106 (iw_handler) NULL, /* SIOCGIWNWID */
176 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ 107 (iw_handler) cfg80211_wext_siwfreq, /* SIOCSIWFREQ */
177 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ 108 (iw_handler) cfg80211_wext_giwfreq, /* SIOCGIWFREQ */
178 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */ 109 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
179 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */ 110 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
180 (iw_handler) NULL, /* SIOCSIWSENS */ 111 (iw_handler) NULL, /* SIOCSIWSENS */
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 4276b70cd975..6d903c1d721d 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -66,6 +66,9 @@ struct cfg80211_registered_device {
66 struct work_struct conn_work; 66 struct work_struct conn_work;
67 struct work_struct event_work; 67 struct work_struct event_work;
68 68
69 /* current channel */
70 struct ieee80211_channel *channel;
71
69#ifdef CONFIG_CFG80211_DEBUGFS 72#ifdef CONFIG_CFG80211_DEBUGFS
70 /* Debugfs entries */ 73 /* Debugfs entries */
71 struct wiphy_debugfsdentries { 74 struct wiphy_debugfsdentries {
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 8b65e212ae49..de9ac49cd907 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -7,6 +7,7 @@
7#include <linux/etherdevice.h> 7#include <linux/etherdevice.h>
8#include <linux/if_arp.h> 8#include <linux/if_arp.h>
9#include <net/cfg80211.h> 9#include <net/cfg80211.h>
10#include "wext-compat.h"
10#include "nl80211.h" 11#include "nl80211.h"
11 12
12 13
@@ -312,8 +313,6 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
312 313
313 return err; 314 return err;
314} 315}
315/* temporary symbol - mark GPL - in the future the handler won't be */
316EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_siwfreq);
317 316
318int cfg80211_ibss_wext_giwfreq(struct net_device *dev, 317int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
319 struct iw_request_info *info, 318 struct iw_request_info *info,
@@ -342,8 +341,6 @@ int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
342 /* no channel if not joining */ 341 /* no channel if not joining */
343 return -EINVAL; 342 return -EINVAL;
344} 343}
345/* temporary symbol - mark GPL - in the future the handler won't be */
346EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_giwfreq);
347 344
348int cfg80211_ibss_wext_siwessid(struct net_device *dev, 345int cfg80211_ibss_wext_siwessid(struct net_device *dev,
349 struct iw_request_info *info, 346 struct iw_request_info *info,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c951eb2b07d5..0cd548267d4a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -757,6 +757,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
757 channel_type); 757 channel_type);
758 if (result) 758 if (result)
759 goto bad_res; 759 goto bad_res;
760
761 rdev->channel = chan;
760 } 762 }
761 763
762 changed = 0; 764 changed = 0;
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index c7351a98e660..fc2e7768967d 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -14,6 +14,7 @@
14#include <linux/etherdevice.h> 14#include <linux/etherdevice.h>
15#include <net/iw_handler.h> 15#include <net/iw_handler.h>
16#include <net/cfg80211.h> 16#include <net/cfg80211.h>
17#include "wext-compat.h"
17#include "core.h" 18#include "core.h"
18 19
19int cfg80211_wext_giwname(struct net_device *dev, 20int cfg80211_wext_giwname(struct net_device *dev,
@@ -300,7 +301,6 @@ struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
300 return ERR_PTR(-EINVAL); 301 return ERR_PTR(-EINVAL);
301 return chan; 302 return chan;
302} 303}
303EXPORT_SYMBOL_GPL(cfg80211_wext_freq);
304 304
305int cfg80211_wext_siwrts(struct net_device *dev, 305int cfg80211_wext_siwrts(struct net_device *dev,
306 struct iw_request_info *info, 306 struct iw_request_info *info,
@@ -759,6 +759,58 @@ int cfg80211_wext_giwencode(struct net_device *dev,
759} 759}
760EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode); 760EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode);
761 761
762int cfg80211_wext_siwfreq(struct net_device *dev,
763 struct iw_request_info *info,
764 struct iw_freq *freq, char *extra)
765{
766 struct wireless_dev *wdev = dev->ieee80211_ptr;
767 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
768 struct ieee80211_channel *chan;
769 int err;
770
771 switch (wdev->iftype) {
772 case NL80211_IFTYPE_STATION:
773 return cfg80211_mgd_wext_siwfreq(dev, info, freq, extra);
774 case NL80211_IFTYPE_ADHOC:
775 return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
776 default:
777 chan = cfg80211_wext_freq(wdev->wiphy, freq);
778 if (!chan)
779 return -EINVAL;
780 if (IS_ERR(chan))
781 return PTR_ERR(chan);
782 err = rdev->ops->set_channel(wdev->wiphy, chan,
783 NL80211_CHAN_NO_HT);
784 if (err)
785 return err;
786 rdev->channel = chan;
787 return 0;
788 }
789}
790EXPORT_SYMBOL_GPL(cfg80211_wext_siwfreq);
791
792int cfg80211_wext_giwfreq(struct net_device *dev,
793 struct iw_request_info *info,
794 struct iw_freq *freq, char *extra)
795{
796 struct wireless_dev *wdev = dev->ieee80211_ptr;
797 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
798
799 switch (wdev->iftype) {
800 case NL80211_IFTYPE_STATION:
801 return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
802 case NL80211_IFTYPE_ADHOC:
803 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
804 default:
805 if (!rdev->channel)
806 return -EINVAL;
807 freq->m = rdev->channel->center_freq;
808 freq->e = 6;
809 return 0;
810 }
811}
812EXPORT_SYMBOL_GPL(cfg80211_wext_giwfreq);
813
762int cfg80211_wext_siwtxpower(struct net_device *dev, 814int cfg80211_wext_siwtxpower(struct net_device *dev,
763 struct iw_request_info *info, 815 struct iw_request_info *info,
764 union iwreq_data *data, char *extra) 816 union iwreq_data *data, char *extra)
diff --git a/net/wireless/wext-compat.h b/net/wireless/wext-compat.h
new file mode 100644
index 000000000000..23a6b5a83f2d
--- /dev/null
+++ b/net/wireless/wext-compat.h
@@ -0,0 +1,21 @@
1#ifndef __WEXT_COMPAT
2#define __WEXT_COMPAT
3
4int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
5 struct iw_request_info *info,
6 struct iw_freq *freq, char *extra);
7int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
8 struct iw_request_info *info,
9 struct iw_freq *freq, char *extra);
10
11int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
12 struct iw_request_info *info,
13 struct iw_freq *freq, char *extra);
14int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
15 struct iw_request_info *info,
16 struct iw_freq *freq, char *extra);
17
18struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
19 struct iw_freq *freq);
20
21#endif /* __WEXT_COMPAT */
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 4c689fd865b0..509279a1cfb2 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -8,6 +8,7 @@
8#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
9#include <linux/if_arp.h> 9#include <linux/if_arp.h>
10#include <net/cfg80211.h> 10#include <net/cfg80211.h>
11#include "wext-compat.h"
11#include "nl80211.h" 12#include "nl80211.h"
12 13
13int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, 14int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev,
@@ -108,8 +109,6 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
108 cfg80211_unlock_rdev(rdev); 109 cfg80211_unlock_rdev(rdev);
109 return err; 110 return err;
110} 111}
111/* temporary symbol - mark GPL - in the future the handler won't be */
112EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_siwfreq);
113 112
114int cfg80211_mgd_wext_giwfreq(struct net_device *dev, 113int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
115 struct iw_request_info *info, 114 struct iw_request_info *info,
@@ -138,8 +137,6 @@ int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
138 /* no channel if not joining */ 137 /* no channel if not joining */
139 return -EINVAL; 138 return -EINVAL;
140} 139}
141/* temporary symbol - mark GPL - in the future the handler won't be */
142EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_giwfreq);
143 140
144int cfg80211_mgd_wext_siwessid(struct net_device *dev, 141int cfg80211_mgd_wext_siwessid(struct net_device *dev,
145 struct iw_request_info *info, 142 struct iw_request_info *info,