diff mbox series

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

Message ID 20220119155742.48024-1-sharadanandk@gmail.com
State Superseded
Headers show
Series [1/2] ANQP/hostapd: Add more data to the ANQP RNR response. | expand

Commit Message

Sharadanand Karanjkar Jan. 19, 2022, 3:57 p.m. UTC
From: Sharadanand Karanjkar <skaranjkar@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@datto.com>
---
 src/ap/gas_serv.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/src/ap/gas_serv.c b/src/ap/gas_serv.c
index 90f15778b..b40aaa23e 100644
--- a/src/ap/gas_serv.c
+++ b/src/ap/gas_serv.c
@@ -603,6 +603,33 @@  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 +1055,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