aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2007-10-18 00:16:16 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-18 00:16:16 -0400
commitd114f399b4da6fa7f9da3bbf1fb841370c11e788 (patch)
treeab569d2e02627652791e6953905e59f828652a7b
parentfe537c0ee86b27fbe0690a7869815da80f492dbd (diff)
[MAC80211]: only honor IW_SCAN_THIS_ESSID in STA, IBSS, and AP modes
The previous IW_SCAN_THIS_ESSID patch left a hole allowing scan requests on interfaces in inappropriate modes. Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/mac80211/ieee80211_ioctl.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index a57fed77db27..6caa3ec2cff7 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -522,29 +522,30 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
522 if (!netif_running(dev)) 522 if (!netif_running(dev))
523 return -ENETDOWN; 523 return -ENETDOWN;
524 524
525 switch (sdata->type) {
526 case IEEE80211_IF_TYPE_STA:
527 case IEEE80211_IF_TYPE_IBSS:
528 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
529 ssid = sdata->u.sta.ssid;
530 ssid_len = sdata->u.sta.ssid_len;
531 }
532 break;
533 case IEEE80211_IF_TYPE_AP:
534 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
535 ssid = sdata->u.ap.ssid;
536 ssid_len = sdata->u.ap.ssid_len;
537 }
538 break;
539 default:
540 return -EOPNOTSUPP;
541 }
542
543 /* if SSID was specified explicitly then use that */
525 if (wrqu->data.length == sizeof(struct iw_scan_req) && 544 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
526 wrqu->data.flags & IW_SCAN_THIS_ESSID) { 545 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
527 req = (struct iw_scan_req *)extra; 546 req = (struct iw_scan_req *)extra;
528 ssid = req->essid; 547 ssid = req->essid;
529 ssid_len = req->essid_len; 548 ssid_len = req->essid_len;
530 } else {
531 switch (sdata->type) {
532 case IEEE80211_IF_TYPE_STA:
533 case IEEE80211_IF_TYPE_IBSS:
534 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
535 ssid = sdata->u.sta.ssid;
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;
547 }
548 } 549 }
549 550
550 return ieee80211_sta_req_scan(dev, ssid, ssid_len); 551 return ieee80211_sta_req_scan(dev, ssid, ssid_len);