Skip to contentSkip to conversation

auto-t: fix eapol_reauth utility

PATCH In review James Prestwood 2 participants 3 messages May 24, 2022 – May 26, 2022

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/2 auto-t: fix eapol_reauth utility

This was passing IFNAME= along with EAPOL_REAUTH which does not work in the context of a hostapd socket where the iface is already implied. This fixes that issue as well as resets the events array and actually waits for the required events afterwards.

---
 autotests/testEAP-PEAPv0-CryptoBinding/NoISK_test.py | 3 ---
 autotests/util/hostapd.py                            | 5 ++++-
 2 files changed, 4 insertions(+), 4 deletions(-)
autotests/testEAP-PEAPv0-CryptoBinding/NoISK_test.py +0 -3
index 9a1fa52c..0323fdc1 100644
@@ -37,9 +37,6 @@ class Test(unittest.TestCase):
 
         hostapd.eapol_reauth(device.address)
 
-        hostapd.wait_for_event('CTRL-EVENT-EAP-STARTED')
-        hostapd.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
-
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
autotests/util/hostapd.py +4 -1
index 6a9f37c7..ff5a97c1 100644
@@ -163,8 +163,11 @@ class HostapdCLI(object):
         ctx.start_process(cmd).wait()
 
     def eapol_reauth(self, client_address):
-        cmd = 'IFNAME=' + self.ifname + ' EAPOL_REAUTH ' + client_address
+        self.events = []
+        cmd = 'EAPOL_REAUTH ' + client_address
         self.ctrl_sock.sendall(cmd.encode('utf-8'))
+        self.wait_for_event('CTRL-EVENT-EAP-STARTED')
+        self.wait_for_event('CTRL-EVENT-EAP-SUCCESS')
 
     def reload(self):
         # Seemingly all three commands needed for the instance to notice
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 auto-t: add EAP reauth to testEAP

---
 autotests/testEAP/connection_test.py | 5 +++++
 1 file changed, 5 insertions(+)
autotests/testEAP/connection_test.py +5 -0
index f072845b..fe048b48 100644
@@ -11,6 +11,8 @@ from iwd import PSKAgent
 from hlrauc import AuthCenter
 from ofono import Ofono
 from config import ctx
+from hostapd import HostapdCLI
+
 import testutil
 import traceback
 
@@ -50,6 +52,8 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected()
 
+        self.hostapd.eapol_reauth(device.address)
+
         if secrets:
             wd.unregister_psk_agent(psk_agent)
 
@@ -251,6 +255,7 @@ class Test(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
         cls.wd = IWD()
+        cls.hostapd = HostapdCLI()
 
     @classmethod
     def tearDownClass(cls):
Signature · 1 line
2.34.1
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 9 lines · James Prestwood

This was passing IFNAME= along with EAPOL_REAUTH which does not work in the context of a hostapd socket where the iface is already implied. This fixes that issue as well as resets the events array and actually waits for the required events afterwards.

---
  autotests/testEAP-PEAPv0-CryptoBinding/NoISK_test.py | 3 ---
  autotests/util/hostapd.py                            | 5 ++++-
  2 files changed, 4 insertions(+), 4 deletions(-)

Both applied, thanks.

Regards,
-Denis