diff options
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 457ebf9e85ae..e8404212ad57 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | if (alg == ALG_WEP && | ||
99 | key_len != LEN_WEP40 && key_len != LEN_WEP104) { | ||
100 | ieee80211_key_free(key); | ||
101 | err = -EINVAL; | ||
102 | goto out_unlock; | ||
103 | } | ||
104 | |||
98 | ieee80211_key_link(key, sdata, sta); | 105 | ieee80211_key_link(key, sdata, sta); |
99 | 106 | ||
100 | if (set_tx_key || (!sta && !sdata->default_key && key)) | 107 | if (set_tx_key || (!sta && !sdata->default_key && key)) |
@@ -290,14 +297,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
290 | return 0; | 297 | return 0; |
291 | } | 298 | } |
292 | 299 | ||
293 | int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) | 300 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) |
294 | { | 301 | { |
295 | int ret = -EINVAL; | 302 | int ret = -EINVAL; |
296 | struct ieee80211_channel *chan; | 303 | struct ieee80211_channel *chan; |
304 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
305 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
297 | 306 | ||
298 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | 307 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
299 | 308 | ||
300 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | 309 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
310 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
311 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
312 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
313 | "%d MHz\n", dev->name, chan->center_freq); | ||
314 | return ret; | ||
315 | } | ||
301 | local->oper_channel = chan; | 316 | local->oper_channel = chan; |
302 | 317 | ||
303 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 318 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
@@ -315,7 +330,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
315 | struct iw_request_info *info, | 330 | struct iw_request_info *info, |
316 | struct iw_freq *freq, char *extra) | 331 | struct iw_freq *freq, char *extra) |
317 | { | 332 | { |
318 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
319 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 333 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
320 | 334 | ||
321 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 335 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
@@ -329,14 +343,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
329 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 343 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
330 | return 0; | 344 | return 0; |
331 | } else | 345 | } else |
332 | return ieee80211_set_freq(local, | 346 | return ieee80211_set_freq(dev, |
333 | ieee80211_channel_to_frequency(freq->m)); | 347 | ieee80211_channel_to_frequency(freq->m)); |
334 | } else { | 348 | } else { |
335 | int i, div = 1000000; | 349 | int i, div = 1000000; |
336 | for (i = 0; i < freq->e; i++) | 350 | for (i = 0; i < freq->e; i++) |
337 | div /= 10; | 351 | div /= 10; |
338 | if (div > 0) | 352 | if (div > 0) |
339 | return ieee80211_set_freq(local, freq->m / div); | 353 | return ieee80211_set_freq(dev, freq->m / div); |
340 | else | 354 | else |
341 | return -EINVAL; | 355 | return -EINVAL; |
342 | } | 356 | } |
@@ -489,9 +503,15 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
489 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 503 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
490 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 504 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
491 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 505 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
492 | ap_addr->sa_family = ARPHRD_ETHER; | 506 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED || |
493 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | 507 | sdata->u.sta.state == IEEE80211_IBSS_JOINED) { |
494 | return 0; | 508 | ap_addr->sa_family = ARPHRD_ETHER; |
509 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | ||
510 | return 0; | ||
511 | } else { | ||
512 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | ||
513 | return 0; | ||
514 | } | ||
495 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 515 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
496 | ap_addr->sa_family = ARPHRD_ETHER; | 516 | ap_addr->sa_family = ARPHRD_ETHER; |
497 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 517 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |