Cumulative patch from commit 2b6623ab134fff6d96114f5fe329a2f87d5e893a

2b6623a hostapd: Do not terminate process on dynamic interface add failure
217cf49 P2P: Add more debug prints for frequency selection
4dd3f86 P2P: Fix bug in GO frequency selection
9804873 wpa_supplicant: Fix bug in get_shared_radio_freqs
3342c26 wpa_supplicant: Fix updating GO beacons on WFD subelements change
72c12c1 EAPOL: Fix static analyzer warnings for pac_opaque_encr_key
3139270 bgscan: Add global bgscan configuration
efc58df eap_proxy: Re-read IMSI from proxy in Interworking functionality

Change-Id: I006abd3b52fbbd1a7b97059364c72ab0386d5f63
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index 067b3bd..8667221 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -18,6 +18,7 @@
 #include "eap_common/eap_defs.h"
 #include "eap_peer/eap.h"
 #include "eap_peer/eap_methods.h"
+#include "eapol_supp/eapol_supp_sm.h"
 #include "wpa_supplicant_i.h"
 #include "config.h"
 #include "config_ssid.h"
@@ -1383,6 +1384,23 @@
 	if (bss->anqp == NULL || bss->anqp->anqp_3gpp == NULL)
 		return NULL;
 
+#ifdef CONFIG_EAP_PROXY
+	if (!wpa_s->imsi[0]) {
+		size_t len;
+		wpa_printf(MSG_DEBUG, "Interworking: IMSI not available - try to read again through eap_proxy");
+		wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol,
+							     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 */
+
 	for (cred = wpa_s->conf->cred; cred; cred = cred->next) {
 		char *sep;
 		const char *imsi;