Skip to contentSkip to conversation

wiphy: add beacon bits to RM Enabled Capabilities

PATCH Superseded James Prestwood 1 participant 3 messages Nov 6, 2019 Kbuild

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/3 wiphy: add beacon bits to RM Enabled Capabilities

This tells AP's that we support Passive, Active, and Table beacon measurements.

---
 src/wiphy.c | 2 ++
 1 file changed, 2 insertions(+)
src/wiphy.c +2 -0
index ef22c0d3..eb0dfcc9 100644
@@ -1037,6 +1037,8 @@ static void wiphy_setup_rm_enabled_capabilities(struct wiphy *wiphy)
 
 	wiphy->rm_enabled_capabilities[0] = IE_TYPE_RM_ENABLED_CAPABILITIES;
 	wiphy->rm_enabled_capabilities[1] = 5;
+	/* Bits: Passive (4), Active (5), and Beacon Table (6) capabilities */
+	wiphy->rm_enabled_capabilities[2] = 0x70;
 
 	/*
 	 * TODO: Support at least Link Measurement if TX_POWER_INSERTION is
Signature · 1 line
2.17.1
#1 lore raw

PATCH v4 2/3 rrm: add radio resource management module

This module takes care of radio measurements which an AP can request. There are many types of requests, and for now only beacon requests are supported.

IWD will filter certain types of beacon requests that are NOT supported:

- AP channel reports. Only single channel requests will be supported
- Autonomous measurements. Only direct requests will be supported. IWD will not accept requets to trigger reports under certain conditions (SNR/RSSI thresholds, etc.)
- Timed measurements. Only immediate measurements will be performed. The accuracy for timed measurements cannot be reliably guaranteed due to kernel scheduling/queues.
- Full reporting detail. The AP can request the STA return the full set of IEs in a beacon. IWD does not currently save all IEs, plus there is quite a bit of complexity involved as certain IEs get truncated, and there are other length limitations.

There are other limitations not specific to beacon requests:

- IWD will support single measurement requests per report. Multiple measurement request IEs can be included, but the reports will be sent out separately.

- IWD will limit the number of requests it responds to in a given amount of time. As it stands now this is hard coded to 2 requests per second maximum. This will prevent DoS attacks.

- IWD will not accept any measurement requests from APs it is not connected to, and will not accept any requests until connected.

---
 Makefile.am |   1 +
 src/rrm.c   | 791 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 792 insertions(+)
 create mode 100644 src/rrm.c

-v4:
* Removed enable bit, just check station state as needed
* Removed early station watch
* Removed extra queue iteration on rrm_state cleanup

Makefile.am +1 -0
index 9c54cef0..13141848 100644
@@ -226,6 +226,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
 					src/hotspot.c \
 					src/p2putil.h src/p2putil.c \
 					src/module.c \
+					src/rrm.c \
 					$(eap_sources) \
 					$(builtin_sources)
 
src/rrm.c new file +791 -0

791 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH v4 3/3 auto-t: add RRM autotest

In reply to James Prestwood

This test merely verifies hostapd receieved our measurement reports and verified they were valid. Hostapd does not verify the actual beacon report body. Really, the only way to test this is on an actual network which makes these requests.

---
 autotests/testRRM/connection_test.py | 114 +++++++++++++++++++++++++++
 autotests/testRRM/hw.conf            |   8 ++
 autotests/testRRM/ssidOther.conf     |  10 +++
 autotests/testRRM/ssidRRM.conf       |  13 +++
 4 files changed, 145 insertions(+)
 create mode 100644 autotests/testRRM/connection_test.py
 create mode 100644 autotests/testRRM/hw.conf
 create mode 100644 autotests/testRRM/ssidOther.conf
 create mode 100644 autotests/testRRM/ssidRRM.conf
autotests/testRRM/connection_test.py new file +114 -0
new file mode 100644
index 00000000..93fd6cb8
@@ -0,0 +1,114 @@
+#!/usr/bin/python3
+
+import unittest
+import sys
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+from hostapd import HostapdCLI
+import testutil
+
+from time import sleep
+
+# Table beacon with wildcard BSSID
+basic_beacon = '51000000000002ffffffffffff020100'
+# Table beacon with wildcard BSSID and SSID filter
+beacon_with_ssid = '51000000000002ffffffffffff02010000077373696452524d'
+# Passive beacon with wildcard BSSID
+beacon_passive = '510b0000000000ffffffffffff020100'
+# Active beacon with wildcard BSSID
+beacon_active = '510b0000000001ffffffffffff020100'
+
+class Test(unittest.TestCase):
+
+    def test_connection_success(self):
+        hapd = HostapdCLI(config='ssidRRM.conf')
+        wd = IWD()
+
+        psk_agent = PSKAgent("secret123")
+        wd.register_psk_agent(psk_agent)
+
+        devices = wd.list_devices(1)
+        device = devices[0]
+
+        condition = 'not obj.scanning'
+        wd.wait_for_object_condition(device, condition)
+
+        device.scan()
+
+        condition = 'not obj.scanning'
+        wd.wait_for_object_condition(device, condition)
+
+        ordered_network = device.get_ordered_network('ssidRRM')
+
+        self.assertEqual(ordered_network.type, NetworkType.psk)
+
+        condition = 'not obj.connected'
+        wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+        ordered_network.network_object.connect()
+
+        condition = 'obj.connected'
+        wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+        testutil.test_iface_operstate()
+        testutil.test_ifaces_connected()
+
+        hapd.wait_for_event('AP-STA-CONNECTED')
+
+        # This should return both APs
+        hapd.req_beacon(device.address, basic_beacon)
+
+        for e in ['BEACON-RESP-RX', 'BEACON-RESP-RX']:
+            event = hapd.wait_for_event(e)
+            if event:
+                print(event)
+
+        sleep(0.5)
+
+        # This should return just ssidRRM
+        hapd.req_beacon(device.address, beacon_with_ssid)
+        event = hapd.wait_for_event('BEACON-RESP-RX')
+        if event:
+            print(event)
+
+        sleep(0.5)
+
+        # This should passive scan on channel 11, returning otherSSID
+        hapd.req_beacon(device.address, beacon_passive)
+        # TODO: See if we are scanning here (scan not initiated from station)
+
+        event = hapd.wait_for_event('BEACON-RESP-RX')
+        if event:
+            print(event)
+
+        sleep(0.5)
+
+        # This should active scan on channel 11, returning otherSSID
+        hapd.req_beacon(device.address, beacon_active)
+        # TODO: See if we are scanning here (scan not initiated from station)
+
+        event = hapd.wait_for_event('BEACON-RESP-RX')
+        if event:
+            print(event)
+
+        device.disconnect()
+
+        condition = 'not obj.connected'
+        wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+        wd.unregister_psk_agent(psk_agent)
+
+    @classmethod
+    def setUpClass(cls):
+        pass
+
+    @classmethod
+    def tearDownClass(cls):
+        IWD.clear_storage()
+
+if __name__ == '__main__':
+    unittest.main(exit=True)
autotests/testRRM/hw.conf new file +8 -0
new file mode 100644
index 00000000..91c757ce
@@ -0,0 +1,8 @@
+[SETUP]
+num_radios=3
+max_test_exec_interval_sec=40
+reg_domain=US
+
+[HOSTAPD]
+rad0=ssidRRM.conf
+rad1=ssidOther.conf
autotests/testRRM/ssidOther.conf new file +10 -0
new file mode 100644
index 00000000..e0f0fd40
@@ -0,0 +1,10 @@
+ctrl_interface=/var/run/hostapd
+
+hw_mode=g
+channel=11
+ssid=ssidOther
+
+wpa=2
+wpa_pairwise=CCMP
+wpa_passphrase=secret123
+rrm_beacon_report=1
autotests/testRRM/ssidRRM.conf new file +13 -0
new file mode 100644
index 00000000..233392f9
@@ -0,0 +1,13 @@
+ctrl_interface=/var/run/hostapd
+
+hw_mode=a
+ssid=ssidRRM
+
+wpa=2
+wpa_pairwise=CCMP
+wpa_passphrase=secret123
+rrm_beacon_report=1
+ht_capab=[HT40+]
+
+ieee80211n=1
+channel=36
Signature · 1 line
2.17.1