3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

auto-t: modify PSK-roam test to use FT failure path

This adds another radio so IWD hits the FT failure path after
authentication to the first BSS fails. This causes a wiphy work
item to be rescheduled which previously was unsafe.
This commit is contained in:
James Prestwood 2023-05-18 09:49:57 -07:00 committed by Denis Kenzior
parent 23f0f5717c
commit 563ecc63e8
5 changed files with 74 additions and 18 deletions

View File

@ -48,7 +48,7 @@ class Test(unittest.TestCase):
self.rule2.enabled = True
# Send 100 packets (to be dropped), should trigger beacon loss
testutil.tx_packets(device.name, self.bss_hostapd[0].ifname, 100)
device.wait_for_event('packet-loss-roam', timeout=30)
device.wait_for_event('packet-loss-roam', timeout=60)
else:
device.roam(self.bss_hostapd[1].bssid)
@ -173,19 +173,22 @@ class Test(unittest.TestCase):
IWD.copy_to_storage('TestFT.psk')
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
HostapdCLI(config='ft-psk-ccmp-2.conf') ]
HostapdCLI(config='ft-psk-ccmp-2.conf'),
HostapdCLI(config='ft-psk-ccmp-3.conf') ]
cls.bss_hostapd[2].disable()
rad0 = hwsim.get_radio('rad0')
rad2 = hwsim.get_radio('rad2')
rad3 = hwsim.get_radio('rad3')
cls.rule0 = hwsim.rules.create()
cls.rule0.source = rad2.addresses[0]
cls.rule0.source = rad3.addresses[0]
cls.rule0.bidirectional = True
cls.rule0.signal = -2000
cls.rule0.prefix = 'b0'
cls.rule0.drop = True
cls.rule1 = hwsim.rules.create()
cls.rule1.source = rad2.addresses[0]
cls.rule1.source = rad3.addresses[0]
cls.rule1.prefix = '08'
cls.rule1.drop = True

View File

@ -62,21 +62,17 @@ class Test(unittest.TestCase):
self.rule0.enabled = True
device.roam(self.bss_hostapd[1].bssid)
# Roam should fail...
device.wait_for_event('ft-roam-failed')
# IWD should connect, then attempt a roam to BSS 1, which should fail...
device.wait_for_event('ft-roam-failed', timeout=60)
# ... but IWD should remain connected
self.assertTrue(device.state == DeviceState.connected)
self.rule0.enabled = False
# Try again once more
device.roam(self.bss_hostapd[1].bssid)
# IWD should then try BSS 2, and succeed
self.verify_roam(wd, device, self.bss_hostapd[0], self.bss_hostapd[2])
self.verify_roam(wd, device, self.bss_hostapd[0], self.bss_hostapd[1])
self.bss_hostapd[1].deauthenticate(device.address)
self.bss_hostapd[2].deauthenticate(device.address)
condition = 'obj.state == DeviceState.disconnected'
wd.wait_for_object_condition(device, condition)
@ -88,6 +84,7 @@ class Test(unittest.TestCase):
self.rule0.enabled = False
self.rule1.enabled = False
self.rule2.enabled = False
@classmethod
def setUpClass(cls):
@ -96,14 +93,16 @@ class Test(unittest.TestCase):
IWD.copy_to_storage('TestFT.psk')
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
HostapdCLI(config='ft-psk-ccmp-2.conf') ]
HostapdCLI(config='ft-psk-ccmp-2.conf'),
HostapdCLI(config='ft-psk-ccmp-3.conf') ]
cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
cls.bss_hostapd[2].set_address('12:00:00:00:00:03')
# Drop Authenticate frames
cls.rule0 = hwsim.rules.create()
cls.rule0.bidirectional = True
cls.rule0.source = hwsim.get_radio('rad1').addresses[0]
cls.rule0.prefix = 'b0'
cls.rule0.drop = True
@ -113,6 +112,18 @@ class Test(unittest.TestCase):
cls.rule1.prefix = 'd0'
cls.rule1.drop = True
# Causes IWD to immediately roam away from BSS 0
cls.rule2 = hwsim.rules.create()
cls.rule2.source = hwsim.get_radio('rad0').addresses[0]
cls.rule2.signal = -8000
cls.rule2.enabled = True
# Causes IWD to first prefer BSS 1 to roam, then BSS 2.
cls.rule3 = hwsim.rules.create()
cls.rule3.source = hwsim.get_radio('rad2').addresses[0]
cls.rule3.signal = -7000
cls.rule3.enabled = True
@classmethod
def tearDownClass(cls):
IWD.clear_storage()

View File

@ -0,0 +1,39 @@
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
ft_over_ds=0
ap_table_expiration_time=36000
ap_table_max_size=10
rrm_neighbor_report=1

View File

@ -1,8 +1,9 @@
[SETUP]
num_radios=3
num_radios=4
start_iwd=0
hwsim_medium=yes
[HOSTAPD]
rad0=ft-psk-ccmp-1.conf
rad1=ft-psk-ccmp-2.conf
rad2=ft-psk-ccmp-3.conf

View File

@ -70,8 +70,10 @@ class Test(unittest.TestCase):
IWD.copy_to_storage('TestFT.psk')
cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
HostapdCLI(config='ft-psk-ccmp-2.conf') ]
HostapdCLI(config='ft-psk-ccmp-2.conf'),
HostapdCLI(config='ft-psk-ccmp-3.conf') ]
cls.bss_hostapd[1].disable()
cls.bss_hostapd[2].disable()
cls.bss_hostapd[0].set_value('ocv', '0')
cls.bss_hostapd[0].set_value('ieee80211w', '0')