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

auto-t: fix SAQuery-spoofing test

This test occationally failed due to a badly timed DBus scan
triggering right when hwsim tried sending out the spoofed frame.
This caused mac80211_hwsim to reject CMD_FRAME when the timing
was just right.

Rather than always starting a DBus scan we can rely on periodic
scans and only DBus scan if there are no networks in IWD's list.
A scanning check was also added prior to sending out the frame
and if true we wait for not scanning. This is more paranoia than
anything.
This commit is contained in:
James Prestwood 2021-02-05 10:09:11 -08:00 committed by Denis Kenzior
parent e7d941dc3c
commit 5c96e1e81e

View File

@ -32,12 +32,7 @@ class Test(unittest.TestCase):
condition = 'not obj.scanning' condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
device.scan() ordered_network = device.get_ordered_network('ssidCCMP', scan_if_needed=True)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network('ssidCCMP')
self.assertEqual(ordered_network.type, NetworkType.psk) self.assertEqual(ordered_network.type, NetworkType.psk)
@ -49,9 +44,12 @@ class Test(unittest.TestCase):
condition = 'obj.state == DeviceState.connected' condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition) wd.wait_for_object_condition(device, condition)
# TODO: for some reason hostapd does not respond to SA query if done # Ensure IWD is not scanning. This causes problems with mac80211_hwsim
# too soon after connection. # where CMD_FRAME will fail during a scan. This is due to the frame not
sleep(1) # having the same frequency as the radio (since hwsim is off-channel)
if device.scanning:
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
# Spoof a disassociate frame. This will kick off SA Query procedure. # Spoof a disassociate frame. This will kick off SA Query procedure.
hwsim.spoof_disassociate(radio, hostapd.get_freq(), device.address) hwsim.spoof_disassociate(radio, hostapd.get_freq(), device.address)