[PATCH] RRM: Don't request LCI and civic if not supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: David Spinadel <david.spinadel@xxxxxxxxx>

Check that FTM responder capability bit in extended capabily IE and LCI and
location civic bits in RRM enabled capability IE are set before sending LCI and
location civic request in neighbor report request. If they are not set, don't
include the corresponding sub-elements in the neighbor report request.
This change is according to IEEE Std 802.11-2024 11.10.10.2 (Requesting
a neighbor report).

Signed-off-by: David Spinadel <david.spinadel@xxxxxxxxx>
Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
Reviewed-by: Peer, Ilan <ilan.peer@xxxxxxxxx>

---

Hi,

we are looking at better aligning our internal development tree with
upstream. While doing that, we will keep finding very old patches like
this one (originally from 2016). Many are going to be dropped, but for
others we'll clean them up a bit and post them.
That said, if such a patch doesn't pass the initial smell test for you,
then we'll probably just err on the side of dropping them.

I hope this is not going to cause too much churn overall.

Benjamin

Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
---
 tests/hwsim/test_rrm.py |  3 ++-
 wpa_supplicant/rrm.c    | 24 +++++++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py
index 9eddadcbdd..db8d43cc2b 100644
--- a/tests/hwsim/test_rrm.py
+++ b/tests/hwsim/test_rrm.py
@@ -243,7 +243,8 @@ def test_rrm_neighbor_rep_req(dev, apdev):
 
     params = {"ssid": "test", "rnr": "1"}
     hostapd.add_ap(apdev[0], params)
-    params = {"ssid": "test2", "rrm_neighbor_report": "1", "rnr": "1"}
+    params = {"ssid": "test2", "rrm_neighbor_report": "1", "rnr": "1",
+              "ftm_responder": "1", "lci": lci, "civic": civic}
     hapd = hostapd.add_ap(apdev[1], params)
 
     bssid1 = apdev[1]['bssid']
diff --git a/wpa_supplicant/rrm.c b/wpa_supplicant/rrm.c
index d467ce6bf4..a6c15d1993 100644
--- a/wpa_supplicant/rrm.c
+++ b/wpa_supplicant/rrm.c
@@ -145,7 +145,7 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
 				       void *cb_ctx)
 {
 	struct wpabuf *buf;
-	const u8 *rrm_ie;
+	const u8 *rrm_ie, *ext_capab;
 
 	if (wpa_s->wpa_state != WPA_COMPLETED || wpa_s->current_ssid == NULL) {
 		wpa_dbg(wpa_s, MSG_DEBUG, "RRM: No connection, no RRM.");
@@ -188,6 +188,18 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
 		(ssid ? wpa_ssid_txt(ssid->ssid, ssid->ssid_len) : ""),
 		wpa_s->rrm.next_neighbor_rep_token);
 
+	/*
+	 * According to IEEE Std 802.11-2024 11.10.10.2 (Requesting a neighbor
+	 * report) LCI or civic requrests depend on FTM responder support.
+	 */
+	ext_capab = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_EXT_CAPAB);
+	if (!ieee802_11_ext_capab(ext_capab, WLAN_EXT_CAPAB_FTM_RESPONDER)) {
+		wpa_printf(MSG_DEBUG,
+			   "AP doesn't support FTM responder, can't request LCI and civic");
+		lci = 0;
+		civic = 0;
+	}
+
 	wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT);
 	wpabuf_put_u8(buf, WLAN_RRM_NEIGHBOR_REPORT_REQUEST);
 	wpabuf_put_u8(buf, wpa_s->rrm.next_neighbor_rep_token);
@@ -197,7 +209,7 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
 		wpabuf_put_data(buf, ssid->ssid, ssid->ssid_len);
 	}
 
-	if (lci) {
+	if (lci && (rrm_ie[3] & WLAN_RRM_CAPS_LCI_MEASUREMENT)) {
 		/* IEEE Std 802.11-2024, 9.4.2.19 (Measurement Request element)
 		 */
 		wpabuf_put_u8(buf, WLAN_EID_MEASURE_REQUEST);
@@ -231,9 +243,12 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
 		wpabuf_put_u8(buf, LCI_REQ_SUBELEM_MAX_AGE);
 		wpabuf_put_u8(buf, 2);
 		wpabuf_put_le16(buf, 0xffff);
+	} else if (lci) {
+		wpa_printf(MSG_DEBUG,
+			   "RRM: LCI request isn't supported by AP");
 	}
 
-	if (civic) {
+	if (civic && (rrm_ie[6] & WLAN_RRM_CAPS_CIVIC_LOCATION_MEASUREMENT)) {
 		/* IEEE Std 802.11-2024, 9.4.2.19 (Measurement Request element)
 		 */
 		wpabuf_put_u8(buf, WLAN_EID_MEASURE_REQUEST);
@@ -263,6 +278,9 @@ int wpas_rrm_send_neighbor_rep_request(struct wpa_supplicant *wpa_s,
 		 */
 		wpabuf_put_le16(buf, 0);
 		/* No optional subelements */
+	} else if (civic) {
+		wpa_printf(MSG_DEBUG,
+			   "RRM: civic request isn't supported by AP");
 	}
 
 	wpa_s->rrm.next_neighbor_rep_token++;
-- 
2.50.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux