From 9af25d937dee15717a753daaa128faaf598074d9 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 3 Feb 2021 12:55:18 -0600 Subject: [PATCH] station: Make sure bss_match also matches the ssid Kernel might report hidden BSSes that are reported from beacon frames separately than ones reported due to probe responses. This may confuse the station network collation logic since the scan_bss generated by the probe response might be removed erroneously when processing the scan_bss that was generated due to a beacon. Make sure that bss_match also takes the SSID into account and only matches scan_bss structures that have the same BSSID and SSID contents. --- src/station.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/station.c b/src/station.c index ab2ba66e..1b5aa622 100644 --- a/src/station.c +++ b/src/station.c @@ -375,7 +375,13 @@ static bool bss_match(const void *a, const void *b) const struct scan_bss *bss_a = a; const struct scan_bss *bss_b = b; - return !memcmp(bss_a->addr, bss_b->addr, sizeof(bss_a->addr)); + if (memcmp(bss_a->addr, bss_b->addr, sizeof(bss_a->addr))) + return false; + + if (bss_a->ssid_len != bss_b->ssid_len) + return false; + + return !memcmp(bss_a->ssid, bss_b->ssid, bss_a->ssid_len); } struct bss_expiration_data {