Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 3/3] auto-t: fix SAQuery-spoofing test
Date: Fri, 05 Feb 2021 10:09:11 -0800	[thread overview]
Message-ID: <20210205180911.320809-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20210205180911.320809-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2252 bytes --]

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.
---
 .../testSAQuery-spoofing/connection_test.py      | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/autotests/testSAQuery-spoofing/connection_test.py b/autotests/testSAQuery-spoofing/connection_test.py
index 7ad96d4f..a1e84de6 100644
--- a/autotests/testSAQuery-spoofing/connection_test.py
+++ b/autotests/testSAQuery-spoofing/connection_test.py
@@ -32,12 +32,7 @@ class Test(unittest.TestCase):
         condition = 'not obj.scanning'
         wd.wait_for_object_condition(device, condition)
 
-        device.scan()
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('ssidCCMP')
+        ordered_network = device.get_ordered_network('ssidCCMP', scan_if_needed=True)
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
@@ -49,9 +44,12 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        # TODO: for some reason hostapd does not respond to SA query if done
-        #       too soon after connection.
-        sleep(1)
+        # Ensure IWD is not scanning. This causes problems with mac80211_hwsim
+        # where CMD_FRAME will fail during a scan. This is due to the frame not
+        # 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.
         hwsim.spoof_disassociate(radio, hostapd.get_freq(), device.address)
-- 
2.26.2

  parent reply	other threads:[~2021-02-05 18:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 18:09 [PATCH 1/3] test-runner: print Radio class path James Prestwood
2021-02-05 18:09 ` [PATCH 2/3] auto-t: make spoof_frame more robust James Prestwood
2021-02-05 18:09 ` James Prestwood [this message]
2021-02-05 20:43 ` [PATCH 1/3] test-runner: print Radio class path Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210205180911.320809-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox