From 08b267797405c23158cb5db3d5e9f46cb24b0ec3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 7 Nov 2013 00:17:48 +0200 Subject: [PATCH] Interworking: Use SSID from the BSS entry There is no need to parse the IE buffer again to find the SSID of the BSS since that information is already stored in struct wpa_bss. Signed-hostap: Jouni Malinen --- wpa_supplicant/interworking.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index 6f50c9726..93652d8fc 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -825,7 +825,6 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s, { #ifdef INTERWORKING_3GPP struct wpa_ssid *ssid; - const u8 *ie; int eap_type; int res; char prefix; @@ -833,9 +832,6 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s, if (bss->anqp == NULL || bss->anqp->anqp_3gpp == NULL) return -1; - ie = wpa_bss_get_ie(bss, WLAN_EID_SSID); - if (ie == NULL) - return -1; wpa_printf(MSG_DEBUG, "Interworking: Connect with " MACSTR " (3GPP)", MAC2STR(bss->bssid)); @@ -856,11 +852,11 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s, wpa_config_set_network_defaults(ssid); ssid->priority = cred->priority; ssid->temporary = 1; - ssid->ssid = os_zalloc(ie[1] + 1); + ssid->ssid = os_zalloc(bss->ssid_len + 1); if (ssid->ssid == NULL) goto fail; - os_memcpy(ssid->ssid, ie + 2, ie[1]); - ssid->ssid_len = ie[1]; + os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len); + ssid->ssid_len = bss->ssid_len; if (interworking_set_hs20_params(wpa_s, ssid) < 0) goto fail; @@ -1199,7 +1195,7 @@ static int interworking_set_eap_params(struct wpa_ssid *ssid, static int interworking_connect_roaming_consortium( struct wpa_supplicant *wpa_s, struct wpa_cred *cred, - struct wpa_bss *bss, const u8 *ssid_ie) + struct wpa_bss *bss) { struct wpa_ssid *ssid; @@ -1222,11 +1218,11 @@ static int interworking_connect_roaming_consortium( wpa_config_set_network_defaults(ssid); ssid->priority = cred->priority; ssid->temporary = 1; - ssid->ssid = os_zalloc(ssid_ie[1] + 1); + ssid->ssid = os_zalloc(bss->ssid_len + 1); if (ssid->ssid == NULL) goto fail; - os_memcpy(ssid->ssid, ssid_ie + 2, ssid_ie[1]); - ssid->ssid_len = ssid_ie[1]; + os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len); + ssid->ssid_len = bss->ssid_len; if (interworking_set_hs20_params(wpa_s, ssid) < 0) goto fail; @@ -1263,7 +1259,6 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) struct nai_realm_eap *eap = NULL; u16 count, i; char buf[100]; - const u8 *ie; if (wpa_s->conf->cred == NULL || bss == NULL) return -1; @@ -1273,12 +1268,6 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) MACSTR, MAC2STR(bss->bssid)); return -1; } - ie = wpa_bss_get_ie(bss, WLAN_EID_SSID); - if (ie == NULL || ie[1] == 0) { - wpa_printf(MSG_DEBUG, "Interworking: No SSID known for " - MACSTR, MAC2STR(bss->bssid)); - return -1; - } if (!wpa_bss_get_ie(bss, WLAN_EID_RSN)) { /* @@ -1315,7 +1304,7 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) (cred == NULL || cred_rc->priority >= cred->priority) && (cred_3gpp == NULL || cred_rc->priority >= cred_3gpp->priority)) return interworking_connect_roaming_consortium(wpa_s, cred_rc, - bss, ie); + bss); if (cred_3gpp && (cred == NULL || cred_3gpp->priority >= cred->priority)) { @@ -1374,11 +1363,11 @@ int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss) wpa_config_set_network_defaults(ssid); ssid->priority = cred->priority; ssid->temporary = 1; - ssid->ssid = os_zalloc(ie[1] + 1); + ssid->ssid = os_zalloc(bss->ssid_len + 1); if (ssid->ssid == NULL) goto fail; - os_memcpy(ssid->ssid, ie + 2, ie[1]); - ssid->ssid_len = ie[1]; + os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len); + ssid->ssid_len = bss->ssid_len; if (interworking_set_hs20_params(wpa_s, ssid) < 0) goto fail;