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.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 457ebf9e85ae..a8bb8e31b1ec 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -290,14 +290,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
290 return 0; 290 return 0;
291} 291}
292 292
293int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) 293int ieee80211_set_freq(struct net_device *dev, int freqMHz)
294{ 294{
295 int ret = -EINVAL; 295 int ret = -EINVAL;
296 struct ieee80211_channel *chan; 296 struct ieee80211_channel *chan;
297 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
298 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
297 299
298 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); 300 chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
299 301
300 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { 302 if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
303 if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
304 chan->flags & IEEE80211_CHAN_NO_IBSS) {
305 printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
306 "%d MHz\n", dev->name, chan->center_freq);
307 return ret;
308 }
301 local->oper_channel = chan; 309 local->oper_channel = chan;
302 310
303 if (local->sta_sw_scanning || local->sta_hw_scanning) 311 if (local->sta_sw_scanning || local->sta_hw_scanning)
@@ -315,7 +323,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
315 struct iw_request_info *info, 323 struct iw_request_info *info,
316 struct iw_freq *freq, char *extra) 324 struct iw_freq *freq, char *extra)
317{ 325{
318 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
319 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 326 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
320 327
321 if (sdata->vif.type == IEEE80211_IF_TYPE_STA) 328 if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
@@ -329,14 +336,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
329 IEEE80211_STA_AUTO_CHANNEL_SEL; 336 IEEE80211_STA_AUTO_CHANNEL_SEL;
330 return 0; 337 return 0;
331 } else 338 } else
332 return ieee80211_set_freq(local, 339 return ieee80211_set_freq(dev,
333 ieee80211_channel_to_frequency(freq->m)); 340 ieee80211_channel_to_frequency(freq->m));
334 } else { 341 } else {
335 int i, div = 1000000; 342 int i, div = 1000000;
336 for (i = 0; i < freq->e; i++) 343 for (i = 0; i < freq->e; i++)
337 div /= 10; 344 div /= 10;
338 if (div > 0) 345 if (div > 0)
339 return ieee80211_set_freq(local, freq->m / div); 346 return ieee80211_set_freq(dev, freq->m / div);
340 else 347 else
341 return -EINVAL; 348 return -EINVAL;
342 } 349 }
@@ -489,9 +496,14 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
489 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 496 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
490 if (sdata->vif.type == IEEE80211_IF_TYPE_STA || 497 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
491 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 498 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
492 ap_addr->sa_family = ARPHRD_ETHER; 499 if (sdata->u.sta.state == IEEE80211_ASSOCIATED) {
493 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); 500 ap_addr->sa_family = ARPHRD_ETHER;
494 return 0; 501 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
502 return 0;
503 } else {
504 memset(&ap_addr->sa_data, 0, ETH_ALEN);
505 return 0;
506 }
495 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { 507 } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
496 ap_addr->sa_family = ARPHRD_ETHER; 508 ap_addr->sa_family = ARPHRD_ETHER;
497 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); 509 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);