From 783b2a977fcc4d3faaf01bd6de7c8801f8a00b34 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 15 Jan 2015 12:24:18 +0200 Subject: [PATCH] Interworking: Fix INTERWORKING_CONNECT with zero-length SSID BSS entry For Interworking connection to work, the SSID of the selected BSS needs to be known to be able to associate with the AP. It was possible for the scan results to include two BSS entries matching the BSSID when an earlier scan with that AP has shown a hidden SSID configuration (e.g., when running hwsim test cases, but at least in theory, this could happen with real use cases as well). When that happened, the incorrect BSS entry may not have included RSN configuration and as such, it would get rejected for Interworking connection. Fix this by confirming that the selected BSS entry has a real SSID. If not, try to find another BSS entry matching the same BSSID and use that, if found with an SSID. Signed-off-by: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 9c3f93d66..e8b7fb166 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5526,6 +5526,27 @@ static int ctrl_interworking_connect(struct wpa_supplicant *wpa_s, char *dst) return -1; } + if (bss->ssid_len == 0) { + int found = 0; + + wpa_printf(MSG_DEBUG, "Selected BSS entry for " MACSTR + " does not have SSID information", MAC2STR(bssid)); + + dl_list_for_each_reverse(bss, &wpa_s->bss, struct wpa_bss, + list) { + if (os_memcmp(bss->bssid, bssid, ETH_ALEN) == 0 && + bss->ssid_len > 0) { + found = 1; + break; + } + } + + if (!found) + return -1; + wpa_printf(MSG_DEBUG, + "Found another matching BSS entry with SSID"); + } + return interworking_connect(wpa_s, bss); }