]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add SIM identifier to the network profile and cred block
authorNaresh Jayaram <c_njayar@qti.qualcomm.com>
Fri, 28 Mar 2014 15:01:44 +0000 (17:01 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 24 Apr 2014 09:15:32 +0000 (12:15 +0300)
This allows the specific SIM to be identified for authentication
purposes in multi-SIM devices. This SIM number represents the index of
the SIM slot. This SIM number shall be used for the authentication using
the respective SIM for the Wi-Fi connection to the corresponding
network.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/eap_peer/eap_config.h
wpa_supplicant/README-HS20
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/config_ssid.h
wpa_supplicant/interworking.c
wpa_supplicant/wpa_supplicant.conf

index 98ec1f7631bdff623210364ff09af178abac6675..daa1d3288ad11e14a1d1879c7111606147e326b0 100644 (file)
@@ -678,6 +678,14 @@ struct eap_peer_config {
         * SIM/USIM processing.
         */
        char *external_sim_resp;
+
+       /**
+        * sim_num - User selected SIM identifier
+        *
+        * This variable is used for identifying which SIM is used if the system
+        * has more than one.
+        */
+       int sim_num;
 };
 
 
index d0b0b50a25bc646f1174bdfd3c4b08dd57e3a966..58c24750354053b5e39d898da817197a6959b54a 100644 (file)
@@ -270,6 +270,8 @@ Credentials can be pre-configured for automatic network selection:
 #      1 = try to use OCSP stapling, but not require response
 #      2 = require valid OCSP stapling response
 #
+# sim_num: Identifier for which SIM to use in multi-SIM devices
+#
 # for example:
 #
 #cred={
index b4ee1f5c04c9f1999b24104029fdac9364cfa93c..698b4592e1a427711c0390476bb369658bc1d798 100644 (file)
@@ -1666,6 +1666,7 @@ static const struct parse_data ssid_fields[] = {
        { INTe(engine) },
        { INTe(engine2) },
        { INT(eapol_flags) },
+       { INTe(sim_num) },
 #endif /* IEEE8021X_EAPOL */
        { FUNC_KEY(wep_key0) },
        { FUNC_KEY(wep_key1) },
@@ -2154,6 +2155,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid)
        ssid->eapol_flags = DEFAULT_EAPOL_FLAGS;
        ssid->eap_workaround = DEFAULT_EAP_WORKAROUND;
        ssid->eap.fragment_size = DEFAULT_FRAGMENT_SIZE;
+       ssid->eap.sim_num = DEFAULT_USER_SELECTED_SIM;
 #endif /* IEEE8021X_EAPOL */
 #ifdef CONFIG_HT_OVERRIDES
        ssid->disable_ht = DEFAULT_DISABLE_HT;
@@ -2572,6 +2574,11 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
                return 0;
        }
 
+       if (os_strcmp(var, "sim_num") == 0) {
+               cred->sim_num = atoi(value);
+               return 0;
+       }
+
        val = wpa_config_parse_string(value, &len);
        if (val == NULL) {
                wpa_printf(MSG_ERROR, "Line %d: invalid field '%s' string "
@@ -3100,6 +3107,7 @@ struct wpa_cred * wpa_config_add_cred(struct wpa_config *config)
        if (cred == NULL)
                return NULL;
        cred->id = id;
+       cred->sim_num = DEFAULT_USER_SELECTED_SIM;
        if (last)
                last->next = cred;
        else
index a39804949b621f81023a0690d8c1da340ef77fe2..26b1233a653adc63de22d257f12a152ee63b24a6 100644 (file)
@@ -288,6 +288,14 @@ struct wpa_cred {
         * 2 = require valid OCSP stapling response
         */
        int ocsp;
+
+       /**
+        * sim_num - User selected SIM identifier
+        *
+        * This variable is used for identifying which SIM is used if the system
+        * has more than one.
+        */
+       int sim_num;
 };
 
 
index 8f0561a0becd37e2ad736d769efe4b28acaef086..8d59f49678bd4d448ac545154619a51e25231acd 100644 (file)
@@ -219,6 +219,7 @@ static struct wpa_cred * wpa_config_read_cred(FILE *f, int *line, int id)
        if (cred == NULL)
                return NULL;
        cred->id = id;
+       cred->sim_num = DEFAULT_USER_SELECTED_SIM;
 
        while (wpa_config_get_line(buf, sizeof(buf), f, line, &pos)) {
                if (os_strcmp(pos, "}") == 0) {
@@ -712,6 +713,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
        STR(pac_file);
        INT_DEFe(fragment_size, DEFAULT_FRAGMENT_SIZE);
        INTe(ocsp);
+       INT_DEFe(sim_num, DEFAULT_USER_SELECTED_SIM);
 #endif /* IEEE8021X_EAPOL */
        INT(mode);
        INT(frequency);
@@ -858,6 +860,9 @@ static void wpa_config_write_cred(FILE *f, struct wpa_cred *cred)
                                cred->required_roaming_consortium[i]);
                fprintf(f, "\n");
        }
+
+       if (cred->sim_num != DEFAULT_USER_SELECTED_SIM)
+               fprintf(f, "\tsim_num=%d\n", cred->sim_num);
 }
 
 
index a458990dd80b4737b11efa007e135915bbd730bc..18fb65bbc3cfc3918cdf8cebe005a135f8da0dcb 100644 (file)
@@ -34,6 +34,7 @@
 #define DEFAULT_DISABLE_MAX_AMSDU -1 /* no change */
 #define DEFAULT_AMPDU_FACTOR -1 /* no change */
 #define DEFAULT_AMPDU_DENSITY -1 /* no change */
+#define DEFAULT_USER_SELECTED_SIM 1
 
 struct psk_list_entry {
        struct dl_list list;
index 3450ffead895b8897d143ed9679aa42b45a70841..f46c4cfc8b4fc0649e4fc945192018bdf3b11284 100644 (file)
@@ -925,6 +925,7 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
                goto fail;
        os_memcpy(ssid->ssid, bss->ssid, bss->ssid_len);
        ssid->ssid_len = bss->ssid_len;
+       ssid->eap.sim_num = cred->sim_num;
 
        if (interworking_set_hs20_params(wpa_s, ssid) < 0)
                goto fail;
index 86a4621e8aaa54ebc537e20432d1687d3027fcff..81fbdfb452217d768c4fdc0f1256d2d6bb7674fc 100644 (file)
@@ -483,6 +483,8 @@ fast_reauth=1
 #      1 = try to use OCSP stapling, but not require response
 #      2 = require valid OCSP stapling response
 #
+# sim_num: Identifier for which SIM to use in multi-SIM devices
+#
 # for example:
 #
 #cred={