From 8ecf2231fd5ddb396b8c4d94fb396e3c0ff785ac Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 10 Mar 2017 17:02:22 +0200 Subject: [PATCH] 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 --- wpa_supplicant/ctrl_iface.c | 2 +- wpa_supplicant/interworking.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 5aa3542bc..08348d292 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -6751,7 +6751,7 @@ static int get_anqp(struct wpa_supplicant *wpa_s, char *dst) pos++; } - if (num_id == 0) + if (num_id == 0 && !subtypes && !mbo_subtypes) return -1; return anqp_send_req(wpa_s, dst_addr, id, num_id, subtypes, diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c index 24bbeff33..b9ec12461 100644 --- a/wpa_supplicant/interworking.c +++ b/wpa_supplicant/interworking.c @@ -106,10 +106,12 @@ static struct wpabuf * anqp_build_req(u16 info_ids[], size_t num_ids, if (buf == NULL) return NULL; - len_pos = gas_anqp_add_element(buf, ANQP_QUERY_LIST); - for (i = 0; i < num_ids; i++) - wpabuf_put_le16(buf, info_ids[i]); - gas_anqp_set_element_len(buf, len_pos); + if (num_ids > 0) { + len_pos = gas_anqp_add_element(buf, ANQP_QUERY_LIST); + for (i = 0; i < num_ids; i++) + wpabuf_put_le16(buf, info_ids[i]); + gas_anqp_set_element_len(buf, len_pos); + } if (extra) wpabuf_put_buf(buf, extra);