[PATCH] ANQP: Filter info IDs based on AP extended capabilities
孟超 (Chao Meng)
Chao.Meng at unisoc.com
Mon Aug 24 00:06:17 PDT 2026
From 34890fa6fb2849841e0a3ad5b5d5086fa7aad436 Mon Sep 17 00:00:00 2001
From: Chao Meng <chao.meng at unisoc.com>
Date: Mon, 24 Aug 2026 15:04:18 +0800
Subject: [PATCH] ANQP: Filter info IDs based on AP extended capabilities
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 at unisoc.com>
---
wpa_supplicant/interworking.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index f77880409..14e968596 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -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);
--
________________________________
This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.
本邮件及其附件具有保密性质,受法律保护不得泄露,仅发送给本邮件所指特定收件人。严禁非经授权使用、宣传、发布或复制本邮件或其内容。若非该特定收件人,请勿阅读、复制、 使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件的方式即刻告知发件人。无法保证互联网通信及时、安全、无误或防毒。发件人对任何错漏均不承担责任。
More information about the Hostap
mailing list