]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
eap_proxy: Support multiple SIMs in get_imsi()
authorVidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>
Fri, 2 Jun 2017 13:08:20 +0000 (18:38 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 6 Jun 2017 00:42:32 +0000 (03:42 +0300)
This allows the eap_proxy mechanism to be used with multiple SIMs by
following the configured sim_num to index which SIM to use for when
fetching the IMSI through eap_proxy.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/eap_peer/eap.c
src/eap_peer/eap.h
src/eap_peer/eap_proxy.h
src/eap_peer/eap_proxy_dummy.c
src/eapol_supp/eapol_supp_sm.c
src/eapol_supp/eapol_supp_sm.h
wpa_supplicant/interworking.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpas_glue.c

index 59967fdd7da584a6f51a78e2aad235b1f566e7b8..9ff4d8b91635bbd62d0664969afab4831c3446a8 100644 (file)
@@ -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;
 
index 6d415dcb9ea8c3b6021939085399f889060d2b7b..b5591a01f7a5c3ca919b6d193e41b27322df2318 100644 (file)
@@ -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 */
 
        /**
index 95fd71f3c7f8025b9d2e88222eb50cbeb97f33ee..9d8e570267223818045bf5f4a0f280bed93e3c44 100644 (file)
@@ -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);
index 0cf647a5581f6c7cd3ba3cd482e6d98eae117f07..2cc05c92cdfc603f9a7ac2bea384ef10048cebd5 100644 (file)
@@ -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;
 }
index 75c3429f7cf02ec20687d94faabcb123863bb662..8e4f0e46dd53752fbcf7be997656f147f82ad706 100644 (file)
@@ -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 */
 
index 458d51dd1ccfb4a06daa4daa4ae27515b899bd8f..a25c799892327a67545355b9b715f11944c23bc9 100644 (file)
@@ -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,
index 15b1016c099727e2b2ebf3e84573cd5ca7ae49f5..3b4b639fd06bc2614d7ec99105b15d7f6abf172a 100644 (file)
@@ -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) {
index b72e0df38608fb09c3928d794181039a4c5426b4..6c5a32048eda70ed43737887b200bdbc49c864b4 100644 (file)
@@ -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)",
index fb383962a946f7691941b04f7e0714e3fa199149..ae246f99cd9b7f86b2023dc7d31eb41bf5348263 100644 (file)
@@ -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';