[PATCH v2 1/2] ANQP/hostapd RNR response to RNR query to ANQP query through action frame.

sharadanandk at gmail.com sharadanandk at gmail.com
Tue Feb 8 08:59:30 PST 2022


From: Sharadanand Karanjkar <skaranjkar at datto.com>

STA can query for RNR report from ANQP action frame.
Parse all the interfaces and fill the RNR information.

Signed-off-by: Sharadanand Karanjkar <skaranjkar at datto.com>
---
Changes to PATCHv1
- Fix indentation issues.
---
 src/ap/gas_serv.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/ap/gas_serv.c b/src/ap/gas_serv.c
index 90f15778b..b22a52675 100644
--- a/src/ap/gas_serv.c
+++ b/src/ap/gas_serv.c
@@ -603,6 +603,34 @@ static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf)
 	}
 }
 
+static void anqp_add_neighbor_report(struct hostapd_data *hapd,
+                      struct wpabuf *buf)
+{
+	if (anqp_add_override(hapd, buf, ANQP_NEIGHBOR_REPORT))
+		return;
+
+	if (hapd->conf->radio_measurements[0] &
+			WLAN_RRM_CAPS_NEIGHBOR_REPORT) {
+		struct hostapd_neighbor_entry *nr;
+		struct hostapd_iface* iface;
+		int i;
+		u8* len, *nei_len;
+
+		for (i = 0; i < hapd->iface->interfaces->count; i++) {
+			iface = hapd->iface->interfaces->iface[i];
+			if (iface == hapd->iface || !iface->conf->he_co_locate)
+				continue;
+			len = gas_anqp_add_element(buf, ANQP_NEIGHBOR_REPORT);
+			if (hostapd_prepare_neighbor_buf(iface->bss[0],
+						iface->bss[0]->own_addr, buf)) {
+				buf->used -= 2;
+				return;
+			}
+			gas_anqp_set_element_len(buf, len);
+		}
+	}
+}
+
 
 #ifdef CONFIG_FILS
 static void anqp_add_fils_realm_info(struct hostapd_data *hapd,
@@ -1028,6 +1056,8 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
 		anqp_add_elem(hapd, buf, ANQP_TDLS_CAPABILITY);
 	if (request & ANQP_REQ_EMERGENCY_NAI)
 		anqp_add_elem(hapd, buf, ANQP_EMERGENCY_NAI);
+	if (request & ANQP_REQ_NEIGHBOR_REPORT)
+		anqp_add_neighbor_report(hapd, buf);
 
 	for (i = 0; i < num_extra_req; i++) {
 #ifdef CONFIG_FILS
-- 
2.30.2




More information about the Hostap mailing list