@@ -2800,6 +2800,33 @@ int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, int freq,
"ANQP: Query Request to " MACSTR " for %u id(s)",
MAC2STR(dst), (unsigned int) num_ids);
+ if (bss) {
+ if (!wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_INTERWORKING)) {
+ wpa_dbg(wpa_s, MSG_ERROR, "ANQP: AP " MACSTR
+ " does not support Interworking, ignore anqp query request", MAC2STR(dst));
+ return -1;
+ } else if (num_ids > 0) {
+ size_t src, idx = 0;
+ for (src = 0; src < num_ids; src++) {
+ if (info_ids[src] == ANQP_AP_CIVIC_LOCATION &&
+ !wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_CIVIC_LOCATION)) {
+ continue;
+ }
+ if (info_ids[src] == ANQP_AP_GEOSPATIAL_LOCATION &&
+ !wpa_bss_ext_capab(bss, WLAN_EXT_CAPAB_GEOSPATIAL_LOCATION)) {
+ continue;
+ }
+ info_ids[idx++] = info_ids[src];
+ }
+ if (idx == 0) {
+ wpa_printf(MSG_DEBUG, "ANQP: Cannot send query request without valid anqp_info_id for "
+ MACSTR, MAC2STR(dst));
+ return -1;
+ }
+ num_ids = idx;
+ }
+ }
+
#ifdef CONFIG_HS20
if (subtypes != 0) {
extra_buf = wpabuf_alloc(100);
Before sending an ANQP query request, check the target AP's extended capabilities to avoid querying for information elements that the AP does not support. Verify the Interworking capability bit and filter out civic/geospatial location info IDs when the corresponding capability bits are not set. If no valid info IDs remain after filtering, return an error instead of sending a query that is guaranteed to fail. Signed-off-by: Chao Meng <chao.meng@unisoc.com> --- wpa_supplicant/interworking.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.21.0.windows.1