aboutsummaryrefslogtreecommitdiffstats
path: root/hs20
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2018-09-12 00:50:16 (GMT)
committerJouni Malinen <jouni@codeaurora.org>2018-09-12 21:17:15 (GMT)
commitb275c3ae51c90c5620c526abc2b1492d89d11cfa (patch)
tree0612192bd3c2c607a709f88ae2b2a7e3a6f2a028 /hs20
parent40d514ec64ab6ddfcbfe4a16a9f3bce74733b8de (diff)
downloadhostap-b275c3ae51c90c5620c526abc2b1492d89d11cfa.zip
hostap-b275c3ae51c90c5620c526abc2b1492d89d11cfa.tar.gz
hostap-b275c3ae51c90c5620c526abc2b1492d89d11cfa.tar.bz2
HS 2.0: Use shared SSID (if available) for OSU by default
When the AP is detected to have single BSS shared for RSN and OSEN, use that BSS for OSU by default instead of the one based on the OSU_SSID in the OSU Providers list. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Diffstat (limited to 'hs20')
-rw-r--r--hs20/client/osu_client.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index a7ddd19..a174699 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -1986,6 +1986,7 @@ struct osu_data {
char url[256];
unsigned int methods;
char osu_ssid[33];
+ char osu_ssid2[33];
char osu_nai[256];
struct osu_lang_text friendly_name[MAX_OSU_VALS];
size_t friendly_name_count;
@@ -2045,6 +2046,12 @@ static struct osu_data * parse_osu_providers(const char *fname, size_t *count)
continue;
}
+ if (strncmp(buf, "osu_ssid2=", 10) == 0) {
+ snprintf(last->osu_ssid2, sizeof(last->osu_ssid2),
+ "%s", buf + 10);
+ continue;
+ }
+
if (os_strncmp(buf, "osu_nai=", 8) == 0) {
os_snprintf(last->osu_nai, sizeof(last->osu_nai),
"%s", buf + 8);
@@ -2126,7 +2133,7 @@ static struct osu_data * parse_osu_providers(const char *fname, size_t *count)
static int osu_connect(struct hs20_osu_client *ctx, const char *bssid,
- const char *ssid, const char *url,
+ const char *ssid, const char *ssid2, const char *url,
unsigned int methods, int no_prod_assoc,
const char *osu_nai)
{
@@ -2136,6 +2143,9 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid,
struct wpa_ctrl *mon;
int res;
+ if (ssid2 && ssid2[0] == '\0')
+ ssid2 = NULL;
+
id = add_network(ifname);
if (id < 0)
return -1;
@@ -2147,6 +2157,9 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid,
return -1;
os_snprintf(fname, sizeof(fname), "%s/osu-ca.pem", dir);
+ if (ssid2 && set_network_quoted(ifname, id, "ssid", ssid2) < 0)
+ return -1;
+
if (set_network(ifname, id, "proto", "OSEN") < 0 ||
set_network(ifname, id, "key_mgmt", "OSEN") < 0 ||
set_network(ifname, id, "pairwise", "CCMP") < 0 ||
@@ -2331,6 +2344,8 @@ static int cmd_osu_select(struct hs20_osu_client *ctx, const char *dir,
fprintf(f, "</table></a><br><small>BSSID: %s<br>\n"
"SSID: %s<br>\n",
last->bssid, last->osu_ssid);
+ if (last->osu_ssid2[0])
+ fprintf(f, "SSID2: %s<br>\n", last->osu_ssid2);
if (last->osu_nai[0])
fprintf(f, "NAI: %s<br>\n", last->osu_nai);
fprintf(f, "URL: %s<br>\n"
@@ -2359,6 +2374,8 @@ selected:
ret = 0;
wpa_printf(MSG_INFO, "BSSID: %s", last->bssid);
wpa_printf(MSG_INFO, "SSID: %s", last->osu_ssid);
+ if (last->osu_ssid2[0])
+ wpa_printf(MSG_INFO, "SSID2: %s", last->osu_ssid2);
wpa_printf(MSG_INFO, "URL: %s", last->url);
write_summary(ctx, "Selected OSU provider id=%d BSSID=%s SSID=%s URL=%s",
ret, last->bssid, last->osu_ssid, last->url);
@@ -2413,10 +2430,12 @@ selected:
"No supported OSU provisioning method");
ret = -1;
}
- } else if (connect)
+ } else if (connect) {
ret = osu_connect(ctx, last->bssid, last->osu_ssid,
+ last->osu_ssid2,
last->url, last->methods,
no_prod_assoc, last->osu_nai);
+ }
} else
ret = -1;