From: Jouni Malinen Date: Thu, 15 Jan 2015 10:24:18 +0000 (+0200) Subject: Interworking: Fix INTERWORKING_CONNECT with zero-length SSID BSS entry X-Git-Tag: hostap_2_4~408 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=783b2a977fcc4d3faaf01bd6de7c8801f8a00b34;p=thirdparty%2Fhostap.git 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 --- 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); }