Add hostapd.conf venue_url to set Venue URL ANQP-element

The new venue_url parameter can now be used to set the Venue URL ANQP
information instead of having to construct the data and use
anqp_elem=277:<hexdump> to set the raw value.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2018-03-26 16:10:47 +03:00 committed by Jouni Malinen
parent 64624f31cf
commit 7e1d3ee963
5 changed files with 93 additions and 2 deletions

View file

@ -577,6 +577,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
os_free(conf->roaming_consortium);
os_free(conf->venue_name);
os_free(conf->venue_url);
os_free(conf->nai_realm_data);
os_free(conf->network_auth_type);
os_free(conf->anqp_3gpp_cell_net);

View file

@ -201,6 +201,12 @@ struct hostapd_lang_string {
u8 name[252];
};
struct hostapd_venue_url {
u8 venue_number;
u8 url_len;
u8 url[254];
};
#define MAX_NAI_REALMS 10
#define MAX_NAI_REALMLEN 255
#define MAX_NAI_EAP_METHODS 5
@ -504,6 +510,10 @@ struct hostapd_bss_config {
unsigned int venue_name_count;
struct hostapd_lang_string *venue_name;
/* Venue URL duples */
unsigned int venue_url_count;
struct hostapd_venue_url *venue_url;
/* IEEE 802.11u - Network Authentication Type */
u8 *network_auth_type;
size_t network_auth_type_len;

View file

@ -288,7 +288,7 @@ static void anqp_add_capab_list(struct hostapd_data *hapd,
#endif /* CONFIG_FILS */
if (get_anqp_elem(hapd, ANQP_CAG))
wpabuf_put_le16(buf, ANQP_CAG);
if (get_anqp_elem(hapd, ANQP_VENUE_URL))
if (hapd->conf->venue_url || get_anqp_elem(hapd, ANQP_VENUE_URL))
wpabuf_put_le16(buf, ANQP_VENUE_URL);
if (get_anqp_elem(hapd, ANQP_ADVICE_OF_CHARGE))
wpabuf_put_le16(buf, ANQP_ADVICE_OF_CHARGE);
@ -328,6 +328,29 @@ static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf)
}
static void anqp_add_venue_url(struct hostapd_data *hapd, struct wpabuf *buf)
{
if (anqp_add_override(hapd, buf, ANQP_VENUE_URL))
return;
if (hapd->conf->venue_url) {
u8 *len;
unsigned int i;
len = gas_anqp_add_element(buf, ANQP_VENUE_URL);
for (i = 0; i < hapd->conf->venue_url_count; i++) {
struct hostapd_venue_url *url;
url = &hapd->conf->venue_url[i];
wpabuf_put_u8(buf, 1 + url->url_len);
wpabuf_put_u8(buf, url->venue_number);
wpabuf_put_data(buf, url->url, url->url_len);
}
gas_anqp_set_element_len(buf, len);
}
}
static void anqp_add_network_auth_type(struct hostapd_data *hapd,
struct wpabuf *buf)
{
@ -946,6 +969,10 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
continue;
}
#endif /* CONFIG_FILS */
if (extra_req[i] == ANQP_VENUE_URL) {
anqp_add_venue_url(hapd, buf);
continue;
}
anqp_add_elem(hapd, buf, extra_req[i]);
}
@ -1082,7 +1109,10 @@ static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
"ANQP: FILS Realm Information (local)");
} else
#endif /* CONFIG_FILS */
if (!get_anqp_elem(hapd, info_id)) {
if (info_id == ANQP_VENUE_URL && hapd->conf->venue_url) {
wpa_printf(MSG_DEBUG,
"ANQP: Venue URL (local)");
} else if (!get_anqp_elem(hapd, info_id)) {
wpa_printf(MSG_DEBUG, "ANQP: Unsupported Info Id %u",
info_id);
break;