From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 15/15] auto-t: add AP roam test for bad neighbor reports/candidate lists
Date: Fri, 22 Aug 2025 12:51:18 -0700 [thread overview]
Message-ID: <20250822195118.271122-15-prestwoj@gmail.com> (raw)
In-Reply-To: <20250822195118.271122-1-prestwoj@gmail.com>
---
.../testAPRoam/bad_neighbor_report_test.py | 133 ++++++++++++++++++
1 file changed, 133 insertions(+)
create mode 100644 autotests/testAPRoam/bad_neighbor_report_test.py
diff --git a/autotests/testAPRoam/bad_neighbor_report_test.py b/autotests/testAPRoam/bad_neighbor_report_test.py
new file mode 100644
index 00000000..4bf3b63b
--- /dev/null
+++ b/autotests/testAPRoam/bad_neighbor_report_test.py
@@ -0,0 +1,133 @@
+#!/usr/bin/python3
+
+import unittest
+import sys
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import NetworkType
+
+from hostapd import HostapdCLI
+
+class Test(unittest.TestCase):
+ def initial_connection(self):
+ ordered_network = self.device.get_ordered_network('TestAPRoam')
+
+ self.assertEqual(ordered_network.type, NetworkType.psk)
+
+ condition = 'not obj.connected'
+ self.wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+ self.device.connect_bssid(self.bss_hostapd[0].bssid)
+
+ condition = 'obj.state == DeviceState.connected'
+ self.wd.wait_for_object_condition(self.device, condition)
+
+ self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
+
+ self.assertFalse(self.bss_hostapd[1].list_sta())
+
+ def test_full_scan(self):
+ """
+ Tests that IWD first tries a limited scan, then a full scan after
+ an AP directed roam. After the full scan yields no results IWD
+ should stop trying to roam.
+ """
+ self.initial_connection()
+
+ # Disable other APs, so the scans come up empty
+ self.bss_hostapd[1].disable()
+ self.bss_hostapd[2].disable()
+
+ # Send a bad candidate list with the BSS TM request which contains a
+ # channel with no AP operating on it.
+ self.bss_hostapd[0].send_bss_transition(
+ self.device.address,
+ [(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
+ )
+ self.device.wait_for_event("roam-scan-triggered")
+ self.device.wait_for_event("no-roam-candidates")
+ # IWD should then trigger a full scan
+ self.device.wait_for_event("full-roam-scan")
+ self.device.wait_for_event("no-roam-candidates", timeout=30)
+
+ # IWD should not trigger a roam again after the above 2 failures.
+ with self.assertRaises(TimeoutError):
+ self.device.wait_for_event("roam-scan-triggered", timeout=60)
+
+ def test_bad_candidate_list(self):
+ """
+ Tests behavior when the AP sends a candidate list but the scan
+ finds no BSS's. IWD should fall back to a full scan after.
+ """
+ self.initial_connection()
+
+ # Send a bad candidate list with the BSS TM request which contains a
+ # channel with no AP operating on it.
+ self.bss_hostapd[0].send_bss_transition(
+ self.device.address,
+ [(self.bss_hostapd[1].bssid, "8f0000005105060603000000")]
+ )
+ self.device.wait_for_event("roam-scan-triggered")
+ self.device.wait_for_event("no-roam-candidates")
+ # IWD should then trigger a full scan
+ self.device.wait_for_event("full-roam-scan")
+ self.device.wait_for_event("roaming", timeout=30)
+ self.device.wait_for_event("connected")
+
+ def test_bad_neighbor_report(self):
+ """
+ Tests behavior when the AP sends no candidate list. IWD should
+ request a neighbor report. If the limited scan yields no BSS's IWD
+ should fall back to a full scan.
+ """
+
+ # Set a bad neighbor (channel that no AP is on) to force the limited
+ # roam scan to fail
+ self.bss_hostapd[0].set_neighbor(
+ self.bss_hostapd[1].bssid,
+ "TestAPRoam",
+ '%s8f000000%s%s060603000000' % (self.bss_hostapd[1].bssid.replace(':', ''), "51", "0b")
+ )
+
+ self.initial_connection()
+
+ self.bss_hostapd[0].send_bss_transition(self.device.address, [])
+ self.device.wait_for_event("roam-scan-triggered")
+ # The AP will have sent a neighbor report with a single BSS but on
+ # channel 11 which no AP is on. This should result in a limited scan
+ # picking up no candidates.
+ self.device.wait_for_event("no-roam-candidates", timeout=30)
+ # IWD should then trigger a full scan
+ self.device.wait_for_event("full-roam-scan")
+ self.device.wait_for_event("roaming", timeout=30)
+ self.device.wait_for_event("connected")
+
+ def setUp(self):
+ self.wd = IWD(True)
+
+ devices = self.wd.list_devices(1)
+ self.device = devices[0]
+
+ def tearDown(self):
+ self.wd = None
+ self.device = None
+
+ for hapd in self.bss_hostapd:
+ hapd.reload()
+
+ @classmethod
+ def setUpClass(cls):
+ IWD.copy_to_storage('TestAPRoam.psk')
+
+ cls.bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
+ HostapdCLI(config='ssid2.conf'),
+ HostapdCLI(config='ssid3.conf') ]
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
--
2.34.1
next prev parent reply other threads:[~2025-08-22 19:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 19:51 [PATCH 01/15] wiphy: add driver quirk for the colocated scan flag James Prestwood
2025-08-22 19:51 ` [PATCH 02/15] wiphy: add comments around the driver quirks James Prestwood
2025-08-22 19:51 ` [PATCH 03/15] scan: check support before using colocated flag James Prestwood
2025-08-22 19:51 ` [PATCH 04/15] monitor: add Cisco Meraki as a printable vendor James Prestwood
2025-08-22 19:51 ` [PATCH 05/15] vendor_quirks: initial skeleton James Prestwood
2025-08-23 14:43 ` Marcel Holtmann
2025-08-25 14:31 ` James Prestwood
2025-08-26 14:56 ` Denis Kenzior
2025-08-22 19:51 ` [PATCH 06/15] vendor_quirks: add two new vendor quirks James Prestwood
2025-08-23 14:46 ` Marcel Holtmann
2025-08-25 14:32 ` James Prestwood
2025-08-22 19:51 ` [PATCH 07/15] handshake: pass object to handshake_util_ap_ie_matches James Prestwood
2025-08-22 19:51 ` [PATCH 08/15] handshake: add vendor quirks into handshake object James Prestwood
2025-08-22 19:51 ` [PATCH 09/15] scan: store vendor quirks in scan_bss James Prestwood
2025-08-22 19:51 ` [PATCH 10/15] station: set vendor quirks into handshake object James Prestwood
2025-08-22 19:51 ` [PATCH 11/15] handshake: use vendor quirk to disable check of replay counters James Prestwood
2025-08-22 19:51 ` [PATCH 12/15] station: get neighbor report on BSS TM request James Prestwood
2025-08-22 19:51 ` [PATCH 13/15] station: check vendor quirk for BSS TM request candidate list James Prestwood
2025-08-23 14:48 ` Marcel Holtmann
2025-08-25 14:37 ` James Prestwood
2025-08-22 19:51 ` [PATCH 14/15] station: clear roam_freqs on delayed roam James Prestwood
2025-08-26 15:00 ` Denis Kenzior
2025-08-22 19:51 ` James Prestwood [this message]
2025-08-26 14:47 ` [PATCH 01/15] wiphy: add driver quirk for the colocated scan flag Denis Kenzior
2025-08-26 15:24 ` James Prestwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250822195118.271122-15-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox