HS 2.0R2: Add tracking of provisioning SP
The new provisioning_sp cred field can now be used to track which SP provisioned the credential. This makes it easier to find the matching PPS MO from the management tree (./Wi-Fi/<provisioning_sp>). Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
8e5fdfabf6
commit
aa26ba68b4
8 changed files with 69 additions and 6 deletions
|
@ -223,6 +223,10 @@ Credentials can be pre-configured for automatic network selection:
|
||||||
# update_identifier: PPS MO ID
|
# update_identifier: PPS MO ID
|
||||||
# (Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
|
# (Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
|
||||||
#
|
#
|
||||||
|
# provisioning_sp: FQDN of the SP that provisioned the credential
|
||||||
|
# This optional field can be used to keep track of the SP that provisioned
|
||||||
|
# the credential to find the PPS MO (./Wi-Fi/<provisioning_sp>).
|
||||||
|
#
|
||||||
# for example:
|
# for example:
|
||||||
#
|
#
|
||||||
#cred={
|
#cred={
|
||||||
|
|
|
@ -1930,6 +1930,7 @@ void wpa_config_free_cred(struct wpa_cred *cred)
|
||||||
os_free(cred->phase2);
|
os_free(cred->phase2);
|
||||||
os_free(cred->excluded_ssid);
|
os_free(cred->excluded_ssid);
|
||||||
os_free(cred->roaming_partner);
|
os_free(cred->roaming_partner);
|
||||||
|
os_free(cred->provisioning_sp);
|
||||||
os_free(cred);
|
os_free(cred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2660,6 +2661,12 @@ int wpa_config_set_cred(struct wpa_cred *cred, const char *var,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (os_strcmp(var, "provisioning_sp") == 0) {
|
||||||
|
os_free(cred->provisioning_sp);
|
||||||
|
cred->provisioning_sp = val;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (line) {
|
if (line) {
|
||||||
wpa_printf(MSG_ERROR, "Line %d: unknown cred field '%s'.",
|
wpa_printf(MSG_ERROR, "Line %d: unknown cred field '%s'.",
|
||||||
line, var);
|
line, var);
|
||||||
|
|
|
@ -246,6 +246,11 @@ struct wpa_cred {
|
||||||
size_t num_roaming_partner;
|
size_t num_roaming_partner;
|
||||||
|
|
||||||
int update_identifier;
|
int update_identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provisioning_sp - FQDN of the SP that provisioned the credential
|
||||||
|
*/
|
||||||
|
char *provisioning_sp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -806,6 +806,9 @@ static void wpa_config_write_cred(FILE *f, struct wpa_cred *cred)
|
||||||
}
|
}
|
||||||
if (cred->update_identifier)
|
if (cred->update_identifier)
|
||||||
fprintf(f, "\tupdate_identifier=%d\n", cred->update_identifier);
|
fprintf(f, "\tupdate_identifier=%d\n", cred->update_identifier);
|
||||||
|
|
||||||
|
if (cred->provisioning_sp)
|
||||||
|
fprintf(f, "\tprovisioning_sp=%s\n", cred->provisioning_sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1720,15 +1720,38 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
|
||||||
if (wpa_s->current_ssid->parent_cred != cred)
|
if (wpa_s->current_ssid->parent_cred != cred)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i = 0; cred->domain && i < cred->num_domain; i++) {
|
if (cred->provisioning_sp) {
|
||||||
ret = os_snprintf(pos, end - pos,
|
ret = os_snprintf(pos, end - pos,
|
||||||
"home_sp=%s\n",
|
"provisioning_sp=%s\n",
|
||||||
cred->domain[i]);
|
cred->provisioning_sp);
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cred->domain)
|
||||||
|
goto no_domain;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (wpa_s->current_bss && wpa_s->current_bss->anqp) {
|
||||||
|
struct wpabuf *names =
|
||||||
|
wpa_s->current_bss->anqp->domain_name;
|
||||||
|
for (i = 0; names && i < cred->num_domain; i++)
|
||||||
|
{
|
||||||
|
if (domain_name_list_contains(
|
||||||
|
names, cred->domain[i], 1))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == cred->num_domain)
|
||||||
|
i = 0; /* show first entry by default */
|
||||||
|
}
|
||||||
|
ret = os_snprintf(pos, end - pos, "home_sp=%s\n",
|
||||||
|
cred->domain[i]);
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
|
no_domain:
|
||||||
if (wpa_s->current_bss == NULL ||
|
if (wpa_s->current_bss == NULL ||
|
||||||
wpa_s->current_bss->anqp == NULL)
|
wpa_s->current_bss->anqp == NULL)
|
||||||
res = -1;
|
res = -1;
|
||||||
|
@ -2695,7 +2718,8 @@ static int wpa_supplicant_ctrl_iface_remove_cred(struct wpa_supplicant *wpa_s,
|
||||||
int id;
|
int id;
|
||||||
struct wpa_cred *cred, *prev;
|
struct wpa_cred *cred, *prev;
|
||||||
|
|
||||||
/* cmd: "<cred id>", "all", or "sp_fqdn=<FQDN>" */
|
/* cmd: "<cred id>", "all", "sp_fqdn=<FQDN>", or
|
||||||
|
* "provisioning_sp=<FQDN> */
|
||||||
if (os_strcmp(cmd, "all") == 0) {
|
if (os_strcmp(cmd, "all") == 0) {
|
||||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED all");
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED all");
|
||||||
cred = wpa_s->conf->cred;
|
cred = wpa_s->conf->cred;
|
||||||
|
@ -2728,6 +2752,20 @@ static int wpa_supplicant_ctrl_iface_remove_cred(struct wpa_supplicant *wpa_s,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (os_strncmp(cmd, "provisioning_sp=", 16) == 0) {
|
||||||
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED provisioning SP FQDN '%s'",
|
||||||
|
cmd + 16);
|
||||||
|
cred = wpa_s->conf->cred;
|
||||||
|
while (cred) {
|
||||||
|
prev = cred;
|
||||||
|
cred = cred->next;
|
||||||
|
if (prev->provisioning_sp &&
|
||||||
|
os_strcmp(prev->provisioning_sp, cmd + 16) == 0)
|
||||||
|
wpas_ctrl_remove_cred(wpa_s, prev);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
id = atoi(cmd);
|
id = atoi(cmd);
|
||||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED id=%d", id);
|
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_CRED id=%d", id);
|
||||||
|
|
||||||
|
|
|
@ -1634,8 +1634,8 @@ static struct wpa_cred * interworking_credentials_available(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int domain_name_list_contains(struct wpabuf *domain_names,
|
int domain_name_list_contains(struct wpabuf *domain_names,
|
||||||
const char *domain, int exact_match)
|
const char *domain, int exact_match)
|
||||||
{
|
{
|
||||||
const u8 *pos, *end;
|
const u8 *pos, *end;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
|
@ -29,5 +29,7 @@ void interworking_start_fetch_anqp(struct wpa_supplicant *wpa_s);
|
||||||
int interworking_home_sp_cred(struct wpa_supplicant *wpa_s,
|
int interworking_home_sp_cred(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_cred *cred,
|
struct wpa_cred *cred,
|
||||||
struct wpabuf *domain_names);
|
struct wpabuf *domain_names);
|
||||||
|
int domain_name_list_contains(struct wpabuf *domain_names,
|
||||||
|
const char *domain, int exact_match);
|
||||||
|
|
||||||
#endif /* INTERWORKING_H */
|
#endif /* INTERWORKING_H */
|
||||||
|
|
|
@ -442,6 +442,10 @@ fast_reauth=1
|
||||||
# update_identifier: PPS MO ID
|
# update_identifier: PPS MO ID
|
||||||
# (Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
|
# (Hotspot 2.0 PerProviderSubscription/UpdateIdentifier)
|
||||||
#
|
#
|
||||||
|
# provisioning_sp: FQDN of the SP that provisioned the credential
|
||||||
|
# This optional field can be used to keep track of the SP that provisioned
|
||||||
|
# the credential to find the PPS MO (./Wi-Fi/<provisioning_sp>).
|
||||||
|
#
|
||||||
# for example:
|
# for example:
|
||||||
#
|
#
|
||||||
#cred={
|
#cred={
|
||||||
|
|
Loading…
Reference in a new issue