Add SIM identifier to the network profile and cred block

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>
This commit is contained in:
Naresh Jayaram 2014-03-28 17:01:44 +02:00 committed by Jouni Malinen
parent 8a0f3bf613
commit 13f6a07efc
8 changed files with 35 additions and 0 deletions

View 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;
};

View 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={

View 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

View 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;
};

View 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);
}

View 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;

View 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;

View 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={