Skip to contentSkip to conversation

auto-t: add more checks to testRRM

PATCH In review James Prestwood 2 participants 3 messages Sep 8, 2022 – Sep 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 auto-t: add more checks to testRRM

The hostapd events for RRM come regardless of success so they need to be checked as such. In addition one more RRM request was added to scan on a frequency which is disabled (operating class 82, channel 14).

---
 autotests/testRRM/connection_test.py | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
autotests/testRRM/connection_test.py +19 -5
index 4d894958..508d7119 100644
@@ -21,6 +21,8 @@ beacon_passive = '510b0000000000ffffffffffff020100'
 beacon_active = '510b0000000001ffffffffffff020100'
 # Passive beacon with duration set
 beacon_passive_duration = '510b0000c80000ffffffffffff020100'
+# Passive beacon on disabled frequency (disallowed in US)
+beacon_passive_disabled = '520e0000c80000ffffffffffff020100'
 
 class Test(unittest.TestCase):
 
@@ -57,13 +59,15 @@ class Test(unittest.TestCase):
         hapd.req_beacon(device.address, basic_beacon)
 
         for e in ['BEACON-RESP-RX', 'BEACON-RESP-RX']:
-            hapd.wait_for_event(e)
+            event = hapd.wait_for_event(e).split(' ')
+            self.assertTrue(event[3] == '00')
 
         wd.wait(1)
 
         # This should return just ssidRRM
         hapd.req_beacon(device.address, beacon_with_ssid)
-        hapd.wait_for_event('BEACON-RESP-RX')
+        event = hapd.wait_for_event('BEACON-RESP-RX').split(' ')
+        self.assertTrue(event[3] == '00')
 
         wd.wait(1)
 
@@ -71,7 +75,8 @@ class Test(unittest.TestCase):
         hapd.req_beacon(device.address, beacon_passive)
         # TODO: See if we are scanning here (scan not initiated from station)
 
-        hapd.wait_for_event('BEACON-RESP-RX')
+        event = hapd.wait_for_event('BEACON-RESP-RX').split(' ')
+        self.assertTrue(event[3] == '00')
 
         wd.wait(1)
 
@@ -79,7 +84,8 @@ class Test(unittest.TestCase):
         hapd.req_beacon(device.address, beacon_active)
         # TODO: See if we are scanning here (scan not initiated from station)
 
-        hapd.wait_for_event('BEACON-RESP-RX')
+        event = hapd.wait_for_event('BEACON-RESP-RX').split(' ')
+        self.assertTrue(event[3] == '00')
 
         wd.wait(1)
 
@@ -87,7 +93,15 @@ class Test(unittest.TestCase):
         hapd.req_beacon(device.address, beacon_passive_duration)
         # TODO: See if we are scanning here (scan not initiated from station)
 
-        hapd.wait_for_event('BEACON-RESP-RX')
+        event = hapd.wait_for_event('BEACON-RESP-RX').split(' ')
+        self.assertTrue(event[3] == '00')
+
+        wd.wait(1)
+
+        hapd.req_beacon(device.address, beacon_passive_disabled)
+
+        event = hapd.wait_for_event('BEACON-RESP-RX').split(' ')
+        self.assertTrue(event[3] != '00')
 
         device.disconnect()
 
Signature · 1 line
2.34.3
#1 lore raw

PATCH 2/2 rrm: constrain scan frequency before scanning

The RRM module was blindly scanning using the requested frequency which may or may not be possible given the hardware. Instead check that the frequency will work and if not reject the request.

This was reported by a user seeing the RRM scan fail which was due to the AP requesting a scan on 5GHz when the adapter was 2.4GHz only.

---
 src/rrm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
src/rrm.c +8 -4
index 311e62fb..fceff5c7 100644
@@ -443,6 +443,9 @@ static void rrm_handle_beacon_scan(struct rrm_state *rrm,
 	freq = band_channel_to_freq(beacon->channel, band);
 	scan_freq_set_add(freqs, freq);
 
+	if (!wiphy_constrain_freq_set(wiphy_find_by_wdev(rrm->wdev_id), freqs))
+		goto free_freqs;
+
 	if (passive)
 		beacon->scan_id = scan_passive_full(rrm->wdev_id, &params,
 						rrm_scan_triggered,
@@ -454,12 +457,13 @@ static void rrm_handle_beacon_scan(struct rrm_state *rrm,
 						rrm_scan_results, rrm,
 						NULL);
 
+free_freqs:
 	scan_freq_set_free(freqs);
 
-	if (beacon->scan_id == 0) {
-		rrm_info_destroy(&beacon->info);
-		rrm->pending = NULL;
-	}
+	if (beacon->scan_id)
+		return;
+
+	rrm_reject_measurement_request(rrm, REPORT_REJECT_INCAPABLE);
 }
 
 static bool rrm_verify_beacon_request(const uint8_t *request, size_t len)
Signature · 1 line
2.34.3
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 8 lines · James Prestwood

The hostapd events for RRM come regardless of success so they need to be checked as such. In addition one more RRM request was added to scan on a frequency which is disabled (operating class 82, channel 14).

---
  autotests/testRRM/connection_test.py | 24 +++++++++++++++++++-----
  1 file changed, 19 insertions(+), 5 deletions(-)

Both applied, thanks.

Regards,
-Denis