mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
auto-t: add test for roaming + netconfig
This test ensures IWD will continue to roam and restart netconfig if roam conditions are met prior to netconfig finishing.
This commit is contained in:
parent
7080a4453e
commit
5abf54f2dc
2
autotests/testNetconfigRoam/TestFT.psk
Normal file
2
autotests/testNetconfigRoam/TestFT.psk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=EasilyGuessedPassword
|
41
autotests/testNetconfigRoam/ft-psk-ccmp-1.conf
Normal file
41
autotests/testNetconfigRoam/ft-psk-ccmp-1.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=TestFT
|
||||||
|
utf8_ssid=1
|
||||||
|
ctrl_interface=/var/run/hostapd
|
||||||
|
|
||||||
|
r1_key_holder=120000000001
|
||||||
|
nas_identifier=dummy1
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same
|
||||||
|
# time but we want to force FT
|
||||||
|
wpa_key_mgmt=FT-PSK
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
wpa_passphrase=EasilyGuessedPassword
|
||||||
|
ieee80211w=1
|
||||||
|
rsn_preauth=1
|
||||||
|
rsn_preauth_interfaces=lo
|
||||||
|
disable_pmksa_caching=0
|
||||||
|
# Allow PMK cache to be shared opportunistically among configured interfaces
|
||||||
|
# and BSSes (i.e., all configurations within a single hostapd process).
|
||||||
|
okc=1
|
||||||
|
mobility_domain=1234
|
||||||
|
reassociation_deadline=60000
|
||||||
|
r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f
|
||||||
|
r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f
|
||||||
|
r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
|
||||||
|
r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
|
||||||
|
# Push mode only needed for 8021x, not PSK mode since msk already known
|
||||||
|
pmk_r1_push=0
|
||||||
|
# Allow locally generated FT response so we don't have to configure push/pull
|
||||||
|
# between BSSes running as separate hostapd processes as in the test-runner
|
||||||
|
# case. Only works with FT-PSK, otherwise brctl needs to be installed and
|
||||||
|
# CONFIG_BRIDGE enabled in the kernel.
|
||||||
|
ft_psk_generate_local=1
|
||||||
|
rkh_pull_timeout=50
|
||||||
|
ft_over_ds=0
|
||||||
|
ap_table_expiration_time=36000
|
||||||
|
ap_table_max_size=10
|
||||||
|
rrm_neighbor_report=1
|
||||||
|
ocv=1
|
41
autotests/testNetconfigRoam/ft-psk-ccmp-2.conf
Normal file
41
autotests/testNetconfigRoam/ft-psk-ccmp-2.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=2
|
||||||
|
ssid=TestFT
|
||||||
|
utf8_ssid=1
|
||||||
|
ctrl_interface=/var/run/hostapd
|
||||||
|
|
||||||
|
r1_key_holder=120000000002
|
||||||
|
nas_identifier=dummy2
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same
|
||||||
|
# time but we want to force FT
|
||||||
|
wpa_key_mgmt=FT-PSK
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
wpa_passphrase=EasilyGuessedPassword
|
||||||
|
ieee80211w=1
|
||||||
|
rsn_preauth=1
|
||||||
|
rsn_preauth_interfaces=lo
|
||||||
|
disable_pmksa_caching=0
|
||||||
|
# Allow PMK cache to be shared opportunistically among configured interfaces
|
||||||
|
# and BSSes (i.e., all configurations within a single hostapd process).
|
||||||
|
okc=1
|
||||||
|
mobility_domain=1234
|
||||||
|
reassociation_deadline=60000
|
||||||
|
r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f
|
||||||
|
r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f
|
||||||
|
r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
|
||||||
|
r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
|
||||||
|
# Push mode only needed for 8021x, not PSK mode since msk already known
|
||||||
|
pmk_r1_push=0
|
||||||
|
# Allow locally generated FT response so we don't have to configure push/pull
|
||||||
|
# between BSSes running as separate hostapd processes as in the test-runner
|
||||||
|
# case. Only works with FT-PSK, otherwise brctl needs to be installed and
|
||||||
|
# CONFIG_BRIDGE enabled in the kernel.
|
||||||
|
ft_psk_generate_local=1
|
||||||
|
rkh_pull_timeout=50
|
||||||
|
ft_over_ds=0
|
||||||
|
ap_table_expiration_time=36000
|
||||||
|
ap_table_max_size=10
|
||||||
|
rrm_neighbor_report=1
|
||||||
|
ocv=1
|
8
autotests/testNetconfigRoam/hw.conf
Normal file
8
autotests/testNetconfigRoam/hw.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=3
|
||||||
|
start_iwd=0
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ft-psk-ccmp-1.conf
|
||||||
|
rad1=ft-psk-ccmp-2.conf
|
3
autotests/testNetconfigRoam/main.conf
Normal file
3
autotests/testNetconfigRoam/main.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[General]
|
||||||
|
EnableNetworkConfiguration=true
|
||||||
|
RoamRetryInterval=1
|
91
autotests/testNetconfigRoam/netconfig_roam_test.py
Normal file
91
autotests/testNetconfigRoam/netconfig_roam_test.py
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
import iwd
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import PSKAgent
|
||||||
|
from iwd import NetworkType
|
||||||
|
from iwd import DeviceState
|
||||||
|
from hwsim import Hwsim
|
||||||
|
from hostapd import HostapdCLI
|
||||||
|
import testutil
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
def test_roam_before_netconfig(self):
|
||||||
|
wd = IWD(True)
|
||||||
|
|
||||||
|
device = wd.list_devices(1)[0]
|
||||||
|
device.get_ordered_network('TestFT', full_scan=True)
|
||||||
|
device.connect_bssid(self.bss_hostapd[1].bssid)
|
||||||
|
|
||||||
|
self.bss_hostapd[1].wait_for_event(f'AP-STA-CONNECTED {device.address}')
|
||||||
|
device.wait_for_event("connecting (netconfig)")
|
||||||
|
|
||||||
|
roam_to = 0
|
||||||
|
roam_from = 1
|
||||||
|
|
||||||
|
# Roam back and forth, ensuring that the state transitions between
|
||||||
|
# roaming and connecting (netconfig).
|
||||||
|
for _ in range(0, 5):
|
||||||
|
self.rules[roam_to].signal = -2000
|
||||||
|
self.rules[roam_from].signal = -8000
|
||||||
|
|
||||||
|
# Station should internally transition to roaming, but remain in a
|
||||||
|
# connecting state on DBus
|
||||||
|
device.wait_for_event("ft-roaming")
|
||||||
|
self.assertEqual(device.state, DeviceState.connecting)
|
||||||
|
|
||||||
|
self.bss_hostapd[roam_to].wait_for_event(f'AP-STA-CONNECTED {device.address}')
|
||||||
|
device.wait_for_event("connecting (netconfig)")
|
||||||
|
|
||||||
|
tmp = roam_from
|
||||||
|
roam_from = roam_to
|
||||||
|
roam_to = tmp
|
||||||
|
|
||||||
|
self.bss_hostapd[roam_from].deauthenticate(device.address)
|
||||||
|
condition = 'obj.state == DeviceState.disconnected'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down')
|
||||||
|
os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down')
|
||||||
|
os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up')
|
||||||
|
os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up')
|
||||||
|
|
||||||
|
@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') ]
|
||||||
|
|
||||||
|
rule0 = hwsim.rules.create()
|
||||||
|
rule0.source = cls.bss_hostapd[0].bssid
|
||||||
|
rule0.signal = -6000
|
||||||
|
rule0.enabled = True
|
||||||
|
|
||||||
|
rule1 = hwsim.rules.create()
|
||||||
|
rule1.source = cls.bss_hostapd[1].bssid
|
||||||
|
rule1.signal = -2000
|
||||||
|
rule1.enabled = True
|
||||||
|
|
||||||
|
cls.rules = [rule0, rule1]
|
||||||
|
|
||||||
|
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
|
||||||
|
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
|
||||||
|
|
||||||
|
HostapdCLI.group_neighbors(*cls.bss_hostapd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
cls.bss_hostapd = None
|
||||||
|
cls.rules = None
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
Loading…
Reference in New Issue
Block a user