Skip to contentSkip to conversation

doc: add testing option to hostapd.config

PATCH In review James Prestwood 2 participants 7 messages Sep 28, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/6 doc: add testing option to hostapd.config

This is required to be built in for hostapd to rekey on command.

---
 doc/hostapd.config | 1 +
 1 file changed, 1 insertion(+)
doc/hostapd.config +1 -0
index 91d1b4cf..c114e127 100644
@@ -36,3 +36,4 @@ CONFIG_OCV=y
 CONFIG_OWE=y
 CONFIG_DPP=y
 CONFIG_SAE=y
+CONFIG_TESTING_OPTIONS=y
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/6 auto-t: add OCV to FILS test

---
 autotests/testFILS/ssidFILS-256.conf | 1 +
 autotests/testFILS/ssidFILS-384.conf | 1 +
 2 files changed, 2 insertions(+)
autotests/testFILS/ssidFILS-256.conf +1 -0
index a5f70f3a..66d4bfb5 100644
@@ -19,3 +19,4 @@ disable_pmksa_caching=1
 
 wpa_group_rekey=30
 wpa_ptk_rekey=30
+ocv=1
autotests/testFILS/ssidFILS-384.conf +1 -0
index 613c37be..5254d5f8 100644
@@ -19,3 +19,4 @@ disable_pmksa_caching=1
 
 wpa_group_rekey=30
 wpa_ptk_rekey=30
+ocv=1
Signature · 1 line
2.31.1
author
#2 lore raw

PATCH 3/6 auto-t: block auth frames for FT-over-DS test

In reply to James Prestwood

The FT-over-DS test was allowed to fail as it stood. If FT-over-DS failed it would just do a normal over-Air transition which satisfied all the checks. To prevent this Authenticate frames are blocked after the initial connection so if FT-over-DS fails there is no other way to roam.

---
 autotests/testPSK-roam/connection_test.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
autotests/testPSK-roam/connection_test.py +15 -0
index 918cceb0..f9306a57 100644
@@ -59,6 +59,9 @@ class Test(unittest.TestCase):
         self.assertRaises(Exception, testutil.test_ifaces_connected,
                           (self.bss_hostapd[1].ifname, device.name, True, True))
 
+        if over_ds:
+            self.rule0.enabled = True
+
         device.roam(self.bss_hostapd[1].bssid)
 
         condition = 'obj.state == DeviceState.roaming'
@@ -150,12 +153,24 @@ class Test(unittest.TestCase):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up')
         os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
 
+        self.rule0.enabled = False
+
     @classmethod
     def setUpClass(cls):
+        hwsim = Hwsim()
+
         IWD.copy_to_storage('TestFT.psk')
 
         cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
                             HostapdCLI(config='ft-psk-ccmp-2.conf') ]
+        rad2 = hwsim.get_radio('rad2')
+
+        cls.rule0 = hwsim.rules.create()
+        cls.rule0.source = rad2.addresses[0]
+        cls.rule0.bidirectional = True
+        cls.rule0.signal = -2000
+        cls.rule0.prefix = 'b0'
+        cls.rule0.drop = True
 
         # Set interface addresses to those expected by hostapd config files
         os.system('ifconfig "' + cls.bss_hostapd[0].ifname +
Signature · 1 line
2.31.1
author
#3 lore raw

PATCH 4/6 auto-t: fix testSAE to continue if a test fails

In reply to James Prestwood
---
 autotests/testSAE/connection_test.py | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)
autotests/testSAE/connection_test.py +12 -15
index 88aa077e..75f5c12d 100644
@@ -62,9 +62,7 @@ class Test(unittest.TestCase):
         self.hostapd.set_value('vendor_elements', '')
         self.hostapd.reload()
         self.hostapd.wait_for_event("AP-ENABLED")
-        wd = IWD(True)
-        self.validate_connection(wd)
-        wd.clear_storage()
+        self.validate_connection(self.wd)
 
     def test_SAE_force_group_19(self):
         self.hostapd.set_value('sae_pwe', '0')
@@ -74,9 +72,7 @@ class Test(unittest.TestCase):
         self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
         self.hostapd.reload()
         self.hostapd.wait_for_event("AP-ENABLED")
-        wd = IWD(True)
-        self.validate_connection(wd)
-        wd.clear_storage()
+        self.validate_connection(self.wd)
 
     def test_SAE_Group20(self):
         self.hostapd.set_value('sae_pwe', '0')
@@ -84,9 +80,7 @@ class Test(unittest.TestCase):
         self.hostapd.set_value('vendor_elements', '')
         self.hostapd.reload()
         self.hostapd.wait_for_event("AP-ENABLED")
-        wd = IWD(True)
-        self.validate_connection(wd)
-        wd.clear_storage()
+        self.validate_connection(self.wd)
 
     def test_SAE_H2E(self):
         self.hostapd.set_value('sae_pwe', '1')
@@ -94,9 +88,7 @@ class Test(unittest.TestCase):
         self.hostapd.set_value('vendor_elements', '')
         self.hostapd.reload()
         self.hostapd.wait_for_event("AP-ENABLED")
-        wd = IWD(True)
-        self.validate_connection(wd)
-        wd.clear_storage()
+        self.validate_connection(self.wd)
 
     def test_SAE_H2E_Group20(self):
         self.hostapd.set_value('sae_pwe', '1')
@@ -104,9 +96,14 @@ class Test(unittest.TestCase):
         self.hostapd.set_value('vendor_elements', '')
         self.hostapd.reload()
         self.hostapd.wait_for_event("AP-ENABLED")
-        wd = IWD(True)
-        self.validate_connection(wd)
-        wd.clear_storage()
+        self.validate_connection(self.wd)
+
+    def setUp(self):
+        self.wd = IWD(True)
+
+    def tearDown(self):
+        self.wd.clear_storage()
+        self.wd = None
 
     @classmethod
     def setUpClass(cls):
Signature · 1 line
2.31.1
author
#4 lore raw

PATCH 5/6 auto-t: hostapd.py: add rekey() utility

In reply to James Prestwood

Forces GTK/PTK rekeys

---
 autotests/util/hostapd.py | 6 ++++++
 1 file changed, 6 insertions(+)
autotests/util/hostapd.py +6 -0
index 7cb3225a..9f2dc745 100644
@@ -202,6 +202,12 @@ class HostapdCLI(object):
         cmd = self.cmdline + ['req_beacon', addr, request]
         ctx.start_process(cmd).wait()
 
+    def rekey(self, address):
+        cmd = 'REKEY_GTK'
+        self.ctrl_sock.sendall(cmd.encode('utf-8'))
+        cmd = 'REKEY_PTK %s' % address
+        self.ctrl_sock.sendall(cmd.encode('utf-8'))
+
     @property
     def bssid(self):
         cmd = self.cmdline + ['status']
Signature · 1 line
2.31.1
author
#5 lore raw

PATCH 6/6 auto-t: rekey in FT/FILS tests

In reply to James Prestwood
---
 autotests/testFILS/fils_256_test.py       | 3 +++
 autotests/testFILS/fils_384_test.py       | 3 +++
 autotests/testFT-FILS/connection_test.py  | 3 +++
 autotests/testPSK-roam/connection_test.py | 3 +++
 4 files changed, 12 insertions(+)
autotests/testFILS/fils_256_test.py +3 -0
index 62de581b..02fad28e 100644
@@ -55,6 +55,9 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected(device.name, hapd.ifname)
 
+        hapd.rekey(device.address)
+        hapd.wait_for_event('EAPOL-4WAY-HS-COMPLETED')
+
         device.disconnect()
 
     @classmethod
autotests/testFILS/fils_384_test.py +3 -0
index 8df5554c..8ecd2fec 100644
@@ -55,6 +55,9 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected(device.name, hapd.ifname)
 
+        hapd.rekey(device.address)
+        hapd.wait_for_event('EAPOL-4WAY-HS-COMPLETED')
+
         device.disconnect()
 
     @classmethod
autotests/testFT-FILS/connection_test.py +3 -0
index b136cb7b..d1389cea 100644
@@ -95,6 +95,9 @@ class Test(unittest.TestCase):
         self.assertRaises(Exception, testutil.test_ifaces_connected,
                           (self.bss_hostapd[0].ifname, device.name, True, True))
 
+        self.bss_hostapd[1].rekey(device.address)
+        self.bss_hostapd[1].wait_for_event('EAPOL-4WAY-HS-COMPLETED')
+
     def test_fils_ft_roam_sha256(self):
         wd = IWD(True)
 
autotests/testPSK-roam/connection_test.py +3 -0
index f9306a57..d1beb010 100644
@@ -80,6 +80,9 @@ class Test(unittest.TestCase):
         self.assertRaises(Exception, testutil.test_ifaces_connected,
                           (self.bss_hostapd[0].ifname, device.name, True, True))
 
+        self.bss_hostapd[1].rekey(device.address)
+        self.bss_hostapd[1].wait_for_event('EAPOL-4WAY-HS-COMPLETED')
+
         device.roam(self.bss_hostapd[0].bssid)
 
         condition = 'obj.state == DeviceState.roaming'
Signature · 1 line
2.31.1
#6 lore raw
In reply to James Prestwood

Hi James,

Quoted 5 lines · James Prestwood

This is required to be built in for hostapd to rekey on command.

---
  doc/hostapd.config | 1 +
  1 file changed, 1 insertion(+)

All applied, thanks.

Regards,
-Denis