From 5fdacce46599fd1a56e7938919b4d80461b02fd1 Mon Sep 17 00:00:00 2001 From: Veerendranath Jakkam Date: Sat, 29 Feb 2020 12:26:36 +0530 Subject: [PATCH] Allow wildcard SSID to be enforced for a specific BSSID scan Specific BSSID scan was replacing wildcard SSID with the known SSID if any BSS with the specified BSSID is available in the known BSSes list. Add control interface support to force use of a wildcard SSID in a specific BSSID scan by user with the new "wildcard_ssid=1" argument to the SCAN command. Signed-off-by: Veerendranath Jakkam --- wpa_supplicant/ctrl_iface.c | 5 +++++ wpa_supplicant/scan.c | 4 +++- wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 2c540457b..077bd6449 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -8193,6 +8193,8 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->disconnected = 0; os_free(wpa_s->next_scan_freqs); wpa_s->next_scan_freqs = NULL; + os_memset(wpa_s->next_scan_bssid, 0, ETH_ALEN); + wpa_s->next_scan_bssid_wildcard_ssid = 0; os_free(wpa_s->select_network_scan_freqs); wpa_s->select_network_scan_freqs = NULL; @@ -8528,6 +8530,9 @@ static void wpas_ctrl_scan(struct wpa_supplicant *wpa_s, char *params, goto done; } os_memcpy(wpa_s->next_scan_bssid, bssid, ETH_ALEN); + + wpa_s->next_scan_bssid_wildcard_ssid = + os_strstr(params, "wildcard_ssid=1") != NULL; } pos = params; diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 17636e3b6..db1f6e1fa 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1251,7 +1251,8 @@ ssid_list_set: params.bssid = wpa_s->next_scan_bssid; bss = wpa_bss_get_bssid_latest(wpa_s, params.bssid); - if (bss && bss->ssid_len && params.num_ssids == 1 && + if (!wpa_s->next_scan_bssid_wildcard_ssid && + bss && bss->ssid_len && params.num_ssids == 1 && params.ssids[0].ssid_len == 0) { params.ssids[0].ssid = bss->ssid; params.ssids[0].ssid_len = bss->ssid_len; @@ -1328,6 +1329,7 @@ scan: #ifdef CONFIG_INTERWORKING wpa_s->interworking_fast_assoc_tried = 0; #endif /* CONFIG_INTERWORKING */ + wpa_s->next_scan_bssid_wildcard_ssid = 0; if (params.bssid) os_memset(wpa_s->next_scan_bssid, 0, ETH_ALEN); } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index de2e6350b..eac7cad2d 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -715,6 +715,7 @@ struct wpa_supplicant { int scan_id[MAX_SCAN_ID]; unsigned int scan_id_count; u8 next_scan_bssid[ETH_ALEN]; + unsigned int next_scan_bssid_wildcard_ssid:1; struct wpa_ssid_value *ssids_from_scan_req; unsigned int num_ssids_from_scan_req;