From 603ec8b51f05ad9900a2491839b8b058e8770308 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 22 Feb 2023 20:10:53 +0100 Subject: [PATCH] wifi: Do not hash BSSIDs to avoid randomness in AP selection --- src/wifi/model/wifi-assoc-manager.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/wifi/model/wifi-assoc-manager.cc b/src/wifi/model/wifi-assoc-manager.cc index 69a1715f5..5549a352b 100644 --- a/src/wifi/model/wifi-assoc-manager.cc +++ b/src/wifi/model/wifi-assoc-manager.cc @@ -51,16 +51,15 @@ WifiAssocManager::ApInfoCompare::operator()(const StaWifiMac::ApInfo& lhs, return true; } - // the Compare method implemented by subclass may be such that the two ApInfo objects - // compare equal; in such a case, use the BSSID as tie breaker bool rhsBefore = m_manager.Compare(rhs, lhs); if (rhsBefore) { return false; } - WifiAddressHash hash; - return hash(lhs.m_bssid) > hash(rhs.m_bssid); + // the Compare method implemented by subclass may be such that the two ApInfo objects + // compare equal; in such a case, use the BSSID as tie breaker + return lhs.m_bssid < rhs.m_bssid; } TypeId