aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-09 20:33:45 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-09 20:33:45 -0400
commitea6a634ef7f0ab1d1f48ba0ad4f50e96d6065312 (patch)
treefbf291540b824183e0d9292906e9570fd344ebaa /net
parentfa1a9c681377c57e233038e50479e7d7a5cc3108 (diff)
parentb2e3abdc708f8c0eff194af25362fdb239abe241 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'net')
-rw-r--r--net/wireless/Kconfig11
-rw-r--r--net/wireless/scan.c41
2 files changed, 44 insertions, 8 deletions
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 68c504fab122..abf7ca3f9ff9 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -1,6 +1,15 @@
1config CFG80211 1config CFG80211
2 tristate "Improved wireless configuration API" 2 tristate "cfg80211 - wireless configuration API"
3 depends on RFKILL || !RFKILL 3 depends on RFKILL || !RFKILL
4 ---help---
5 cfg80211 is the Linux wireless LAN (802.11) configuration API.
6 Enable this if you have a wireless device.
7
8 For more information refer to documentation on the wireless wiki:
9
10 http://wireless.kernel.org/en/developers/Documentation/cfg80211
11
12 When built as a module it will be called cfg80211.
4 13
5config NL80211_TESTMODE 14config NL80211_TESTMODE
6 bool "nl80211 testmode command" 15 bool "nl80211 testmode command"
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 19c5a9a8d085..4c210c2debc6 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -607,6 +607,9 @@ int cfg80211_wext_siwscan(struct net_device *dev,
607 if (!netif_running(dev)) 607 if (!netif_running(dev))
608 return -ENETDOWN; 608 return -ENETDOWN;
609 609
610 if (wrqu->data.length == sizeof(struct iw_scan_req))
611 wreq = (struct iw_scan_req *)extra;
612
610 rdev = cfg80211_get_dev_from_ifindex(dev_net(dev), dev->ifindex); 613 rdev = cfg80211_get_dev_from_ifindex(dev_net(dev), dev->ifindex);
611 614
612 if (IS_ERR(rdev)) 615 if (IS_ERR(rdev))
@@ -619,9 +622,14 @@ int cfg80211_wext_siwscan(struct net_device *dev,
619 622
620 wiphy = &rdev->wiphy; 623 wiphy = &rdev->wiphy;
621 624
622 for (band = 0; band < IEEE80211_NUM_BANDS; band++) 625 /* Determine number of channels, needed to allocate creq */
623 if (wiphy->bands[band]) 626 if (wreq && wreq->num_channels)
624 n_channels += wiphy->bands[band]->n_channels; 627 n_channels = wreq->num_channels;
628 else {
629 for (band = 0; band < IEEE80211_NUM_BANDS; band++)
630 if (wiphy->bands[band])
631 n_channels += wiphy->bands[band]->n_channels;
632 }
625 633
626 creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) + 634 creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
627 n_channels * sizeof(void *), 635 n_channels * sizeof(void *),
@@ -638,22 +646,41 @@ int cfg80211_wext_siwscan(struct net_device *dev,
638 creq->n_channels = n_channels; 646 creq->n_channels = n_channels;
639 creq->n_ssids = 1; 647 creq->n_ssids = 1;
640 648
641 /* all channels */ 649 /* translate "Scan on frequencies" request */
642 i = 0; 650 i = 0;
643 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 651 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
644 int j; 652 int j;
645 if (!wiphy->bands[band]) 653 if (!wiphy->bands[band])
646 continue; 654 continue;
647 for (j = 0; j < wiphy->bands[band]->n_channels; j++) { 655 for (j = 0; j < wiphy->bands[band]->n_channels; j++) {
656
657 /* If we have a wireless request structure and the
658 * wireless request specifies frequencies, then search
659 * for the matching hardware channel.
660 */
661 if (wreq && wreq->num_channels) {
662 int k;
663 int wiphy_freq = wiphy->bands[band]->channels[j].center_freq;
664 for (k = 0; k < wreq->num_channels; k++) {
665 int wext_freq = wreq->channel_list[k].m / 100000;
666 if (wext_freq == wiphy_freq)
667 goto wext_freq_found;
668 }
669 goto wext_freq_not_found;
670 }
671
672 wext_freq_found:
648 creq->channels[i] = &wiphy->bands[band]->channels[j]; 673 creq->channels[i] = &wiphy->bands[band]->channels[j];
649 i++; 674 i++;
675 wext_freq_not_found: ;
650 } 676 }
651 } 677 }
652 678
653 /* translate scan request */ 679 /* Set real number of channels specified in creq->channels[] */
654 if (wrqu->data.length == sizeof(struct iw_scan_req)) { 680 creq->n_channels = i;
655 wreq = (struct iw_scan_req *)extra;
656 681
682 /* translate "Scan for SSID" request */
683 if (wreq) {
657 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { 684 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
658 if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) 685 if (wreq->essid_len > IEEE80211_MAX_SSID_LEN)
659 return -EINVAL; 686 return -EINVAL;