ANQP: Parse and report Venue URL information

Parse the Venue URL ANQP-element payload and report it with the new
RX-VENUE-URL event messages if the query was done using PMF.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2018-09-13 01:56:37 +03:00
parent 1d73531fdb
commit 3ecb8a5203
2 changed files with 40 additions and 0 deletions

View file

@ -275,6 +275,9 @@ extern "C" {
#define RX_HS20_ICON "RX-HS20-ICON "
#define RX_MBO_ANQP "RX-MBO-ANQP "
/* parameters: <Venue Number> <Venue URL> */
#define RX_VENUE_URL "RX-VENUE-URL "
#define HS20_SUBSCRIPTION_REMEDIATION "HS20-SUBSCRIPTION-REMEDIATION "
#define HS20_DEAUTH_IMMINENT_NOTICE "HS20-DEAUTH-IMMINENT-NOTICE "
#define HS20_T_C_ACCEPTANCE "HS20-T-C-ACCEPTANCE "

View file

@ -2844,6 +2844,31 @@ static void anqp_add_extra(struct wpa_supplicant *wpa_s,
}
static void interworking_parse_venue_url(struct wpa_supplicant *wpa_s,
const u8 *data, size_t len)
{
const u8 *pos = data, *end = data + len;
char url[255];
while (end - pos >= 2) {
u8 slen, num;
slen = *pos++;
if (slen < 1 || slen > end - pos) {
wpa_printf(MSG_DEBUG,
"ANQP: Truncated Venue URL Duple field");
return;
}
num = *pos++;
os_memcpy(url, pos, slen - 1);
url[slen - 1] = '\0';
wpa_msg(wpa_s, MSG_INFO, RX_VENUE_URL "%u %s", num, url);
pos += slen - 1;
}
}
static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
struct wpa_bss *bss, const u8 *sa,
u16 info_id,
@ -2950,6 +2975,18 @@ static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
}
break;
#endif /* CONFIG_FILS */
case ANQP_VENUE_URL:
wpa_msg(wpa_s, MSG_INFO, RX_ANQP MACSTR " Venue URL",
MAC2STR(sa));
anqp_add_extra(wpa_s, anqp, info_id, pos, slen);
if (!wpa_sm_pmf_enabled(wpa_s->wpa)) {
wpa_printf(MSG_DEBUG,
"ANQP: Ignore Venue URL since PMF was not enabled");
break;
}
interworking_parse_venue_url(wpa_s, pos, slen);
break;
case ANQP_VENDOR_SPECIFIC:
if (slen < 3)
return;