From 294ce1121aff3e7c728517c64a1ef39759ece670 Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Tue, 23 Oct 2018 16:49:19 +0530 Subject: [PATCH] qcacmn: SSID with zero or space should be NULL ssid Last frame received in scan before the connect is beacon with NULL ssid with non zero length and ssid is sent as NULL to supplicant after association. This will result in supplicant to trigger disconnect casuing delay in reconnection. Fix is to consider ssid with zeros or spaces as null ssid. Change-Id: If96776ae85926948d714e975c3e9b4011e8a20b3 CRs-Fixed: 2330485 --- umac/scan/core/src/wlan_scan_cache_db.c | 5 ++- .../scan/dispatcher/inc/wlan_scan_utils_api.h | 41 +++++++++++++++++-- .../scan/dispatcher/src/wlan_scan_utils_api.c | 4 +- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 75f2d7376fd1..d384ba7f68ad 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -491,7 +491,8 @@ scm_copy_info_from_dup_entry(struct scan_dbs *scan_db, scan_entry = scan_node->entry; /* If old entry have the ssid but new entry does not */ - if (!scan_params->ssid.length && scan_entry->ssid.length) { + if (util_scan_is_null_ssid(&scan_params->ssid) && + scan_entry->ssid.length) { /* * New entry has a hidden SSID and old one has the SSID. * Add the entry by using the ssid of the old entry @@ -510,7 +511,7 @@ scm_copy_info_from_dup_entry(struct scan_dbs *scan_db, scan_entry->ssid.length; qdf_mem_copy(scan_params->ssid.ssid, scan_entry->ssid.ssid, - scan_params->ssid.length); + scan_entry->ssid.length); } } diff --git a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h index 0e7dfa24d02f..f0e1500d192c 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h @@ -31,6 +31,8 @@ #include #include +#define ASCII_SPACE_CHARACTER 32 + /** * util_is_scan_entry_match() - func to check if both scan entry * are from same AP @@ -286,10 +288,6 @@ static inline bool util_is_ssid_match(struct wlan_ssid *ssid1, struct wlan_ssid *ssid2) { - - if (ssid1->length == 0) - return true; - if (ssid1->length != ssid2->length) return false; @@ -1562,4 +1560,39 @@ util_scan_entry_mdie(struct scan_cache_entry *scan_entry) return scan_entry->ie_list.mdie; } +/** + * util_scan_is_null_ssid() - to check for NULL ssid + * @ssid: ssid + * + * Return: true if NULL ssid else false + */ +static inline bool util_scan_is_null_ssid(struct wlan_ssid *ssid) +{ + uint32_t ssid_length; + uint8_t *ssid_str; + + if (ssid->length == 0) + return true; + + /* Consider 0 or space for hidden SSID */ + if (0 == ssid->ssid[0]) + return true; + + ssid_length = ssid->length; + ssid_str = ssid->ssid; + + while (ssid_length) { + if (*ssid_str != ASCII_SPACE_CHARACTER && + *ssid_str) + break; + ssid_str++; + ssid_length--; + } + + if (ssid_length == 0) + return true; + + return false; +} + #endif diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c index 9863f5b8b994..214c93ac9c6b 100644 --- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c @@ -136,8 +136,8 @@ bool util_is_scan_entry_match( entry1->channel.chan_idx) == util_scan_scm_chan_to_band(entry2->channel.chan_idx)) { /* Check for BSS */ - if (util_is_ssid_match( - &entry1->ssid, &entry2->ssid)) + if (util_is_ssid_match(&entry1->ssid, &entry2->ssid) || + util_scan_is_null_ssid(&entry1->ssid)) return true; } else if (entry1->cap_info.wlan_caps.ibss && (entry1->channel.chan_idx ==