diff options
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index c2e2378af082..4806d96b9877 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -302,14 +302,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
302 | return 0; | 302 | return 0; |
303 | } | 303 | } |
304 | 304 | ||
305 | int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) | 305 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) |
306 | { | 306 | { |
307 | int ret = -EINVAL; | 307 | int ret = -EINVAL; |
308 | struct ieee80211_channel *chan; | 308 | struct ieee80211_channel *chan; |
309 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
310 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
309 | 311 | ||
310 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | 312 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
311 | 313 | ||
312 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | 314 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
315 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
316 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
317 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
318 | "%d MHz\n", dev->name, chan->center_freq); | ||
319 | return ret; | ||
320 | } | ||
313 | local->oper_channel = chan; | 321 | local->oper_channel = chan; |
314 | 322 | ||
315 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 323 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
@@ -327,7 +335,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
327 | struct iw_request_info *info, | 335 | struct iw_request_info *info, |
328 | struct iw_freq *freq, char *extra) | 336 | struct iw_freq *freq, char *extra) |
329 | { | 337 | { |
330 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
331 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 338 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
332 | 339 | ||
333 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 340 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
@@ -341,14 +348,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
341 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 348 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
342 | return 0; | 349 | return 0; |
343 | } else | 350 | } else |
344 | return ieee80211_set_freq(local, | 351 | return ieee80211_set_freq(dev, |
345 | ieee80211_channel_to_frequency(freq->m)); | 352 | ieee80211_channel_to_frequency(freq->m)); |
346 | } else { | 353 | } else { |
347 | int i, div = 1000000; | 354 | int i, div = 1000000; |
348 | for (i = 0; i < freq->e; i++) | 355 | for (i = 0; i < freq->e; i++) |
349 | div /= 10; | 356 | div /= 10; |
350 | if (div > 0) | 357 | if (div > 0) |
351 | return ieee80211_set_freq(local, freq->m / div); | 358 | return ieee80211_set_freq(dev, freq->m / div); |
352 | else | 359 | else |
353 | return -EINVAL; | 360 | return -EINVAL; |
354 | } | 361 | } |
@@ -501,9 +508,14 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
501 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 508 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
502 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 509 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
503 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 510 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
504 | ap_addr->sa_family = ARPHRD_ETHER; | 511 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED) { |
505 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | 512 | ap_addr->sa_family = ARPHRD_ETHER; |
506 | return 0; | 513 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); |
514 | return 0; | ||
515 | } else { | ||
516 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | ||
517 | return 0; | ||
518 | } | ||
507 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 519 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
508 | ap_addr->sa_family = ARPHRD_ETHER; | 520 | ap_addr->sa_family = ARPHRD_ETHER; |
509 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 521 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |