ANQP: Extend ANQP_GET command to request without IEEE 802.11 elements

Previously, ANQP_GET required at least one IEEE 802.11 ANQP-element to
be requested. This is not really necessary, so allow a case where
num_ids == 0 as long as the request includes at least one Hotspot 2.0 or
MBO ANQP-element.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-03-10 17:02:22 +02:00 committed by Jouni Malinen
parent a9be28bf6b
commit 8ecf2231fd
2 changed files with 7 additions and 5 deletions

View file

@ -6751,7 +6751,7 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst)
pos++; pos++;
} }
if (num_id == 0) if (num_id == 0 && !subtypes && !mbo_subtypes)
return -1; return -1;
return anqp_send_req(wpa_s, dst_addr, id, num_id, subtypes, return anqp_send_req(wpa_s, dst_addr, id, num_id, subtypes,

View file

@ -106,10 +106,12 @@ static struct wpabuf * anqp_build_req(u16 info_ids[], size_t num_ids,
if (buf == NULL) if (buf == NULL)
return NULL; return NULL;
len_pos = gas_anqp_add_element(buf, ANQP_QUERY_LIST); if (num_ids > 0) {
for (i = 0; i < num_ids; i++) len_pos = gas_anqp_add_element(buf, ANQP_QUERY_LIST);
wpabuf_put_le16(buf, info_ids[i]); for (i = 0; i < num_ids; i++)
gas_anqp_set_element_len(buf, len_pos); wpabuf_put_le16(buf, info_ids[i]);
gas_anqp_set_element_len(buf, len_pos);
}
if (extra) if (extra)
wpabuf_put_buf(buf, extra); wpabuf_put_buf(buf, extra);