diff options
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 76e1de1dc735..6106cb79060c 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -209,7 +209,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev, | |||
209 | range->num_frequency = c; | 209 | range->num_frequency = c; |
210 | 210 | ||
211 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); | 211 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); |
212 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY); | ||
213 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); | 212 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); |
214 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); | 213 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); |
215 | 214 | ||
@@ -291,14 +290,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
291 | return 0; | 290 | return 0; |
292 | } | 291 | } |
293 | 292 | ||
294 | int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) | 293 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) |
295 | { | 294 | { |
296 | int ret = -EINVAL; | 295 | int ret = -EINVAL; |
297 | 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); | ||
298 | 299 | ||
299 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | 300 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
300 | 301 | ||
301 | 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 | } | ||
302 | local->oper_channel = chan; | 309 | local->oper_channel = chan; |
303 | 310 | ||
304 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 311 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
@@ -316,7 +323,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
316 | struct iw_request_info *info, | 323 | struct iw_request_info *info, |
317 | struct iw_freq *freq, char *extra) | 324 | struct iw_freq *freq, char *extra) |
318 | { | 325 | { |
319 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
320 | 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); |
321 | 327 | ||
322 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 328 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
@@ -330,14 +336,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
330 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 336 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
331 | return 0; | 337 | return 0; |
332 | } else | 338 | } else |
333 | return ieee80211_set_freq(local, | 339 | return ieee80211_set_freq(dev, |
334 | ieee80211_channel_to_frequency(freq->m)); | 340 | ieee80211_channel_to_frequency(freq->m)); |
335 | } else { | 341 | } else { |
336 | int i, div = 1000000; | 342 | int i, div = 1000000; |
337 | for (i = 0; i < freq->e; i++) | 343 | for (i = 0; i < freq->e; i++) |
338 | div /= 10; | 344 | div /= 10; |
339 | if (div > 0) | 345 | if (div > 0) |
340 | return ieee80211_set_freq(local, freq->m / div); | 346 | return ieee80211_set_freq(dev, freq->m / div); |
341 | else | 347 | else |
342 | return -EINVAL; | 348 | return -EINVAL; |
343 | } | 349 | } |
@@ -490,9 +496,15 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
490 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 496 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
491 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 497 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
492 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 498 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
493 | ap_addr->sa_family = ARPHRD_ETHER; | 499 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED || |
494 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | 500 | sdata->u.sta.state == IEEE80211_IBSS_JOINED) { |
495 | return 0; | 501 | ap_addr->sa_family = ARPHRD_ETHER; |
502 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | ||
503 | return 0; | ||
504 | } else { | ||
505 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | ||
506 | return 0; | ||
507 | } | ||
496 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 508 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
497 | ap_addr->sa_family = ARPHRD_ETHER; | 509 | ap_addr->sa_family = ARPHRD_ETHER; |
498 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 510 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |