aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/bss.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-01-02 11:57:44 (GMT)
committerJouni Malinen <j@w1.fi>2010-01-02 11:57:44 (GMT)
commit8d923a4acfb8c43527cc9fe9571ebf341b8e0502 (patch)
tree4bfa7a044e88b9d3c0b0ec8cab743be4369c1d99 /wpa_supplicant/bss.c
parent59f2caa9258b2212de0f44a71ebaac112ddf9956 (diff)
downloadhostap-8d923a4acfb8c43527cc9fe9571ebf341b8e0502.zip
hostap-8d923a4acfb8c43527cc9fe9571ebf341b8e0502.tar.gz
hostap-8d923a4acfb8c43527cc9fe9571ebf341b8e0502.tar.bz2
Only expire scanned BSSes based on new scan results
Get more information about scans when updating BSS table information. This allows the missing-from-scans expiration rule to work properly when only partial set of channels or SSIDs are being scanned.
Diffstat (limited to 'wpa_supplicant/bss.c')
-rw-r--r--wpa_supplicant/bss.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index 4d4e71e..a981f89 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -1,6 +1,6 @@
/*
* BSS table
- * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -195,16 +195,58 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
}
-void wpa_bss_update_end(struct wpa_supplicant *wpa_s)
+static int wpa_bss_included_in_scan(const struct wpa_bss *bss,
+ const struct scan_info *info)
+{
+ int found;
+ size_t i;
+
+ if (info == NULL)
+ return 1;
+
+ if (info->num_freqs) {
+ found = 0;
+ for (i = 0; i < info->num_freqs; i++) {
+ if (bss->freq == info->freqs[i]) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found)
+ return 0;
+ }
+
+ if (info->num_ssids) {
+ found = 0;
+ for (i = 0; i < info->num_ssids; i++) {
+ const struct wpa_driver_scan_ssid *s = &info->ssids[i];
+ if ((s->ssid == NULL || s->ssid_len == 0) ||
+ (s->ssid_len == bss->ssid_len &&
+ os_memcmp(s->ssid, bss->ssid, bss->ssid_len) ==
+ 0)) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found)
+ return 0;
+ }
+
+ return 1;
+}
+
+
+void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info,
+ int new_scan)
{
struct wpa_bss *bss, *n;
- /* TODO: expire only entries that were on the scanned frequencies/SSIDs
- * list; need to get info from driver about scanned frequencies and
- * SSIDs to be able to figure out which entries should be expired based
- * on this */
+ if (!new_scan)
+ return; /* do not expire entries without new scan */
dl_list_for_each_safe(bss, n, &wpa_s->bss, struct wpa_bss, list) {
+ if (!wpa_bss_included_in_scan(bss, info))
+ continue; /* expire only BSSes that were scanned */
if (bss->last_update_idx < wpa_s->bss_update_idx)
bss->scan_miss_count++;
if (bss->scan_miss_count >= WPA_BSS_EXPIRATION_SCAN_COUNT) {