path: root/src
diff options
authorJouni Malinen <j@w1.fi>2013-12-31 07:38:55 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-31 13:45:18 (GMT)
commit4ea6a47133c00abfbf363343d0d07ae0e7dd5130 (patch)
tree16a8b96b027f4d00d311f9dc5becbc0efae2de64 /src
parent9489637b42f74236526b0731848bb61be7e47659 (diff)
nl80211: Prefer newer scan result over older during duplicate removal
Previously, it was possible for bss_info_handler() to end up dropping a newer scan result entry if there were two entries with the same BSSID and SSID (i.e., only frequency was different) and we were not associated with either. This could happen, e.g., in some P2P use cases where device discovery may happen on different channels. Fix this by checking the age of the scan entries as well to prefer the most recent response. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
1 files changed, 5 insertions, 3 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index fd4059c..58d6fd6 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4996,7 +4996,8 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
* BSSID,SSID pair is seen on multiple channels. wpa_supplicant does
* not use frequency as a separate key in the BSS table, so filter out
* duplicated entries. Prefer associated BSS entry in such a case in
- * order to get the correct frequency into the BSS table.
+ * order to get the correct frequency into the BSS table. Similarly,
+ * prefer newer entries over older.
for (i = 0; i < res->num; i++) {
const u8 *s1, *s2;
@@ -5014,8 +5015,9 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
wpa_printf(MSG_DEBUG, "nl80211: Remove duplicated scan result "
"for " MACSTR, MAC2STR(r->bssid));
- if ((r->flags & WPA_SCAN_ASSOCIATED) &&
- !(res->res[i]->flags & WPA_SCAN_ASSOCIATED)) {
+ if (((r->flags & WPA_SCAN_ASSOCIATED) &&
+ !(res->res[i]->flags & WPA_SCAN_ASSOCIATED)) ||
+ r->age < res->res[i]->age) {
res->res[i] = r;
} else