aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-08-02 18:42:54 +0300
committerShake M Subhani <sshake@codeaurora.org>2013-11-19 12:54:50 +0530
commit9bf129320e6be439e7c6a12ca513cf4763ccfc0f (patch)
treebd5159d942b58d9bd89e4b89e1c3e9a902987804
parent2097f64e7757ab4c8096f5f3552bd4a83ae5fa07 (diff)
downloadandroid_external_wpa_supplicant_8-9bf129320e6be439e7c6a12ca513cf4763ccfc0f.tar.gz
android_external_wpa_supplicant_8-9bf129320e6be439e7c6a12ca513cf4763ccfc0f.tar.bz2
android_external_wpa_supplicant_8-9bf129320e6be439e7c6a12ca513cf4763ccfc0f.zip
Interworking: Add support for multiple home FQDNs
Credentials can now be configured with more than one FQDN ('domain' field in the cred block) to perform Domain Name List matching against multiple home domains. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com> Git-commit: 463c8ffbd5bf15dc5158d68fc32347cfb5746a83 Git-repo : git://w1.fi/srv/git/hostap.git CRs-fixed: 567930 Change-Id: I0ac87ac8c98d62722330321a3a3ce49ff81ab2c9
-rw-r--r--wpa_supplicant/README-HS206
-rw-r--r--wpa_supplicant/config.c16
-rw-r--r--wpa_supplicant/config.h13
-rw-r--r--wpa_supplicant/config_file.c9
-rw-r--r--wpa_supplicant/ctrl_iface.c30
-rw-r--r--wpa_supplicant/interworking.c11
-rw-r--r--wpa_supplicant/wpa_supplicant.conf6
7 files changed, 65 insertions, 26 deletions
diff --git a/wpa_supplicant/README-HS20 b/wpa_supplicant/README-HS20
index 5669c55c..7a570bdd 100644
--- a/wpa_supplicant/README-HS20
+++ b/wpa_supplicant/README-HS20
@@ -166,9 +166,11 @@ Credentials can be pre-configured for automatic network selection:
# milenage: Milenage parameters for SIM/USIM simulator in <Ki>:<OPc>:<SQN>
# format
#
-# domain: Home service provider FQDN
+# domain: Home service provider FQDN(s)
# This is used to compare against the Domain Name List to figure out
-# whether the AP is operated by the Home SP.
+# whether the AP is operated by the Home SP. Multiple domain entries can
+# be used to configure alternative FQDNs that will be considered home
+# networks.
#
# roaming_consortium: Roaming Consortium OI
# If roaming_consortium_len is non-zero, this field contains the
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index d666c91a..12136ab6 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1813,6 +1813,8 @@ void wpa_config_free_ssid(struct wpa_ssid *ssid)
void wpa_config_free_cred(struct wpa_cred *cred)
{
+ size_t i;
+
os_free(cred->realm);
os_free(cred->username);
os_free(cred->password);
@@ -1822,6 +1824,8 @@ void wpa_config_free_cred(struct wpa_cred *cred)
os_free(cred->private_key_passwd);
os_free(cred->imsi);
os_free(cred->milenage);
+ for (i = 0; i < cred->num_domain; i++)
+ os_free(cred->domain[i]);
os_free(cred->domain);
os_free(cred->eap_method);
os_free(cred->phase1);
@@ -2395,8 +2399,16 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
}
if (os_strcmp(var, "domain") == 0) {
- os_free(cred->domain);
- cred->domain = val;
+ char **new_domain;
+ new_domain = os_realloc_array(cred->domain,
+ cred->num_domain + 1,
+ sizeof(char *));
+ if (new_domain == NULL) {
+ os_free(val);
+ return -1;
+ }
+ new_domain[cred->num_domain++] = val;
+ cred->domain = new_domain;
return 0;
}
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 1748cf3b..27301b80 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -150,12 +150,19 @@ struct wpa_cred {
char *milenage;
/**
- * domain - Home service provider FQDN
+ * domain - Home service provider FQDN(s)
*
* This is used to compare against the Domain Name List to figure out
- * whether the AP is operated by the Home SP.
+ * whether the AP is operated by the Home SP. Multiple domain entries
+ * can be used to configure alternative FQDNs that will be considered
+ * home networks.
*/
- char *domain;
+ char **domain;
+
+ /**
+ * num_domain - Number of FQDNs in the domain array
+ */
+ size_t num_domain;
/**
* roaming_consortium - Roaming Consortium OI
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index a2791ebb..d04eea03 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -725,6 +725,8 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
static void wpa_config_write_cred(FILE *f, struct wpa_cred *cred)
{
+ size_t i;
+
if (cred->priority)
fprintf(f, "\tpriority=%d\n", cred->priority);
if (cred->pcsc)
@@ -750,10 +752,9 @@ static void wpa_config_write_cred(FILE *f, struct wpa_cred *cred)
fprintf(f, "\timsi=\"%s\"\n", cred->imsi);
if (cred->milenage)
fprintf(f, "\tmilenage=\"%s\"\n", cred->milenage);
- if (cred->domain)
- fprintf(f, "\tdomain=\"%s\"\n", cred->domain);
+ for (i = 0; i < cred->num_domain; i++)
+ fprintf(f, "\tdomain=\"%s\"\n", cred->domain[i]);
if (cred->roaming_consortium_len) {
- size_t i;
fprintf(f, "\troaming_consortium=");
for (i = 0; i < cred->roaming_consortium_len; i++)
fprintf(f, "%02x", cred->roaming_consortium[i]);
@@ -770,7 +771,7 @@ static void wpa_config_write_cred(FILE *f, struct wpa_cred *cred)
if (cred->phase2)
fprintf(f, "\tphase2=\"%s\"\n", cred->phase2);
if (cred->excluded_ssid) {
- size_t i, j;
+ size_t j;
for (i = 0; i < cred->num_excluded_ssid; i++) {
struct excluded_ssid *e = &cred->excluded_ssid[i];
fprintf(f, "\texcluded_ssid=");
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 3b676470..add831a0 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -1563,16 +1563,21 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
char *type;
for (cred = wpa_s->conf->cred; cred; cred = cred->next) {
+ size_t i;
+
if (wpa_s->current_ssid->parent_cred != cred)
continue;
if (!cred->domain)
continue;
- ret = os_snprintf(pos, end - pos, "home_sp=%s\n",
- cred->domain);
- if (ret < 0 || ret >= end - pos)
- return pos - buf;
- pos += ret;
+ for (i = 0; i < cred->num_domain; i++) {
+ ret = os_snprintf(pos, end - pos,
+ "home_sp=%s\n",
+ cred->domain[i]);
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+ }
if (wpa_s->current_bss == NULL ||
wpa_s->current_bss->anqp == NULL)
@@ -2465,7 +2470,7 @@ static int wpa_supplicant_ctrl_iface_list_creds(struct wpa_supplicant *wpa_s,
ret = os_snprintf(pos, end - pos, "%d\t%s\t%s\t%s\t%s\n",
cred->id, cred->realm ? cred->realm : "",
cred->username ? cred->username : "",
- cred->domain ? cred->domain : "",
+ cred->domain ? cred->domain[0] : "",
cred->imsi ? cred->imsi : "");
if (ret < 0 || ret >= end - pos)
return pos - buf;
@@ -2550,9 +2555,16 @@ static int wpa_supplicant_ctrl_iface_remove_cred(struct wpa_supplicant *wpa_s,
while (cred) {
prev = cred;
cred = cred->next;
- if (prev->domain &&
- os_strcmp(prev->domain, cmd + 8) == 0)
- wpas_ctrl_remove_cred(wpa_s, prev);
+ if (prev->domain) {
+ size_t i;
+ for (i = 0; i < prev->num_domain; i++) {
+ if (os_strcmp(prev->domain[i], cmd + 8)
+ != 0)
+ continue;
+ wpas_ctrl_remove_cred(wpa_s, prev);
+ break;
+ }
+ }
}
return 0;
}
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index 4c699378..30157ecb 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -1532,6 +1532,7 @@ int interworking_home_sp_cred(struct wpa_supplicant *wpa_s,
struct wpa_cred *cred,
struct wpabuf *domain_names)
{
+ size_t i;
#ifdef INTERWORKING_3GPP
char nai[100], *realm;
@@ -1562,10 +1563,12 @@ int interworking_home_sp_cred(struct wpa_supplicant *wpa_s,
if (domain_names == NULL || cred->domain == NULL)
return 0;
- wpa_printf(MSG_DEBUG, "Interworking: Search for match with "
- "home SP FQDN %s", cred->domain);
- if (domain_name_list_contains(domain_names, cred->domain))
- return 1;
+ for (i = 0; i < cred->num_domain; i++) {
+ wpa_printf(MSG_DEBUG, "Interworking: Search for match with "
+ "home SP FQDN %s", cred->domain[i]);
+ if (domain_name_list_contains(domain_names, cred->domain[i]))
+ return 1;
+ }
return 0;
}
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index d73d3715..6414f447 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -399,9 +399,11 @@ fast_reauth=1
# milenage: Milenage parameters for SIM/USIM simulator in <Ki>:<OPc>:<SQN>
# format
#
-# domain: Home service provider FQDN
+# domain: Home service provider FQDN(s)
# This is used to compare against the Domain Name List to figure out
-# whether the AP is operated by the Home SP.
+# whether the AP is operated by the Home SP. Multiple domain entries can
+# be used to configure alternative FQDNs that will be considered home
+# networks.
#
# roaming_consortium: Roaming Consortium OI
# If roaming_consortium_len is non-zero, this field contains the