2 * cfg80211 scan result handling
4 * Copyright 2008 Johannes Berg <johannes@sipsolutions.net>
6 #include <linux/kernel.h>
7 #include <linux/slab.h>
8 #include <linux/module.h>
9 #include <linux/netdevice.h>
10 #include <linux/wireless.h>
11 #include <linux/nl80211.h>
12 #include <linux/etherdevice.h>
14 #include <net/cfg80211.h>
15 #include <net/cfg80211-wext.h>
16 #include <net/iw_handler.h>
19 #include "wext-compat.h"
23 * DOC: BSS tree/list structure
25 * At the top level, the BSS list is kept in both a list in each
26 * registered device (@bss_list) as well as an RB-tree for faster
27 * lookup. In the RB-tree, entries can be looked up using their
28 * channel, MESHID, MESHCONF (for MBSSes) or channel, BSSID, SSID
31 * Due to the possibility of hidden SSIDs, there's a second level
32 * structure, the "hidden_list" and "hidden_beacon_bss" pointer.
33 * The hidden_list connects all BSSes belonging to a single AP
34 * that has a hidden SSID, and connects beacon and probe response
35 * entries. For a probe response entry for a hidden SSID, the
36 * hidden_beacon_bss pointer points to the BSS struct holding the
37 * beacon's information.
39 * Reference counting is done for all these references except for
40 * the hidden_list, so that a beacon BSS struct that is otherwise
41 * not referenced has one reference for being on the bss_list and
42 * one for each probe response entry that points to it using the
43 * hidden_beacon_bss pointer. When a BSS struct that has such a
44 * pointer is get/put, the refcount update is also propagated to
45 * the referenced struct, this ensure that it cannot get removed
46 * while somebody is using the probe response version.
48 * Note that the hidden_beacon_bss pointer never changes, due to
49 * the reference counting. Therefore, no locking is needed for
52 * Also note that the hidden_beacon_bss pointer is only relevant
53 * if the driver uses something other than the IEs, e.g. private
54 * data stored stored in the BSS struct, since the beacon IEs are
55 * also linked into the probe response struct.
58 #define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ)
60 static void bss_free(struct cfg80211_internal_bss
*bss
)
62 struct cfg80211_bss_ies
*ies
;
64 if (WARN_ON(atomic_read(&bss
->hold
)))
67 ies
= (void *)rcu_access_pointer(bss
->pub
.beacon_ies
);
68 if (ies
&& !bss
->pub
.hidden_beacon_bss
)
69 kfree_rcu(ies
, rcu_head
);
70 ies
= (void *)rcu_access_pointer(bss
->pub
.proberesp_ies
);
72 kfree_rcu(ies
, rcu_head
);
75 * This happens when the module is removed, it doesn't
76 * really matter any more save for completeness
78 if (!list_empty(&bss
->hidden_list
))
79 list_del(&bss
->hidden_list
);
84 static inline void bss_ref_get(struct cfg80211_registered_device
*dev
,
85 struct cfg80211_internal_bss
*bss
)
87 lockdep_assert_held(&dev
->bss_lock
);
90 if (bss
->pub
.hidden_beacon_bss
) {
91 bss
= container_of(bss
->pub
.hidden_beacon_bss
,
92 struct cfg80211_internal_bss
,
98 static inline void bss_ref_put(struct cfg80211_registered_device
*dev
,
99 struct cfg80211_internal_bss
*bss
)
101 lockdep_assert_held(&dev
->bss_lock
);
103 if (bss
->pub
.hidden_beacon_bss
) {
104 struct cfg80211_internal_bss
*hbss
;
105 hbss
= container_of(bss
->pub
.hidden_beacon_bss
,
106 struct cfg80211_internal_bss
,
109 if (hbss
->refcount
== 0)
113 if (bss
->refcount
== 0)
117 static bool __cfg80211_unlink_bss(struct cfg80211_registered_device
*dev
,
118 struct cfg80211_internal_bss
*bss
)
120 lockdep_assert_held(&dev
->bss_lock
);
122 if (!list_empty(&bss
->hidden_list
)) {
124 * don't remove the beacon entry if it has
125 * probe responses associated with it
127 if (!bss
->pub
.hidden_beacon_bss
)
130 * if it's a probe response entry break its
131 * link to the other entries in the group
133 list_del_init(&bss
->hidden_list
);
136 list_del_init(&bss
->list
);
137 rb_erase(&bss
->rbn
, &dev
->bss_tree
);
138 bss_ref_put(dev
, bss
);
142 static void __cfg80211_bss_expire(struct cfg80211_registered_device
*dev
,
143 unsigned long expire_time
)
145 struct cfg80211_internal_bss
*bss
, *tmp
;
146 bool expired
= false;
148 lockdep_assert_held(&dev
->bss_lock
);
150 list_for_each_entry_safe(bss
, tmp
, &dev
->bss_list
, list
) {
151 if (atomic_read(&bss
->hold
))
153 if (!time_after(expire_time
, bss
->ts
))
156 if (__cfg80211_unlink_bss(dev
, bss
))
161 dev
->bss_generation
++;
164 void ___cfg80211_scan_done(struct cfg80211_registered_device
*rdev
, bool leak
)
166 struct cfg80211_scan_request
*request
;
167 struct wireless_dev
*wdev
;
168 #ifdef CONFIG_CFG80211_WEXT
169 union iwreq_data wrqu
;
174 request
= rdev
->scan_req
;
179 wdev
= request
->wdev
;
182 * This must be before sending the other events!
183 * Otherwise, wpa_supplicant gets completely confused with
187 cfg80211_sme_scan_done(wdev
->netdev
);
189 if (request
->aborted
) {
190 nl80211_send_scan_aborted(rdev
, wdev
);
192 if (request
->flags
& NL80211_SCAN_FLAG_FLUSH
) {
193 /* flush entries from previous scans */
194 spin_lock_bh(&rdev
->bss_lock
);
195 __cfg80211_bss_expire(rdev
, request
->scan_start
);
196 spin_unlock_bh(&rdev
->bss_lock
);
198 nl80211_send_scan_done(rdev
, wdev
);
201 #ifdef CONFIG_CFG80211_WEXT
202 if (wdev
->netdev
&& !request
->aborted
) {
203 memset(&wrqu
, 0, sizeof(wrqu
));
205 wireless_send_event(wdev
->netdev
, SIOCGIWSCAN
, &wrqu
, NULL
);
210 dev_put(wdev
->netdev
);
212 rdev
->scan_req
= NULL
;
215 * OK. If this is invoked with "leak" then we can't
216 * free this ... but we've cleaned it up anyway. The
217 * driver failed to call the scan_done callback, so
218 * all bets are off, it might still be trying to use
219 * the scan request or not ... if it accesses the dev
220 * in there (it shouldn't anyway) then it may crash.
226 void __cfg80211_scan_done(struct work_struct
*wk
)
228 struct cfg80211_registered_device
*rdev
;
230 rdev
= container_of(wk
, struct cfg80211_registered_device
,
234 ___cfg80211_scan_done(rdev
, false);
238 void cfg80211_scan_done(struct cfg80211_scan_request
*request
, bool aborted
)
240 trace_cfg80211_scan_done(request
, aborted
);
241 WARN_ON(request
!= wiphy_to_dev(request
->wiphy
)->scan_req
);
243 request
->aborted
= aborted
;
244 request
->notified
= true;
245 queue_work(cfg80211_wq
, &wiphy_to_dev(request
->wiphy
)->scan_done_wk
);
247 EXPORT_SYMBOL(cfg80211_scan_done
);
249 void __cfg80211_sched_scan_results(struct work_struct
*wk
)
251 struct cfg80211_registered_device
*rdev
;
252 struct cfg80211_sched_scan_request
*request
;
254 rdev
= container_of(wk
, struct cfg80211_registered_device
,
255 sched_scan_results_wk
);
257 request
= rdev
->sched_scan_req
;
261 /* we don't have sched_scan_req anymore if the scan is stopping */
263 if (request
->flags
& NL80211_SCAN_FLAG_FLUSH
) {
264 /* flush entries from previous scans */
265 spin_lock_bh(&rdev
->bss_lock
);
266 __cfg80211_bss_expire(rdev
, request
->scan_start
);
267 spin_unlock_bh(&rdev
->bss_lock
);
268 request
->scan_start
=
269 jiffies
+ msecs_to_jiffies(request
->interval
);
271 nl80211_send_sched_scan_results(rdev
, request
->dev
);
277 void cfg80211_sched_scan_results(struct wiphy
*wiphy
)
279 trace_cfg80211_sched_scan_results(wiphy
);
280 /* ignore if we're not scanning */
281 if (wiphy_to_dev(wiphy
)->sched_scan_req
)
282 queue_work(cfg80211_wq
,
283 &wiphy_to_dev(wiphy
)->sched_scan_results_wk
);
285 EXPORT_SYMBOL(cfg80211_sched_scan_results
);
287 void cfg80211_sched_scan_stopped(struct wiphy
*wiphy
)
289 struct cfg80211_registered_device
*rdev
= wiphy_to_dev(wiphy
);
291 trace_cfg80211_sched_scan_stopped(wiphy
);
294 __cfg80211_stop_sched_scan(rdev
, true);
297 EXPORT_SYMBOL(cfg80211_sched_scan_stopped
);
299 int __cfg80211_stop_sched_scan(struct cfg80211_registered_device
*rdev
,
300 bool driver_initiated
)
302 struct net_device
*dev
;
306 if (!rdev
->sched_scan_req
)
309 dev
= rdev
->sched_scan_req
->dev
;
311 if (!driver_initiated
) {
312 int err
= rdev_sched_scan_stop(rdev
, dev
);
317 nl80211_send_sched_scan(rdev
, dev
, NL80211_CMD_SCHED_SCAN_STOPPED
);
319 kfree(rdev
->sched_scan_req
);
320 rdev
->sched_scan_req
= NULL
;
325 void cfg80211_bss_age(struct cfg80211_registered_device
*dev
,
326 unsigned long age_secs
)
328 struct cfg80211_internal_bss
*bss
;
329 unsigned long age_jiffies
= msecs_to_jiffies(age_secs
* MSEC_PER_SEC
);
331 spin_lock_bh(&dev
->bss_lock
);
332 list_for_each_entry(bss
, &dev
->bss_list
, list
)
333 bss
->ts
-= age_jiffies
;
334 spin_unlock_bh(&dev
->bss_lock
);
337 void cfg80211_bss_expire(struct cfg80211_registered_device
*dev
)
339 __cfg80211_bss_expire(dev
, jiffies
- IEEE80211_SCAN_RESULT_EXPIRE
);
342 const u8
*cfg80211_find_ie(u8 eid
, const u8
*ies
, int len
)
344 while (len
> 2 && ies
[0] != eid
) {
350 if (len
< 2 + ies
[1])
354 EXPORT_SYMBOL(cfg80211_find_ie
);
356 const u8
*cfg80211_find_vendor_ie(unsigned int oui
, u8 oui_type
,
357 const u8
*ies
, int len
)
359 struct ieee80211_vendor_ie
*ie
;
360 const u8
*pos
= ies
, *end
= ies
+ len
;
364 pos
= cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC
, pos
,
369 ie
= (struct ieee80211_vendor_ie
*)pos
;
371 /* make sure we can access ie->len */
372 BUILD_BUG_ON(offsetof(struct ieee80211_vendor_ie
, len
) != 1);
374 if (ie
->len
< sizeof(*ie
))
377 ie_oui
= ie
->oui
[0] << 16 | ie
->oui
[1] << 8 | ie
->oui
[2];
378 if (ie_oui
== oui
&& ie
->oui_type
== oui_type
)
385 EXPORT_SYMBOL(cfg80211_find_vendor_ie
);
387 static bool is_bss(struct cfg80211_bss
*a
, const u8
*bssid
,
388 const u8
*ssid
, size_t ssid_len
)
390 const struct cfg80211_bss_ies
*ies
;
393 if (bssid
&& !ether_addr_equal(a
->bssid
, bssid
))
399 ies
= rcu_access_pointer(a
->ies
);
402 ssidie
= cfg80211_find_ie(WLAN_EID_SSID
, ies
->data
, ies
->len
);
405 if (ssidie
[1] != ssid_len
)
407 return memcmp(ssidie
+ 2, ssid
, ssid_len
) == 0;
411 * enum bss_compare_mode - BSS compare mode
412 * @BSS_CMP_REGULAR: regular compare mode (for insertion and normal find)
413 * @BSS_CMP_HIDE_ZLEN: find hidden SSID with zero-length mode
414 * @BSS_CMP_HIDE_NUL: find hidden SSID with NUL-ed out mode
416 enum bss_compare_mode
{
422 static int cmp_bss(struct cfg80211_bss
*a
,
423 struct cfg80211_bss
*b
,
424 enum bss_compare_mode mode
)
426 const struct cfg80211_bss_ies
*a_ies
, *b_ies
;
427 const u8
*ie1
= NULL
;
428 const u8
*ie2
= NULL
;
431 if (a
->channel
!= b
->channel
)
432 return b
->channel
->center_freq
- a
->channel
->center_freq
;
434 a_ies
= rcu_access_pointer(a
->ies
);
437 b_ies
= rcu_access_pointer(b
->ies
);
441 if (WLAN_CAPABILITY_IS_STA_BSS(a
->capability
))
442 ie1
= cfg80211_find_ie(WLAN_EID_MESH_ID
,
443 a_ies
->data
, a_ies
->len
);
444 if (WLAN_CAPABILITY_IS_STA_BSS(b
->capability
))
445 ie2
= cfg80211_find_ie(WLAN_EID_MESH_ID
,
446 b_ies
->data
, b_ies
->len
);
450 if (ie1
[1] == ie2
[1])
451 mesh_id_cmp
= memcmp(ie1
+ 2, ie2
+ 2, ie1
[1]);
453 mesh_id_cmp
= ie2
[1] - ie1
[1];
455 ie1
= cfg80211_find_ie(WLAN_EID_MESH_CONFIG
,
456 a_ies
->data
, a_ies
->len
);
457 ie2
= cfg80211_find_ie(WLAN_EID_MESH_CONFIG
,
458 b_ies
->data
, b_ies
->len
);
462 if (ie1
[1] != ie2
[1])
463 return ie2
[1] - ie1
[1];
464 return memcmp(ie1
+ 2, ie2
+ 2, ie1
[1]);
469 * we can't use compare_ether_addr here since we need a < > operator.
470 * The binary return value of compare_ether_addr isn't enough
472 r
= memcmp(a
->bssid
, b
->bssid
, sizeof(a
->bssid
));
476 ie1
= cfg80211_find_ie(WLAN_EID_SSID
, a_ies
->data
, a_ies
->len
);
477 ie2
= cfg80211_find_ie(WLAN_EID_SSID
, b_ies
->data
, b_ies
->len
);
483 * Note that with "hide_ssid", the function returns a match if
484 * the already-present BSS ("b") is a hidden SSID beacon for
488 /* sort missing IE before (left of) present IE */
495 case BSS_CMP_HIDE_ZLEN
:
497 * In ZLEN mode we assume the BSS entry we're
498 * looking for has a zero-length SSID. So if
499 * the one we're looking at right now has that,
500 * return 0. Otherwise, return the difference
501 * in length, but since we're looking for the
502 * 0-length it's really equivalent to returning
503 * the length of the one we're looking at.
505 * No content comparison is needed as we assume
506 * the content length is zero.
509 case BSS_CMP_REGULAR
:
511 /* sort by length first, then by contents */
512 if (ie1
[1] != ie2
[1])
513 return ie2
[1] - ie1
[1];
514 return memcmp(ie1
+ 2, ie2
+ 2, ie1
[1]);
515 case BSS_CMP_HIDE_NUL
:
516 if (ie1
[1] != ie2
[1])
517 return ie2
[1] - ie1
[1];
518 /* this is equivalent to memcmp(zeroes, ie2 + 2, len) */
519 for (i
= 0; i
< ie2
[1]; i
++)
526 /* Returned bss is reference counted and must be cleaned up appropriately. */
527 struct cfg80211_bss
*cfg80211_get_bss(struct wiphy
*wiphy
,
528 struct ieee80211_channel
*channel
,
530 const u8
*ssid
, size_t ssid_len
,
531 u16 capa_mask
, u16 capa_val
)
533 struct cfg80211_registered_device
*dev
= wiphy_to_dev(wiphy
);
534 struct cfg80211_internal_bss
*bss
, *res
= NULL
;
535 unsigned long now
= jiffies
;
537 trace_cfg80211_get_bss(wiphy
, channel
, bssid
, ssid
, ssid_len
, capa_mask
,
540 spin_lock_bh(&dev
->bss_lock
);
542 list_for_each_entry(bss
, &dev
->bss_list
, list
) {
543 if ((bss
->pub
.capability
& capa_mask
) != capa_val
)
545 if (channel
&& bss
->pub
.channel
!= channel
)
547 /* Don't get expired BSS structs */
548 if (time_after(now
, bss
->ts
+ IEEE80211_SCAN_RESULT_EXPIRE
) &&
549 !atomic_read(&bss
->hold
))
551 if (is_bss(&bss
->pub
, bssid
, ssid
, ssid_len
)) {
553 bss_ref_get(dev
, res
);
558 spin_unlock_bh(&dev
->bss_lock
);
561 trace_cfg80211_return_bss(&res
->pub
);
564 EXPORT_SYMBOL(cfg80211_get_bss
);
566 static void rb_insert_bss(struct cfg80211_registered_device
*dev
,
567 struct cfg80211_internal_bss
*bss
)
569 struct rb_node
**p
= &dev
->bss_tree
.rb_node
;
570 struct rb_node
*parent
= NULL
;
571 struct cfg80211_internal_bss
*tbss
;
576 tbss
= rb_entry(parent
, struct cfg80211_internal_bss
, rbn
);
578 cmp
= cmp_bss(&bss
->pub
, &tbss
->pub
, BSS_CMP_REGULAR
);
581 /* will sort of leak this BSS */
591 rb_link_node(&bss
->rbn
, parent
, p
);
592 rb_insert_color(&bss
->rbn
, &dev
->bss_tree
);
595 static struct cfg80211_internal_bss
*
596 rb_find_bss(struct cfg80211_registered_device
*dev
,
597 struct cfg80211_internal_bss
*res
,
598 enum bss_compare_mode mode
)
600 struct rb_node
*n
= dev
->bss_tree
.rb_node
;
601 struct cfg80211_internal_bss
*bss
;
605 bss
= rb_entry(n
, struct cfg80211_internal_bss
, rbn
);
606 r
= cmp_bss(&res
->pub
, &bss
->pub
, mode
);
619 static bool cfg80211_combine_bsses(struct cfg80211_registered_device
*dev
,
620 struct cfg80211_internal_bss
*new)
622 const struct cfg80211_bss_ies
*ies
;
623 struct cfg80211_internal_bss
*bss
;
628 ies
= rcu_access_pointer(new->pub
.beacon_ies
);
632 ie
= cfg80211_find_ie(WLAN_EID_SSID
, ies
->data
, ies
->len
);
639 for (i
= 0; i
< ssidlen
; i
++)
643 /* not a hidden SSID */
647 /* This is the bad part ... */
649 list_for_each_entry(bss
, &dev
->bss_list
, list
) {
650 if (!ether_addr_equal(bss
->pub
.bssid
, new->pub
.bssid
))
652 if (bss
->pub
.channel
!= new->pub
.channel
)
654 if (bss
->pub
.scan_width
!= new->pub
.scan_width
)
656 if (rcu_access_pointer(bss
->pub
.beacon_ies
))
658 ies
= rcu_access_pointer(bss
->pub
.ies
);
661 ie
= cfg80211_find_ie(WLAN_EID_SSID
, ies
->data
, ies
->len
);
664 if (ssidlen
&& ie
[1] != ssidlen
)
666 /* that would be odd ... */
667 if (bss
->pub
.beacon_ies
)
669 if (WARN_ON_ONCE(bss
->pub
.hidden_beacon_bss
))
671 if (WARN_ON_ONCE(!list_empty(&bss
->hidden_list
)))
672 list_del(&bss
->hidden_list
);
674 list_add(&bss
->hidden_list
, &new->hidden_list
);
675 bss
->pub
.hidden_beacon_bss
= &new->pub
;
676 new->refcount
+= bss
->refcount
;
677 rcu_assign_pointer(bss
->pub
.beacon_ies
,
678 new->pub
.beacon_ies
);
684 /* Returned bss is reference counted and must be cleaned up appropriately. */
685 static struct cfg80211_internal_bss
*
686 cfg80211_bss_update(struct cfg80211_registered_device
*dev
,
687 struct cfg80211_internal_bss
*tmp
)
689 struct cfg80211_internal_bss
*found
= NULL
;
691 if (WARN_ON(!tmp
->pub
.channel
))
696 spin_lock_bh(&dev
->bss_lock
);
698 if (WARN_ON(!rcu_access_pointer(tmp
->pub
.ies
))) {
699 spin_unlock_bh(&dev
->bss_lock
);
703 found
= rb_find_bss(dev
, tmp
, BSS_CMP_REGULAR
);
707 if (rcu_access_pointer(tmp
->pub
.proberesp_ies
)) {
708 const struct cfg80211_bss_ies
*old
;
710 old
= rcu_access_pointer(found
->pub
.proberesp_ies
);
712 rcu_assign_pointer(found
->pub
.proberesp_ies
,
713 tmp
->pub
.proberesp_ies
);
714 /* Override possible earlier Beacon frame IEs */
715 rcu_assign_pointer(found
->pub
.ies
,
716 tmp
->pub
.proberesp_ies
);
718 kfree_rcu((struct cfg80211_bss_ies
*)old
,
720 } else if (rcu_access_pointer(tmp
->pub
.beacon_ies
)) {
721 const struct cfg80211_bss_ies
*old
;
722 struct cfg80211_internal_bss
*bss
;
724 if (found
->pub
.hidden_beacon_bss
&&
725 !list_empty(&found
->hidden_list
)) {
726 const struct cfg80211_bss_ies
*f
;
729 * The found BSS struct is one of the probe
730 * response members of a group, but we're
731 * receiving a beacon (beacon_ies in the tmp
732 * bss is used). This can only mean that the
733 * AP changed its beacon from not having an
734 * SSID to showing it, which is confusing so
735 * drop this information.
738 f
= rcu_access_pointer(tmp
->pub
.beacon_ies
);
739 kfree_rcu((struct cfg80211_bss_ies
*)f
,
744 old
= rcu_access_pointer(found
->pub
.beacon_ies
);
746 rcu_assign_pointer(found
->pub
.beacon_ies
,
747 tmp
->pub
.beacon_ies
);
749 /* Override IEs if they were from a beacon before */
750 if (old
== rcu_access_pointer(found
->pub
.ies
))
751 rcu_assign_pointer(found
->pub
.ies
,
752 tmp
->pub
.beacon_ies
);
754 /* Assign beacon IEs to all sub entries */
755 list_for_each_entry(bss
, &found
->hidden_list
,
757 const struct cfg80211_bss_ies
*ies
;
759 ies
= rcu_access_pointer(bss
->pub
.beacon_ies
);
762 rcu_assign_pointer(bss
->pub
.beacon_ies
,
763 tmp
->pub
.beacon_ies
);
767 kfree_rcu((struct cfg80211_bss_ies
*)old
,
771 found
->pub
.beacon_interval
= tmp
->pub
.beacon_interval
;
772 found
->pub
.signal
= tmp
->pub
.signal
;
773 found
->pub
.capability
= tmp
->pub
.capability
;
776 struct cfg80211_internal_bss
*new;
777 struct cfg80211_internal_bss
*hidden
;
778 struct cfg80211_bss_ies
*ies
;
781 * create a copy -- the "res" variable that is passed in
782 * is allocated on the stack since it's not needed in the
783 * more common case of an update
785 new = kzalloc(sizeof(*new) + dev
->wiphy
.bss_priv_size
,
788 ies
= (void *)rcu_dereference(tmp
->pub
.beacon_ies
);
790 kfree_rcu(ies
, rcu_head
);
791 ies
= (void *)rcu_dereference(tmp
->pub
.proberesp_ies
);
793 kfree_rcu(ies
, rcu_head
);
796 memcpy(new, tmp
, sizeof(*new));
798 INIT_LIST_HEAD(&new->hidden_list
);
800 if (rcu_access_pointer(tmp
->pub
.proberesp_ies
)) {
801 hidden
= rb_find_bss(dev
, tmp
, BSS_CMP_HIDE_ZLEN
);
803 hidden
= rb_find_bss(dev
, tmp
,
806 new->pub
.hidden_beacon_bss
= &hidden
->pub
;
807 list_add(&new->hidden_list
,
808 &hidden
->hidden_list
);
810 rcu_assign_pointer(new->pub
.beacon_ies
,
811 hidden
->pub
.beacon_ies
);
815 * Ok so we found a beacon, and don't have an entry. If
816 * it's a beacon with hidden SSID, we might be in for an
817 * expensive search for any probe responses that should
818 * be grouped with this beacon for updates ...
820 if (!cfg80211_combine_bsses(dev
, new)) {
826 list_add_tail(&new->list
, &dev
->bss_list
);
827 rb_insert_bss(dev
, new);
831 dev
->bss_generation
++;
832 bss_ref_get(dev
, found
);
833 spin_unlock_bh(&dev
->bss_lock
);
837 spin_unlock_bh(&dev
->bss_lock
);
841 static struct ieee80211_channel
*
842 cfg80211_get_bss_channel(struct wiphy
*wiphy
, const u8
*ie
, size_t ielen
,
843 struct ieee80211_channel
*channel
)
847 int channel_number
= -1;
849 tmp
= cfg80211_find_ie(WLAN_EID_DS_PARAMS
, ie
, ielen
);
850 if (tmp
&& tmp
[1] == 1) {
851 channel_number
= tmp
[2];
853 tmp
= cfg80211_find_ie(WLAN_EID_HT_OPERATION
, ie
, ielen
);
854 if (tmp
&& tmp
[1] >= sizeof(struct ieee80211_ht_operation
)) {
855 struct ieee80211_ht_operation
*htop
= (void *)(tmp
+ 2);
857 channel_number
= htop
->primary_chan
;
861 if (channel_number
< 0)
864 freq
= ieee80211_channel_to_frequency(channel_number
, channel
->band
);
865 channel
= ieee80211_get_channel(wiphy
, freq
);
868 if (channel
->flags
& IEEE80211_CHAN_DISABLED
)
873 /* Returned bss is reference counted and must be cleaned up appropriately. */
875 cfg80211_inform_bss_width(struct wiphy
*wiphy
,
876 struct ieee80211_channel
*channel
,
877 enum nl80211_bss_scan_width scan_width
,
878 const u8
*bssid
, u64 tsf
, u16 capability
,
879 u16 beacon_interval
, const u8
*ie
, size_t ielen
,
880 s32 signal
, gfp_t gfp
)
882 struct cfg80211_bss_ies
*ies
;
883 struct cfg80211_internal_bss tmp
= {}, *res
;
888 if (WARN_ON(wiphy
->signal_type
== CFG80211_SIGNAL_TYPE_UNSPEC
&&
889 (signal
< 0 || signal
> 100)))
892 channel
= cfg80211_get_bss_channel(wiphy
, ie
, ielen
, channel
);
896 memcpy(tmp
.pub
.bssid
, bssid
, ETH_ALEN
);
897 tmp
.pub
.channel
= channel
;
898 tmp
.pub
.scan_width
= scan_width
;
899 tmp
.pub
.signal
= signal
;
900 tmp
.pub
.beacon_interval
= beacon_interval
;
901 tmp
.pub
.capability
= capability
;
903 * Since we do not know here whether the IEs are from a Beacon or Probe
904 * Response frame, we need to pick one of the options and only use it
905 * with the driver that does not provide the full Beacon/Probe Response
906 * frame. Use Beacon frame pointer to avoid indicating that this should
907 * override the IEs pointer should we have received an earlier
908 * indication of Probe Response data.
910 ies
= kmalloc(sizeof(*ies
) + ielen
, gfp
);
915 memcpy(ies
->data
, ie
, ielen
);
917 rcu_assign_pointer(tmp
.pub
.beacon_ies
, ies
);
918 rcu_assign_pointer(tmp
.pub
.ies
, ies
);
920 res
= cfg80211_bss_update(wiphy_to_dev(wiphy
), &tmp
);
924 if (res
->pub
.capability
& WLAN_CAPABILITY_ESS
)
925 regulatory_hint_found_beacon(wiphy
, channel
, gfp
);
927 trace_cfg80211_return_bss(&res
->pub
);
928 /* cfg80211_bss_update gives us a referenced result */
931 EXPORT_SYMBOL(cfg80211_inform_bss_width
);
933 /* Returned bss is reference counted and must be cleaned up appropriately. */
934 struct cfg80211_bss
*
935 cfg80211_inform_bss_width_frame(struct wiphy
*wiphy
,
936 struct ieee80211_channel
*channel
,
937 enum nl80211_bss_scan_width scan_width
,
938 struct ieee80211_mgmt
*mgmt
, size_t len
,
939 s32 signal
, gfp_t gfp
)
941 struct cfg80211_internal_bss tmp
= {}, *res
;
942 struct cfg80211_bss_ies
*ies
;
943 size_t ielen
= len
- offsetof(struct ieee80211_mgmt
,
944 u
.probe_resp
.variable
);
946 BUILD_BUG_ON(offsetof(struct ieee80211_mgmt
, u
.probe_resp
.variable
) !=
947 offsetof(struct ieee80211_mgmt
, u
.beacon
.variable
));
949 trace_cfg80211_inform_bss_width_frame(wiphy
, channel
, scan_width
, mgmt
,
958 if (WARN_ON(wiphy
->signal_type
== CFG80211_SIGNAL_TYPE_UNSPEC
&&
959 (signal
< 0 || signal
> 100)))
962 if (WARN_ON(len
< offsetof(struct ieee80211_mgmt
, u
.probe_resp
.variable
)))
965 channel
= cfg80211_get_bss_channel(wiphy
, mgmt
->u
.beacon
.variable
,
970 ies
= kmalloc(sizeof(*ies
) + ielen
, gfp
);
974 ies
->tsf
= le64_to_cpu(mgmt
->u
.probe_resp
.timestamp
);
975 memcpy(ies
->data
, mgmt
->u
.probe_resp
.variable
, ielen
);
977 if (ieee80211_is_probe_resp(mgmt
->frame_control
))
978 rcu_assign_pointer(tmp
.pub
.proberesp_ies
, ies
);
980 rcu_assign_pointer(tmp
.pub
.beacon_ies
, ies
);
981 rcu_assign_pointer(tmp
.pub
.ies
, ies
);
983 memcpy(tmp
.pub
.bssid
, mgmt
->bssid
, ETH_ALEN
);
984 tmp
.pub
.channel
= channel
;
985 tmp
.pub
.scan_width
= scan_width
;
986 tmp
.pub
.signal
= signal
;
987 tmp
.pub
.beacon_interval
= le16_to_cpu(mgmt
->u
.probe_resp
.beacon_int
);
988 tmp
.pub
.capability
= le16_to_cpu(mgmt
->u
.probe_resp
.capab_info
);
990 res
= cfg80211_bss_update(wiphy_to_dev(wiphy
), &tmp
);
994 if (res
->pub
.capability
& WLAN_CAPABILITY_ESS
)
995 regulatory_hint_found_beacon(wiphy
, channel
, gfp
);
997 trace_cfg80211_return_bss(&res
->pub
);
998 /* cfg80211_bss_update gives us a referenced result */
1001 EXPORT_SYMBOL(cfg80211_inform_bss_width_frame
);
1003 void cfg80211_ref_bss(struct wiphy
*wiphy
, struct cfg80211_bss
*pub
)
1005 struct cfg80211_registered_device
*dev
= wiphy_to_dev(wiphy
);
1006 struct cfg80211_internal_bss
*bss
;
1011 bss
= container_of(pub
, struct cfg80211_internal_bss
, pub
);
1013 spin_lock_bh(&dev
->bss_lock
);
1014 bss_ref_get(dev
, bss
);
1015 spin_unlock_bh(&dev
->bss_lock
);
1017 EXPORT_SYMBOL(cfg80211_ref_bss
);
1019 void cfg80211_put_bss(struct wiphy
*wiphy
, struct cfg80211_bss
*pub
)
1021 struct cfg80211_registered_device
*dev
= wiphy_to_dev(wiphy
);
1022 struct cfg80211_internal_bss
*bss
;
1027 bss
= container_of(pub
, struct cfg80211_internal_bss
, pub
);
1029 spin_lock_bh(&dev
->bss_lock
);
1030 bss_ref_put(dev
, bss
);
1031 spin_unlock_bh(&dev
->bss_lock
);
1033 EXPORT_SYMBOL(cfg80211_put_bss
);
1035 void cfg80211_unlink_bss(struct wiphy
*wiphy
, struct cfg80211_bss
*pub
)
1037 struct cfg80211_registered_device
*dev
= wiphy_to_dev(wiphy
);
1038 struct cfg80211_internal_bss
*bss
;
1043 bss
= container_of(pub
, struct cfg80211_internal_bss
, pub
);
1045 spin_lock_bh(&dev
->bss_lock
);
1046 if (!list_empty(&bss
->list
)) {
1047 if (__cfg80211_unlink_bss(dev
, bss
))
1048 dev
->bss_generation
++;
1050 spin_unlock_bh(&dev
->bss_lock
);
1052 EXPORT_SYMBOL(cfg80211_unlink_bss
);
1054 #ifdef CONFIG_CFG80211_WEXT
1055 static struct cfg80211_registered_device
*
1056 cfg80211_get_dev_from_ifindex(struct net
*net
, int ifindex
)
1058 struct cfg80211_registered_device
*rdev
;
1059 struct net_device
*dev
;
1063 dev
= dev_get_by_index(net
, ifindex
);
1065 return ERR_PTR(-ENODEV
);
1066 if (dev
->ieee80211_ptr
)
1067 rdev
= wiphy_to_dev(dev
->ieee80211_ptr
->wiphy
);
1069 rdev
= ERR_PTR(-ENODEV
);
1074 int cfg80211_wext_siwscan(struct net_device
*dev
,
1075 struct iw_request_info
*info
,
1076 union iwreq_data
*wrqu
, char *extra
)
1078 struct cfg80211_registered_device
*rdev
;
1079 struct wiphy
*wiphy
;
1080 struct iw_scan_req
*wreq
= NULL
;
1081 struct cfg80211_scan_request
*creq
= NULL
;
1082 int i
, err
, n_channels
= 0;
1083 enum ieee80211_band band
;
1085 if (!netif_running(dev
))
1088 if (wrqu
->data
.length
== sizeof(struct iw_scan_req
))
1089 wreq
= (struct iw_scan_req
*)extra
;
1091 rdev
= cfg80211_get_dev_from_ifindex(dev_net(dev
), dev
->ifindex
);
1094 return PTR_ERR(rdev
);
1096 if (rdev
->scan_req
) {
1101 wiphy
= &rdev
->wiphy
;
1103 /* Determine number of channels, needed to allocate creq */
1104 if (wreq
&& wreq
->num_channels
)
1105 n_channels
= wreq
->num_channels
;
1107 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++)
1108 if (wiphy
->bands
[band
])
1109 n_channels
+= wiphy
->bands
[band
]->n_channels
;
1112 creq
= kzalloc(sizeof(*creq
) + sizeof(struct cfg80211_ssid
) +
1113 n_channels
* sizeof(void *),
1120 creq
->wiphy
= wiphy
;
1121 creq
->wdev
= dev
->ieee80211_ptr
;
1122 /* SSIDs come after channels */
1123 creq
->ssids
= (void *)&creq
->channels
[n_channels
];
1124 creq
->n_channels
= n_channels
;
1126 creq
->scan_start
= jiffies
;
1128 /* translate "Scan on frequencies" request */
1130 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
1133 if (!wiphy
->bands
[band
])
1136 for (j
= 0; j
< wiphy
->bands
[band
]->n_channels
; j
++) {
1137 /* ignore disabled channels */
1138 if (wiphy
->bands
[band
]->channels
[j
].flags
&
1139 IEEE80211_CHAN_DISABLED
)
1142 /* If we have a wireless request structure and the
1143 * wireless request specifies frequencies, then search
1144 * for the matching hardware channel.
1146 if (wreq
&& wreq
->num_channels
) {
1148 int wiphy_freq
= wiphy
->bands
[band
]->channels
[j
].center_freq
;
1149 for (k
= 0; k
< wreq
->num_channels
; k
++) {
1150 int wext_freq
= cfg80211_wext_freq(wiphy
, &wreq
->channel_list
[k
]);
1151 if (wext_freq
== wiphy_freq
)
1152 goto wext_freq_found
;
1154 goto wext_freq_not_found
;
1158 creq
->channels
[i
] = &wiphy
->bands
[band
]->channels
[j
];
1160 wext_freq_not_found
: ;
1163 /* No channels found? */
1169 /* Set real number of channels specified in creq->channels[] */
1170 creq
->n_channels
= i
;
1172 /* translate "Scan for SSID" request */
1174 if (wrqu
->data
.flags
& IW_SCAN_THIS_ESSID
) {
1175 if (wreq
->essid_len
> IEEE80211_MAX_SSID_LEN
) {
1179 memcpy(creq
->ssids
[0].ssid
, wreq
->essid
, wreq
->essid_len
);
1180 creq
->ssids
[0].ssid_len
= wreq
->essid_len
;
1182 if (wreq
->scan_type
== IW_SCAN_TYPE_PASSIVE
)
1186 for (i
= 0; i
< IEEE80211_NUM_BANDS
; i
++)
1187 if (wiphy
->bands
[i
])
1188 creq
->rates
[i
] = (1 << wiphy
->bands
[i
]->n_bitrates
) - 1;
1190 rdev
->scan_req
= creq
;
1191 err
= rdev_scan(rdev
, creq
);
1193 rdev
->scan_req
= NULL
;
1194 /* creq will be freed below */
1196 nl80211_send_scan_start(rdev
, dev
->ieee80211_ptr
);
1197 /* creq now owned by driver */
1205 EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan
);
1207 static void ieee80211_scan_add_ies(struct iw_request_info
*info
,
1208 const struct cfg80211_bss_ies
*ies
,
1209 char **current_ev
, char *end_buf
)
1211 const u8
*pos
, *end
, *next
;
1212 struct iw_event iwe
;
1218 * If needed, fragment the IEs buffer (at IE boundaries) into short
1219 * enough fragments to fit into IW_GENERIC_IE_MAX octet messages.
1222 end
= pos
+ ies
->len
;
1224 while (end
- pos
> IW_GENERIC_IE_MAX
) {
1225 next
= pos
+ 2 + pos
[1];
1226 while (next
+ 2 + next
[1] - pos
< IW_GENERIC_IE_MAX
)
1227 next
= next
+ 2 + next
[1];
1229 memset(&iwe
, 0, sizeof(iwe
));
1230 iwe
.cmd
= IWEVGENIE
;
1231 iwe
.u
.data
.length
= next
- pos
;
1232 *current_ev
= iwe_stream_add_point(info
, *current_ev
,
1240 memset(&iwe
, 0, sizeof(iwe
));
1241 iwe
.cmd
= IWEVGENIE
;
1242 iwe
.u
.data
.length
= end
- pos
;
1243 *current_ev
= iwe_stream_add_point(info
, *current_ev
,
1250 ieee80211_bss(struct wiphy
*wiphy
, struct iw_request_info
*info
,
1251 struct cfg80211_internal_bss
*bss
, char *current_ev
,
1254 const struct cfg80211_bss_ies
*ies
;
1255 struct iw_event iwe
;
1259 bool ismesh
= false;
1261 memset(&iwe
, 0, sizeof(iwe
));
1262 iwe
.cmd
= SIOCGIWAP
;
1263 iwe
.u
.ap_addr
.sa_family
= ARPHRD_ETHER
;
1264 memcpy(iwe
.u
.ap_addr
.sa_data
, bss
->pub
.bssid
, ETH_ALEN
);
1265 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
, &iwe
,
1268 memset(&iwe
, 0, sizeof(iwe
));
1269 iwe
.cmd
= SIOCGIWFREQ
;
1270 iwe
.u
.freq
.m
= ieee80211_frequency_to_channel(bss
->pub
.channel
->center_freq
);
1272 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
, &iwe
,
1275 memset(&iwe
, 0, sizeof(iwe
));
1276 iwe
.cmd
= SIOCGIWFREQ
;
1277 iwe
.u
.freq
.m
= bss
->pub
.channel
->center_freq
;
1279 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
, &iwe
,
1282 if (wiphy
->signal_type
!= CFG80211_SIGNAL_TYPE_NONE
) {
1283 memset(&iwe
, 0, sizeof(iwe
));
1285 iwe
.u
.qual
.updated
= IW_QUAL_LEVEL_UPDATED
|
1286 IW_QUAL_NOISE_INVALID
|
1287 IW_QUAL_QUAL_UPDATED
;
1288 switch (wiphy
->signal_type
) {
1289 case CFG80211_SIGNAL_TYPE_MBM
:
1290 sig
= bss
->pub
.signal
/ 100;
1291 iwe
.u
.qual
.level
= sig
;
1292 iwe
.u
.qual
.updated
|= IW_QUAL_DBM
;
1293 if (sig
< -110) /* rather bad */
1295 else if (sig
> -40) /* perfect */
1297 /* will give a range of 0 .. 70 */
1298 iwe
.u
.qual
.qual
= sig
+ 110;
1300 case CFG80211_SIGNAL_TYPE_UNSPEC
:
1301 iwe
.u
.qual
.level
= bss
->pub
.signal
;
1302 /* will give range 0 .. 100 */
1303 iwe
.u
.qual
.qual
= bss
->pub
.signal
;
1309 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
,
1310 &iwe
, IW_EV_QUAL_LEN
);
1313 memset(&iwe
, 0, sizeof(iwe
));
1314 iwe
.cmd
= SIOCGIWENCODE
;
1315 if (bss
->pub
.capability
& WLAN_CAPABILITY_PRIVACY
)
1316 iwe
.u
.data
.flags
= IW_ENCODE_ENABLED
| IW_ENCODE_NOKEY
;
1318 iwe
.u
.data
.flags
= IW_ENCODE_DISABLED
;
1319 iwe
.u
.data
.length
= 0;
1320 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
1324 ies
= rcu_dereference(bss
->pub
.ies
);
1330 if (ie
[1] > rem
- 2)
1335 memset(&iwe
, 0, sizeof(iwe
));
1336 iwe
.cmd
= SIOCGIWESSID
;
1337 iwe
.u
.data
.length
= ie
[1];
1338 iwe
.u
.data
.flags
= 1;
1339 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
1340 &iwe
, (u8
*)ie
+ 2);
1342 case WLAN_EID_MESH_ID
:
1343 memset(&iwe
, 0, sizeof(iwe
));
1344 iwe
.cmd
= SIOCGIWESSID
;
1345 iwe
.u
.data
.length
= ie
[1];
1346 iwe
.u
.data
.flags
= 1;
1347 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
1348 &iwe
, (u8
*)ie
+ 2);
1350 case WLAN_EID_MESH_CONFIG
:
1352 if (ie
[1] != sizeof(struct ieee80211_meshconf_ie
))
1354 buf
= kmalloc(50, GFP_ATOMIC
);
1358 memset(&iwe
, 0, sizeof(iwe
));
1359 iwe
.cmd
= IWEVCUSTOM
;
1360 sprintf(buf
, "Mesh Network Path Selection Protocol ID: "
1362 iwe
.u
.data
.length
= strlen(buf
);
1363 current_ev
= iwe_stream_add_point(info
, current_ev
,
1366 sprintf(buf
, "Path Selection Metric ID: 0x%02X",
1368 iwe
.u
.data
.length
= strlen(buf
);
1369 current_ev
= iwe_stream_add_point(info
, current_ev
,
1372 sprintf(buf
, "Congestion Control Mode ID: 0x%02X",
1374 iwe
.u
.data
.length
= strlen(buf
);
1375 current_ev
= iwe_stream_add_point(info
, current_ev
,
1378 sprintf(buf
, "Synchronization ID: 0x%02X", cfg
[3]);
1379 iwe
.u
.data
.length
= strlen(buf
);
1380 current_ev
= iwe_stream_add_point(info
, current_ev
,
1383 sprintf(buf
, "Authentication ID: 0x%02X", cfg
[4]);
1384 iwe
.u
.data
.length
= strlen(buf
);
1385 current_ev
= iwe_stream_add_point(info
, current_ev
,
1388 sprintf(buf
, "Formation Info: 0x%02X", cfg
[5]);
1389 iwe
.u
.data
.length
= strlen(buf
);
1390 current_ev
= iwe_stream_add_point(info
, current_ev
,
1393 sprintf(buf
, "Capabilities: 0x%02X", cfg
[6]);
1394 iwe
.u
.data
.length
= strlen(buf
);
1395 current_ev
= iwe_stream_add_point(info
, current_ev
,
1400 case WLAN_EID_SUPP_RATES
:
1401 case WLAN_EID_EXT_SUPP_RATES
:
1402 /* display all supported rates in readable format */
1403 p
= current_ev
+ iwe_stream_lcp_len(info
);
1405 memset(&iwe
, 0, sizeof(iwe
));
1406 iwe
.cmd
= SIOCGIWRATE
;
1407 /* Those two flags are ignored... */
1408 iwe
.u
.bitrate
.fixed
= iwe
.u
.bitrate
.disabled
= 0;
1410 for (i
= 0; i
< ie
[1]; i
++) {
1411 iwe
.u
.bitrate
.value
=
1412 ((ie
[i
+ 2] & 0x7f) * 500000);
1413 p
= iwe_stream_add_value(info
, current_ev
, p
,
1414 end_buf
, &iwe
, IW_EV_PARAM_LEN
);
1423 if (bss
->pub
.capability
& (WLAN_CAPABILITY_ESS
| WLAN_CAPABILITY_IBSS
) ||
1425 memset(&iwe
, 0, sizeof(iwe
));
1426 iwe
.cmd
= SIOCGIWMODE
;
1428 iwe
.u
.mode
= IW_MODE_MESH
;
1429 else if (bss
->pub
.capability
& WLAN_CAPABILITY_ESS
)
1430 iwe
.u
.mode
= IW_MODE_MASTER
;
1432 iwe
.u
.mode
= IW_MODE_ADHOC
;
1433 current_ev
= iwe_stream_add_event(info
, current_ev
, end_buf
,
1434 &iwe
, IW_EV_UINT_LEN
);
1437 buf
= kmalloc(31, GFP_ATOMIC
);
1439 memset(&iwe
, 0, sizeof(iwe
));
1440 iwe
.cmd
= IWEVCUSTOM
;
1441 sprintf(buf
, "tsf=%016llx", (unsigned long long)(ies
->tsf
));
1442 iwe
.u
.data
.length
= strlen(buf
);
1443 current_ev
= iwe_stream_add_point(info
, current_ev
, end_buf
,
1445 memset(&iwe
, 0, sizeof(iwe
));
1446 iwe
.cmd
= IWEVCUSTOM
;
1447 sprintf(buf
, " Last beacon: %ums ago",
1448 elapsed_jiffies_msecs(bss
->ts
));
1449 iwe
.u
.data
.length
= strlen(buf
);
1450 current_ev
= iwe_stream_add_point(info
, current_ev
,
1451 end_buf
, &iwe
, buf
);
1455 ieee80211_scan_add_ies(info
, ies
, ¤t_ev
, end_buf
);
1462 static int ieee80211_scan_results(struct cfg80211_registered_device
*dev
,
1463 struct iw_request_info
*info
,
1464 char *buf
, size_t len
)
1466 char *current_ev
= buf
;
1467 char *end_buf
= buf
+ len
;
1468 struct cfg80211_internal_bss
*bss
;
1470 spin_lock_bh(&dev
->bss_lock
);
1471 cfg80211_bss_expire(dev
);
1473 list_for_each_entry(bss
, &dev
->bss_list
, list
) {
1474 if (buf
+ len
- current_ev
<= IW_EV_ADDR_LEN
) {
1475 spin_unlock_bh(&dev
->bss_lock
);
1478 current_ev
= ieee80211_bss(&dev
->wiphy
, info
, bss
,
1479 current_ev
, end_buf
);
1481 spin_unlock_bh(&dev
->bss_lock
);
1482 return current_ev
- buf
;
1486 int cfg80211_wext_giwscan(struct net_device
*dev
,
1487 struct iw_request_info
*info
,
1488 struct iw_point
*data
, char *extra
)
1490 struct cfg80211_registered_device
*rdev
;
1493 if (!netif_running(dev
))
1496 rdev
= cfg80211_get_dev_from_ifindex(dev_net(dev
), dev
->ifindex
);
1499 return PTR_ERR(rdev
);
1504 res
= ieee80211_scan_results(rdev
, info
, extra
, data
->length
);
1513 EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan
);