aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Prestwood <prestwoj@gmail.com>2023-12-19 10:08:25 -0800
committerDenis Kenzior <denkenz@gmail.com>2023-12-19 19:48:45 -0600
commit0f1d9685e76035fefddad6c8abe205223c204ec5 (patch)
treecd6769899cb5c520e12bc14da5cf0924fb52d2a3
parent8f5109c4393ea9ea429ff080d3e57c1392a2a637 (diff)
auto-t: add DPP tests to check extra settings are applied
In order to test that extra settings are applied prior to connecting two tests were added for hidden networks as well as one testing if there is already an existing profile after DPP. The reason hidden networks were used was due to the requirement of the "Hidden" settings in the profile. If this setting doesn't get sync'ed to disk the connection will fail.
-rw-r--r--autotests/testDPP/existingProfile.psk2
-rw-r--r--autotests/testDPP/hw.conf5
-rw-r--r--autotests/testDPP/pkex_test.py72
-rw-r--r--autotests/testDPP/ssidHidden.conf9
-rw-r--r--autotests/testDPP/ssidHidden.psk5
5 files changed, 89 insertions, 4 deletions
diff --git a/autotests/testDPP/existingProfile.psk b/autotests/testDPP/existingProfile.psk
new file mode 100644
index 000000000..d06890789
--- /dev/null
+++ b/autotests/testDPP/existingProfile.psk
@@ -0,0 +1,2 @@
+[Security]
+Passphrase=IncorrectPassphrase
diff --git a/autotests/testDPP/hw.conf b/autotests/testDPP/hw.conf
index a2b1470eb..85f337771 100644
--- a/autotests/testDPP/hw.conf
+++ b/autotests/testDPP/hw.conf
@@ -1,5 +1,5 @@
[SETUP]
-num_radios=4
+num_radios=5
start_iwd=0
hwsim_medium=yes
@@ -8,6 +8,7 @@ rad0=wpas.conf
[HOSTAPD]
rad1=hostapd.conf
+rad2=ssidHidden.conf
[NameSpaces]
-ns0=rad2
+ns0=rad3
diff --git a/autotests/testDPP/pkex_test.py b/autotests/testDPP/pkex_test.py
index 9e0b5dd82..db355225d 100644
--- a/autotests/testDPP/pkex_test.py
+++ b/autotests/testDPP/pkex_test.py
@@ -26,11 +26,11 @@ class Test(unittest.TestCase):
self.wpas.dpp_stop_listen()
self.wpas.dpp_configurator_remove()
- def start_iwd_pkex_configurator(self, device, agent=False):
+ def start_iwd_pkex_configurator(self, device, agent=False, profile='ssidCCMP.psk'):
self.hapd.reload()
self.hapd.wait_for_event('AP-ENABLED')
- IWD.copy_to_storage('ssidCCMP.psk')
+ IWD.copy_to_storage(profile)
device.autoconnect = True
condition = 'obj.state == DeviceState.connected'
@@ -186,6 +186,71 @@ class Test(unittest.TestCase):
self.agent = None
+ def test_existing_network(self):
+ self.hapd.reload()
+ self.hapd.wait_for_event('AP-ENABLED')
+ IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidCCMP.psk")
+
+ # Scan first so a network object exists, and its a known network
+ self.device[1].scan()
+ self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
+ self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
+
+ self.start_iwd_pkex_configurator(self.device[0])
+
+ self.device[1].dpp_pkex_enroll('secret123', identifier="test")
+ self.device[1].autoconnect = False
+
+ condition = 'obj.state == DeviceState.connected'
+ self.wd.wait_for_object_condition(self.device[1], condition)
+
+ # Check additional settings were carried over
+ with open('/tmp/ns0/ssidCCMP.psk', 'r') as f:
+ settings = f.read()
+
+ self.assertIn("SendHostname=true", settings)
+
+ def test_existing_hidden_network(self):
+ self.hapd_hidden.reload()
+ self.hapd_hidden.wait_for_event('AP-ENABLED')
+ IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidHidden.psk")
+
+ # Scan first so a network object exists, and its a known network
+ self.device[1].scan()
+ self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
+ self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
+
+ self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
+
+ self.device[1].dpp_pkex_enroll('secret123', identifier="test")
+ self.device[1].autoconnect = False
+
+ condition = 'obj.state == DeviceState.connected'
+ self.wd.wait_for_object_condition(self.device[1], condition)
+
+ # Check additional settings were carried over
+ with open('/tmp/ns0/ssidHidden.psk', 'r') as f:
+ settings = f.read()
+
+ self.assertIn("Hidden=true", settings)
+
+ def test_hidden_network(self):
+ self.hapd_hidden.reload()
+ self.hapd_hidden.wait_for_event('AP-ENABLED')
+ self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
+
+ self.device[1].dpp_pkex_enroll('secret123', identifier="test")
+ self.device[1].autoconnect = False
+
+ condition = 'obj.state == DeviceState.connected'
+ self.wd.wait_for_object_condition(self.device[1], condition)
+
+ # Check additional settings were carried over
+ with open('/tmp/ns0/ssidHidden.psk', 'r') as f:
+ settings = f.read()
+
+ self.assertIn("Hidden=true", settings)
+
def setUp(self):
ns0 = ctx.get_namespace('ns0')
self.wpas = Wpas('wpas.conf')
@@ -197,6 +262,8 @@ class Test(unittest.TestCase):
self.device.append(self.wd_ns0.list_devices(1)[0])
self.hapd = HostapdCLI('hostapd.conf')
self.hapd.disable()
+ self.hapd_hidden = HostapdCLI('ssidHidden.conf')
+ self.hapd_hidden.disable()
self.hwsim = Hwsim()
self.rule_xchg_resp = self.hwsim.rules.create()
@@ -240,6 +307,7 @@ class Test(unittest.TestCase):
self.hapd = None
self.rule_xchg_resp = None
IWD.clear_storage()
+ IWD.clear_storage('/tmp/ns0')
@classmethod
def setUpClass(cls):
diff --git a/autotests/testDPP/ssidHidden.conf b/autotests/testDPP/ssidHidden.conf
new file mode 100644
index 000000000..1055fb9cd
--- /dev/null
+++ b/autotests/testDPP/ssidHidden.conf
@@ -0,0 +1,9 @@
+hw_mode=g
+channel=6
+ssid=ssidHidden
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret123
+
+ignore_broadcast_ssid=1
diff --git a/autotests/testDPP/ssidHidden.psk b/autotests/testDPP/ssidHidden.psk
new file mode 100644
index 000000000..9917294ed
--- /dev/null
+++ b/autotests/testDPP/ssidHidden.psk
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=secret123
+
+[Settings]
+Hidden=true