mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 08:48:31 -05:00
FILS: Add support for building FILS Realm Information ANQP-element
This allows full list of hashed realm names to be fetched from hostapd. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
9cad618679
commit
8183aee6cc
@ -261,10 +261,13 @@ static void anqp_add_capab_list(struct hostapd_data *hapd,
|
|||||||
wpabuf_put_le16(buf, ANQP_EMERGENCY_NAI);
|
wpabuf_put_le16(buf, ANQP_EMERGENCY_NAI);
|
||||||
if (get_anqp_elem(hapd, ANQP_NEIGHBOR_REPORT))
|
if (get_anqp_elem(hapd, ANQP_NEIGHBOR_REPORT))
|
||||||
wpabuf_put_le16(buf, ANQP_NEIGHBOR_REPORT);
|
wpabuf_put_le16(buf, ANQP_NEIGHBOR_REPORT);
|
||||||
for (id = 273; id < 277; id++) {
|
#ifdef CONFIG_FILS
|
||||||
if (get_anqp_elem(hapd, id))
|
if (!dl_list_empty(&hapd->conf->fils_realms) ||
|
||||||
wpabuf_put_le16(buf, id);
|
get_anqp_elem(hapd, ANQP_FILS_REALM_INFO))
|
||||||
}
|
wpabuf_put_le16(buf, ANQP_FILS_REALM_INFO);
|
||||||
|
#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 (get_anqp_elem(hapd, ANQP_VENUE_URL))
|
||||||
wpabuf_put_le16(buf, ANQP_VENUE_URL);
|
wpabuf_put_le16(buf, ANQP_VENUE_URL);
|
||||||
if (get_anqp_elem(hapd, ANQP_ADVICE_OF_CHARGE))
|
if (get_anqp_elem(hapd, ANQP_ADVICE_OF_CHARGE))
|
||||||
@ -554,6 +557,35 @@ static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_FILS
|
||||||
|
static void anqp_add_fils_realm_info(struct hostapd_data *hapd,
|
||||||
|
struct wpabuf *buf)
|
||||||
|
{
|
||||||
|
size_t count;
|
||||||
|
|
||||||
|
if (anqp_add_override(hapd, buf, ANQP_FILS_REALM_INFO))
|
||||||
|
return;
|
||||||
|
|
||||||
|
count = dl_list_len(&hapd->conf->fils_realms);
|
||||||
|
if (count > 10000)
|
||||||
|
count = 10000;
|
||||||
|
if (count) {
|
||||||
|
struct fils_realm *realm;
|
||||||
|
|
||||||
|
wpabuf_put_le16(buf, ANQP_FILS_REALM_INFO);
|
||||||
|
wpabuf_put_le16(buf, 2 * count);
|
||||||
|
|
||||||
|
dl_list_for_each(realm, &hapd->conf->fils_realms,
|
||||||
|
struct fils_realm, list) {
|
||||||
|
if (count == 0)
|
||||||
|
break;
|
||||||
|
wpabuf_put_data(buf, realm->hash, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_FILS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_HS20
|
#ifdef CONFIG_HS20
|
||||||
|
|
||||||
static void anqp_add_operator_friendly_name(struct hostapd_data *hapd,
|
static void anqp_add_operator_friendly_name(struct hostapd_data *hapd,
|
||||||
@ -827,6 +859,10 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
|
|||||||
len += 1000;
|
len += 1000;
|
||||||
if (request & ANQP_REQ_ICON_REQUEST)
|
if (request & ANQP_REQ_ICON_REQUEST)
|
||||||
len += 65536;
|
len += 65536;
|
||||||
|
#ifdef CONFIG_FILS
|
||||||
|
if (request & ANQP_FILS_REALM_INFO)
|
||||||
|
len += 2 * dl_list_len(&hapd->conf->fils_realms);
|
||||||
|
#endif /* CONFIG_FILS */
|
||||||
len += anqp_get_required_len(hapd, extra_req, num_extra_req);
|
len += anqp_get_required_len(hapd, extra_req, num_extra_req);
|
||||||
|
|
||||||
buf = wpabuf_alloc(len);
|
buf = wpabuf_alloc(len);
|
||||||
@ -866,8 +902,15 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
|
|||||||
if (request & ANQP_REQ_EMERGENCY_NAI)
|
if (request & ANQP_REQ_EMERGENCY_NAI)
|
||||||
anqp_add_elem(hapd, buf, ANQP_EMERGENCY_NAI);
|
anqp_add_elem(hapd, buf, ANQP_EMERGENCY_NAI);
|
||||||
|
|
||||||
for (i = 0; i < num_extra_req; i++)
|
for (i = 0; i < num_extra_req; i++) {
|
||||||
|
#ifdef CONFIG_FILS
|
||||||
|
if (extra_req[i] == ANQP_FILS_REALM_INFO) {
|
||||||
|
anqp_add_fils_realm_info(hapd, buf);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_FILS */
|
||||||
anqp_add_elem(hapd, buf, extra_req[i]);
|
anqp_add_elem(hapd, buf, extra_req[i]);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_HS20
|
#ifdef CONFIG_HS20
|
||||||
if (request & ANQP_REQ_HS_CAPABILITY_LIST)
|
if (request & ANQP_REQ_HS_CAPABILITY_LIST)
|
||||||
@ -990,6 +1033,13 @@ static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
|
|||||||
get_anqp_elem(hapd, info_id) != NULL, qi);
|
get_anqp_elem(hapd, info_id) != NULL, qi);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
#ifdef CONFIG_FILS
|
||||||
|
if (info_id == ANQP_FILS_REALM_INFO &&
|
||||||
|
!dl_list_empty(&hapd->conf->fils_realms)) {
|
||||||
|
wpa_printf(MSG_DEBUG,
|
||||||
|
"ANQP: FILS Realm Information (local)");
|
||||||
|
} else
|
||||||
|
#endif /* CONFIG_FILS */
|
||||||
if (!get_anqp_elem(hapd, info_id)) {
|
if (!get_anqp_elem(hapd, info_id)) {
|
||||||
wpa_printf(MSG_DEBUG, "ANQP: Unsupported Info Id %u",
|
wpa_printf(MSG_DEBUG, "ANQP: Unsupported Info Id %u",
|
||||||
info_id);
|
info_id);
|
||||||
|
@ -653,7 +653,7 @@ enum anqp_info_id {
|
|||||||
ANQP_NEIGHBOR_REPORT = 272,
|
ANQP_NEIGHBOR_REPORT = 272,
|
||||||
ANQP_QUERY_AP_LIST = 273,
|
ANQP_QUERY_AP_LIST = 273,
|
||||||
ANQP_AP_LIST_RESPONSE = 274,
|
ANQP_AP_LIST_RESPONSE = 274,
|
||||||
AMQP_FILS_REALM_INFO = 275,
|
ANQP_FILS_REALM_INFO = 275,
|
||||||
ANQP_CAG = 276,
|
ANQP_CAG = 276,
|
||||||
ANQP_VENUE_URL = 277,
|
ANQP_VENUE_URL = 277,
|
||||||
ANQP_ADVICE_OF_CHARGE = 278,
|
ANQP_ADVICE_OF_CHARGE = 278,
|
||||||
|
Loading…
Reference in New Issue
Block a user