aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/interworking.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-09-04 13:50:52 (GMT)
committerJouni Malinen <j@w1.fi>2012-09-04 13:50:52 (GMT)
commit7e414b21c2af7c96c11a5ecf4e153e8e46efaa29 (patch)
tree1c6335266f234f270bf6dfc7c68b682ab71a3f38 /wpa_supplicant/interworking.c
parent476aed355a34f171b1826791f167277f95a7ae73 (diff)
downloadhostap-7e414b21c2af7c96c11a5ecf4e153e8e46efaa29.zip
hostap-7e414b21c2af7c96c11a5ecf4e153e8e46efaa29.tar.gz
hostap-7e414b21c2af7c96c11a5ecf4e153e8e46efaa29.tar.bz2
Interworking: Allow EAP-SIM/AKA/AKA' override in cred block
The eap parameter in the cred block can now be used to override automatic EAP-SIM/AKA/AKA' selection. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/interworking.c')
-rw-r--r--wpa_supplicant/interworking.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index bbcfe4d..8cf9244 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -736,6 +736,9 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
struct wpa_cred *cred;
struct wpa_ssid *ssid;
const u8 *ie;
+ int eap_type;
+ int res;
+ char prefix;
if (bss->anqp == NULL || bss->anqp->anqp_3gpp == NULL)
return -1;
@@ -797,14 +800,40 @@ static int interworking_connect_3gpp(struct wpa_supplicant *wpa_s,
if (interworking_set_hs20_params(ssid) < 0)
goto fail;
- /* TODO: figure out whether to use EAP-SIM, EAP-AKA, or EAP-AKA' */
- if (wpa_config_set(ssid, "eap", "SIM", 0) < 0) {
- wpa_printf(MSG_DEBUG, "EAP-SIM not supported");
+ eap_type = EAP_TYPE_SIM;
+ if (cred->pcsc && wpa_s->scard && scard_supports_umts(wpa_s->scard))
+ eap_type = EAP_TYPE_AKA;
+ if (cred->eap_method && cred->eap_method[0].vendor == EAP_VENDOR_IETF) {
+ if (cred->eap_method[0].method == EAP_TYPE_SIM ||
+ cred->eap_method[0].method == EAP_TYPE_AKA ||
+ cred->eap_method[0].method == EAP_TYPE_AKA_PRIME)
+ eap_type = cred->eap_method[0].method;
+ }
+
+ switch (eap_type) {
+ case EAP_TYPE_SIM:
+ prefix = '1';
+ res = wpa_config_set(ssid, "eap", "SIM", 0);
+ break;
+ case EAP_TYPE_AKA:
+ prefix = '0';
+ res = wpa_config_set(ssid, "eap", "AKA", 0);
+ break;
+ case EAP_TYPE_AKA_PRIME:
+ prefix = '6';
+ res = wpa_config_set(ssid, "eap", "AKA'", 0);
+ break;
+ default:
+ res = -1;
+ break;
+ }
+ if (res < 0) {
+ wpa_printf(MSG_DEBUG, "Selected EAP method (%d) not supported",
+ eap_type);
goto fail;
}
- if (cred->pcsc && wpa_s->scard && scard_supports_umts(wpa_s->scard))
- wpa_config_set(ssid, "eap", "AKA", 0);
- if (!cred->pcsc && set_root_nai(ssid, cred->imsi, '1') < 0) {
+
+ if (!cred->pcsc && set_root_nai(ssid, cred->imsi, prefix) < 0) {
wpa_printf(MSG_DEBUG, "Failed to set Root NAI");
goto fail;
}