aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r--net/mac80211/ieee80211_ioctl.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index f0224c2311d2..a57fed77db27 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -306,9 +306,12 @@ int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq)
306 ((chan->chan == channel) || (chan->freq == freq))) { 306 ((chan->chan == channel) || (chan->freq == freq))) {
307 local->oper_channel = chan; 307 local->oper_channel = chan;
308 local->oper_hw_mode = mode; 308 local->oper_hw_mode = mode;
309 set++; 309 set = 1;
310 break;
310 } 311 }
311 } 312 }
313 if (set)
314 break;
312 } 315 }
313 316
314 if (set) { 317 if (set) {
@@ -508,32 +511,40 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
508 511
509static int ieee80211_ioctl_siwscan(struct net_device *dev, 512static int ieee80211_ioctl_siwscan(struct net_device *dev,
510 struct iw_request_info *info, 513 struct iw_request_info *info,
511 struct iw_point *data, char *extra) 514 union iwreq_data *wrqu, char *extra)
512{ 515{
513 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 516 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
514 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 517 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
518 struct iw_scan_req *req = NULL;
515 u8 *ssid = NULL; 519 u8 *ssid = NULL;
516 size_t ssid_len = 0; 520 size_t ssid_len = 0;
517 521
518 if (!netif_running(dev)) 522 if (!netif_running(dev))
519 return -ENETDOWN; 523 return -ENETDOWN;
520 524
521 switch (sdata->type) { 525 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
522 case IEEE80211_IF_TYPE_STA: 526 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
523 case IEEE80211_IF_TYPE_IBSS: 527 req = (struct iw_scan_req *)extra;
524 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) { 528 ssid = req->essid;
525 ssid = sdata->u.sta.ssid; 529 ssid_len = req->essid_len;
526 ssid_len = sdata->u.sta.ssid_len; 530 } else {
527 } 531 switch (sdata->type) {
528 break; 532 case IEEE80211_IF_TYPE_STA:
529 case IEEE80211_IF_TYPE_AP: 533 case IEEE80211_IF_TYPE_IBSS:
530 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) { 534 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
531 ssid = sdata->u.ap.ssid; 535 ssid = sdata->u.sta.ssid;
532 ssid_len = sdata->u.ap.ssid_len; 536 ssid_len = sdata->u.sta.ssid_len;
537 }
538 break;
539 case IEEE80211_IF_TYPE_AP:
540 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
541 ssid = sdata->u.ap.ssid;
542 ssid_len = sdata->u.ap.ssid_len;
543 }
544 break;
545 default:
546 return -EOPNOTSUPP;
533 } 547 }
534 break;
535 default:
536 return -EOPNOTSUPP;
537 } 548 }
538 549
539 return ieee80211_sta_req_scan(dev, ssid, ssid_len); 550 return ieee80211_sta_req_scan(dev, ssid, ssid_len);