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

sharadanandk at gmail.com sharadanandk at gmail.com
Fri Jan 21 05:14:52 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.
Doing this allows station to discover networks on other frequencies
which were announced throgh RNR in the ANQP RNR response,
e. g. for multi-media APs in WiFi 6e.

Signed-off-by: Sharadanand Karanjkar <skaranjkar at datto.com>
---
 wpa_supplicant/interworking.c | 37 +++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/wpa_supplicant/interworking.c b/wpa_supplicant/interworking.c
index 71a5c1651..4ca139d98 100644
--- a/wpa_supplicant/interworking.c
+++ b/wpa_supplicant/interworking.c
@@ -2884,6 +2884,40 @@ static void anqp_add_extra(struct wpa_supplicant *wpa_s,
 	}
 }
 
+static void anqp_add_rnr(struct wpa_supplicant *wpa_s,
+			   struct wpa_bss_anqp *anqp,
+			   const u8 *data, size_t slen)
+{
+	struct wpa_bss_anqp_rnr *tmp, *elem = NULL;
+
+	if (!anqp)
+		return;
+
+	dl_list_for_each(tmp, &anqp->anqp_rnr, struct wpa_bss_anqp_rnr,
+			 list) {
+		if(os_memcmp(tmp->bssid, data, ETH_ALEN) == 0) {
+			elem = tmp;
+			break;
+		}
+	}
+
+	if (!elem) {
+		elem = os_zalloc(sizeof(*elem));
+		if (!elem)
+			return;
+
+		os_memcpy(elem->bssid, data, ETH_ALEN);
+		dl_list_add(&anqp->anqp_rnr, &elem->list);
+	} else {
+		wpabuf_free(elem->rnr_report);
+	}
+
+	elem->rnr_report = wpabuf_alloc_copy(data, slen);
+	if (!elem->rnr_report) {
+		dl_list_del(&elem->list);
+		os_free(elem);
+	}
+}
 
 static void interworking_parse_venue_url(struct wpa_supplicant *wpa_s,
 					 const u8 *data, size_t len)
@@ -3073,6 +3107,9 @@ static void interworking_parse_rx_anqp_resp(struct wpa_supplicant *wpa_s,
 			return;
 		}
 		break;
+	case ANQP_NEIGHBOR_REPORT:
+		anqp_add_rnr(wpa_s, anqp, data, slen);
+		break;
 	default:
 		wpa_msg(wpa_s, MSG_DEBUG,
 			"Interworking: Unsupported ANQP Info ID %u", info_id);
-- 
2.30.2




More information about the Hostap mailing list