Interworking: Add support for using eap_proxy offload
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 19 Jun 2013 15:42:17 +0000 (18:42 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 19 Jun 2013 15:42:17 +0000 (18:42 +0300)
Fetch IMSI through eap_proxy for Interworking network selection if
needed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/interworking.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index e35628b..2f35240 100644 (file)
@@ -1346,6 +1346,13 @@ static struct wpa_cred * interworking_credentials_available_3gpp(
                        goto compare;
                }
 #endif /* PCSC_FUNCS */
+#ifdef CONFIG_EAP_PROXY
+               if (cred->pcsc && wpa_s->mnc_len > 0 && wpa_s->imsi[0]) {
+                       imsi = wpa_s->imsi;
+                       mnc_len = wpa_s->mnc_len;
+                       goto compare;
+               }
+#endif /* CONFIG_EAP_PROXY */
 
                if (cred->imsi == NULL || !cred->imsi[0] ||
                    cred->milenage == NULL || !cred->milenage[0])
@@ -1358,9 +1365,9 @@ static struct wpa_cred * interworking_credentials_available_3gpp(
                mnc_len = sep - cred->imsi - 3;
                imsi = cred->imsi;
 
-#ifdef PCSC_FUNCS
+#if defined(PCSC_FUNCS) || defined(CONFIG_EAP_PROXY)
        compare:
-#endif /* PCSC_FUNCS */
+#endif /* PCSC_FUNCS || CONFIG_EAP_PROXY */
                wpa_printf(MSG_DEBUG, "Interworking: Parsing 3GPP info from "
                           MACSTR, MAC2STR(bss->bssid));
                ret = plmn_id_match(bss->anqp->anqp_3gpp, imsi, mnc_len);
index 248bf0e..7234e41 100644 (file)
@@ -17,6 +17,7 @@
 #include "crypto/sha1.h"
 #include "eapol_supp/eapol_supp_sm.h"
 #include "eap_peer/eap.h"
+#include "eap_peer/eap_proxy.h"
 #include "eap_server/eap_methods.h"
 #include "rsn_supp/wpa.h"
 #include "eloop.h"
@@ -3010,6 +3011,20 @@ next_driver:
        if (wpa_bss_init(wpa_s) < 0)
                return -1;
 
+#ifdef CONFIG_EAP_PROXY
+{
+       size_t len;
+       wpa_s->mnc_len = eap_proxy_get_imsi(wpa_s->imsi, &len);
+       if (wpa_s->mnc_len > 0) {
+               wpa_s->imsi[len] = '\0';
+               wpa_printf(MSG_DEBUG, "eap_proxy: IMSI %s (MNC length %d)",
+                          wpa_s->imsi, wpa_s->mnc_len);
+       } else {
+               wpa_printf(MSG_DEBUG, "eap_proxy: IMSI not available");
+       }
+}
+#endif /* CONFIG_EAP_PROXY */
+
        if (pcsc_reader_init(wpa_s) < 0)
                return -1;
 
index c971ae4..cc1dc5e 100644 (file)
@@ -407,10 +407,8 @@ struct wpa_supplicant {
                             * previous association event */
 
        struct scard_data *scard;
-#ifdef PCSC_FUNCS
        char imsi[20];
        int mnc_len;
-#endif /* PCSC_FUNCS */
 
        unsigned char last_eapol_src[ETH_ALEN];