Skip to contentSkip to conversation

auto-t: update blacklist test to use 'enable' on rules

PATCH In review James Prestwood 2 participants 5 messages Oct 20, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/4 auto-t: update blacklist test to use 'enable' on rules

---
 autotests/testBSSBlacklist/connection_test.py | 3 +++
 1 file changed, 3 insertions(+)
autotests/testBSSBlacklist/connection_test.py +3 -0
index bfcf0523..6a12174d 100644
@@ -110,8 +110,11 @@ class Test(unittest.TestCase):
 
         # Have both APs drop all packets, both should get blacklisted
         rule0.drop = True
+        rule0.enable = True
         rule1.drop = True
+        rule1.enable = True
         rule2.drop = True
+        rule2.enable = True
 
         with self.assertRaises(iwd.FailedEx):
             ordered_network.network_object.connect()
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/4 auto-t: fix testConnectAutoconnect

There was no open ssid provisioning file, which was fine as the first test should have created one. But to be safe, include one explicitly and use the proper setUp/tearDown functions.

---
 autotests/testConnectAutoconnect/open_network_test.py | 4 ++++
 autotests/testConnectAutoconnect/ssidOpen.open        | 1 +
 2 files changed, 5 insertions(+)
 create mode 100644 autotests/testConnectAutoconnect/ssidOpen.open
autotests/testConnectAutoconnect/open_network_test.py +4 -0
index 187f2342..0af66923 100644
@@ -24,6 +24,10 @@ class TestOpenNetwork(unittest.TestCase):
         tca.validate('ssidOpen', False)
         tca.validate('ssidOpen', True)
 
+    def setUp(self):
+        IWD.copy_to_storage('ssidOpen.open')
+
+    def tearDown(self):
         IWD.clear_storage()
 
 if __name__ == '__main__':
autotests/testConnectAutoconnect/ssidOpen.open new file +1 -0
new file mode 100644
index 00000000..8b137891
@@ -0,0 +1 @@
+
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH 3/4 network: fix autoconnect for Open networks

In reply to James Prestwood

This code path was never tested and used to ensure a OWE transition candidate gets selected over an open one (e.g. if all the BSS's are blacklisted). But this logic was incorrect and the path was being taken for BSS's that did not contain the owe_trans element, basically all BSS's. For RSN's this was somewhat fine since the final check would set a candidate, but for open BSS's the loop would start over and potentially complete the loop without ever returning a candidate. If fallback was false, NULL would be returned.

To fix this only take the OWE transition path if its an OWE transition BSS, i.e. inverse the logic.

---
 src/network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/network.c +1 -1
index 110c8577..9a2d12cf 100644
@@ -1136,7 +1136,7 @@ struct scan_bss *network_bss_select(struct network *network,
 			candidate = bss;
 
 		/* OWE Transition BSS */
-		if (!bss->owe_trans) {
+		if (bss->owe_trans) {
 			/* Don't want to connect to the Open BSS if possible */
 			if (!bss->rsne)
 				continue;
Signature · 1 line
2.31.1
author
#3 lore raw

PATCH 4/4 auto-t: use tearDownClass in hidden network test

In reply to James Prestwood

A failure in this test could leave stale network profiles, which may cause future tests to fail.

---
 autotests/testHiddenNetworks/open_network_test.py | 2 ++
 autotests/testHiddenNetworks/wpa_network_test.py  | 2 ++
 2 files changed, 4 insertions(+)
autotests/testHiddenNetworks/open_network_test.py +2 -0
index 7d1407c0..2cc0f75b 100644
@@ -24,6 +24,8 @@ class TestOpenNetwork(unittest.TestCase):
         tca.validate('ssidHiddenOpen', False)
         tca.validate('ssidHiddenOpen', True)
 
+    @classmethod
+    def tearDownClass(cls):
         IWD.clear_storage()
 
 if __name__ == '__main__':
autotests/testHiddenNetworks/wpa_network_test.py +2 -0
index 800f8312..d8166b1b 100644
@@ -25,6 +25,8 @@ class TestWpaNetwork(unittest.TestCase):
         tca.validate('ssidHiddenWPA', False, None, True)
         tca.validate('ssidHiddenWPA', True, None, True)
 
+    @classmethod
+    def tearDownClass(cls):
         IWD.clear_storage()
 
 if __name__ == '__main__':
Signature · 1 line
2.31.1
#4 lore raw
In reply to James Prestwood

Hi James,

Quoted 4 lines · James Prestwood
---
  autotests/testBSSBlacklist/connection_test.py | 3 +++
  1 file changed, 3 insertions(+)

All applied, thanks.

Regards,
-Denis