diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c index 59967fdd7..9ff4d8b91 100644 --- a/src/eap_peer/eap.c +++ b/src/eap_peer/eap.c @@ -482,8 +482,8 @@ static char * eap_get_realm(struct eap_sm *sm, struct eap_peer_config *config) int mnc_len, pos; wpa_printf(MSG_DEBUG, "EAP: Build realm from IMSI (eap_proxy)"); - mnc_len = sm->eapol_cb->get_imsi(sm->eapol_ctx, imsi, - &imsi_len); + mnc_len = sm->eapol_cb->get_imsi(sm->eapol_ctx, config->sim_num, + imsi, &imsi_len); if (mnc_len < 0) return NULL; diff --git a/src/eap_peer/eap.h b/src/eap_peer/eap.h index 6d415dcb9..b5591a01f 100644 --- a/src/eap_peer/eap.h +++ b/src/eap_peer/eap.h @@ -264,11 +264,12 @@ struct eapol_callbacks { /** * get_imsi - Get the IMSI value from eap_proxy * @ctx: eapol_ctx from eap_peer_sm_init() call + * @sim_num: SIM/USIM number to get the IMSI value for * @imsi: Buffer for IMSI value * @len: Buffer for returning IMSI length in octets * Returns: MNC length (2 or 3) or -1 on error */ - int (*get_imsi)(void *ctx, char *imsi, size_t *len); + int (*get_imsi)(void *ctx, int sim_num, char *imsi, size_t *len); #endif /* CONFIG_EAP_PROXY */ /** diff --git a/src/eap_peer/eap_proxy.h b/src/eap_peer/eap_proxy.h index 95fd71f3c..9d8e57026 100644 --- a/src/eap_peer/eap_proxy.h +++ b/src/eap_peer/eap_proxy.h @@ -40,8 +40,8 @@ eap_proxy_packet_update(struct eap_proxy_sm *eap_proxy, u8 *eapReqData, int eap_proxy_sm_get_status(struct eap_proxy_sm *sm, char *buf, size_t buflen, int verbose); -int eap_proxy_get_imsi(struct eap_proxy_sm *eap_proxy, char *imsi_buf, - size_t *imsi_len); +int eap_proxy_get_imsi(struct eap_proxy_sm *eap_proxy, int sim_num, + char *imsi_buf, size_t *imsi_len); int eap_proxy_notify_config(struct eap_proxy_sm *sm, struct eap_peer_config *config); diff --git a/src/eap_peer/eap_proxy_dummy.c b/src/eap_peer/eap_proxy_dummy.c index 0cf647a55..2cc05c92c 100644 --- a/src/eap_peer/eap_proxy_dummy.c +++ b/src/eap_peer/eap_proxy_dummy.c @@ -63,8 +63,8 @@ int eap_proxy_sm_get_status(struct eap_proxy_sm *sm, char *buf, size_t buflen, } -int eap_proxy_get_imsi(struct eap_proxy_sm *eap_proxy, char *imsi_buf, - size_t *imsi_len) +int eap_proxy_get_imsi(struct eap_proxy_sm *eap_proxy, int sim_num, + char *imsi_buf, size_t *imsi_len) { return -1; } diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c index 75c3429f7..8e4f0e46d 100644 --- a/src/eapol_supp/eapol_supp_sm.c +++ b/src/eapol_supp/eapol_supp_sm.c @@ -2174,13 +2174,13 @@ int eapol_sm_failed(struct eapol_sm *sm) #ifdef CONFIG_EAP_PROXY -int eapol_sm_get_eap_proxy_imsi(void *ctx, char *imsi, size_t *len) +int eapol_sm_get_eap_proxy_imsi(void *ctx, int sim_num, char *imsi, size_t *len) { struct eapol_sm *sm = ctx; if (sm->eap_proxy == NULL) return -1; - return eap_proxy_get_imsi(sm->eap_proxy, imsi, len); + return eap_proxy_get_imsi(sm->eap_proxy, sim_num, imsi, len); } #endif /* CONFIG_EAP_PROXY */ diff --git a/src/eapol_supp/eapol_supp_sm.h b/src/eapol_supp/eapol_supp_sm.h index 458d51dd1..a25c79989 100644 --- a/src/eapol_supp/eapol_supp_sm.h +++ b/src/eapol_supp/eapol_supp_sm.h @@ -339,7 +339,8 @@ void eapol_sm_erp_flush(struct eapol_sm *sm); struct wpabuf * eapol_sm_build_erp_reauth_start(struct eapol_sm *sm); void eapol_sm_process_erp_finish(struct eapol_sm *sm, const u8 *buf, size_t len); -int eapol_sm_get_eap_proxy_imsi(void *ctx, char *imsi, size_t *len); +int eapol_sm_get_eap_proxy_imsi(void *ctx, int sim_num, char *imsi, + size_t *len); int eapol_sm_update_erp_next_seq_num(struct eapol_sm *sm, u16 next_seq_num); int eapol_sm_get_erp_info(struct eapol_sm *sm, struct eap_peer_config *config, const u8 **username, size_t *username_len, diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index 15b1016c0..3b4b639fd 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -1897,7 +1897,7 @@ static struct wpa_cred * interworking_credentials_available_3gpp( size_t len; wpa_msg(wpa_s, 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->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, -1, wpa_s->imsi, &len); if (wpa_s->mnc_len > 0) { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index b72e0df38..6c5a32048 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -5227,8 +5227,8 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, #ifdef CONFIG_EAP_PROXY { size_t len; - wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, wpa_s->imsi, - &len); + wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, -1, + 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)", diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c index fb383962a..ae246f99c 100644 --- a/wpa_supplicant/wpas_glue.c +++ b/wpa_supplicant/wpas_glue.c @@ -930,7 +930,7 @@ static void wpa_supplicant_eap_proxy_cb(void *ctx) struct wpa_supplicant *wpa_s = ctx; size_t len; - wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, + wpa_s->mnc_len = eapol_sm_get_eap_proxy_imsi(wpa_s->eapol, -1, wpa_s->imsi, &len); if (wpa_s->mnc_len > 0) { wpa_s->imsi[len] = '\0';