All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] test-runner: print Radio class path
@ 2021-02-05 18:09 James Prestwood
  2021-02-05 18:09 ` [PATCH 2/3] auto-t: make spoof_frame more robust James Prestwood
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: James Prestwood @ 2021-02-05 18:09 UTC (permalink / raw)
  To: iwd

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

---
 tools/test-runner | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/test-runner b/tools/test-runner
index 3a766ef5..a9b13aa8 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -347,6 +347,8 @@ class VirtualRadio(Radio):
 		if self.disable_cipher:
 			ret += '\tDisabled ciphers: %s\n' % self.disable_cipher
 
+		ret += '\tPath: %s' % self._radio.path
+
 		ret += '\n'
 
 		return ret
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] auto-t: make spoof_frame more robust
  2021-02-05 18:09 [PATCH 1/3] test-runner: print Radio class path James Prestwood
@ 2021-02-05 18:09 ` James Prestwood
  2021-02-05 18:09 ` [PATCH 3/3] auto-t: fix SAQuery-spoofing test James Prestwood
  2021-02-05 20:43 ` [PATCH 1/3] test-runner: print Radio class path Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: James Prestwood @ 2021-02-05 18:09 UTC (permalink / raw)
  To: iwd

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

Sometimes scan results can come in with a MAC address which
should be in the first index of addrs[] (42:xx:xx:xx:xx:xx).
This causes a failure to lookup the radio path.

There was also a failure path added if the radio cannot be
found rather than rely on DBus to fail with a None path.

The arguments to SendFrame were also changed to use the
ByteArray DBus type rather than python's internal bytearray.
This shouldn't have any effect, but its more consistent with
how DBus arguments should be used.
---
 autotests/util/hwsim.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/autotests/util/hwsim.py b/autotests/util/hwsim.py
index 9aa14cbc..ad4bec1f 100755
--- a/autotests/util/hwsim.py
+++ b/autotests/util/hwsim.py
@@ -330,15 +330,19 @@ class Hwsim(iwd.AsyncOpAbstract):
             obj = objects[path]
             for interface in obj:
                 if interface == HWSIM_INTERFACE_INTERFACE:
-                    if obj[interface]['Address'] == radio.addresses[0]:
+                    if obj[interface]['Address'] == radio.addresses[0] or \
+                                    obj[interface]['Address'] == radio.addresses[1]:
                         radio_path = path
                         break
 
+        if not radio_path:
+            raise Exception("Could not find radio %s" % radio.path)
+
         iface = dbus.Interface(self._bus.get_object(HWSIM_SERVICE, radio_path),
                 HWSIM_INTERFACE_INTERFACE)
 
-        iface.SendFrame(bytearray.fromhex(station.replace(':', '')),
-                        freq, -30, bytearray.fromhex(frame))
+        iface.SendFrame(dbus.ByteArray.fromhex(station.replace(':', '')),
+                        freq, -30, dbus.ByteArray.fromhex(frame))
 
     def get_radio(self, name):
         for path in self.radios:
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] auto-t: fix SAQuery-spoofing test
  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
  2021-02-05 20:43 ` [PATCH 1/3] test-runner: print Radio class path Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: James Prestwood @ 2021-02-05 18:09 UTC (permalink / raw)
  To: iwd

[-- 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] test-runner: print Radio class path
  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 ` [PATCH 3/3] auto-t: fix SAQuery-spoofing test James Prestwood
@ 2021-02-05 20:43 ` Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2021-02-05 20:43 UTC (permalink / raw)
  To: iwd

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

Hi James,

On 2/5/21 12:09 PM, James Prestwood wrote:
> ---
>   tools/test-runner | 2 ++
>   1 file changed, 2 insertions(+)
> 

All applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-05 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/3] auto-t: fix SAQuery-spoofing test James Prestwood
2021-02-05 20:43 ` [PATCH 1/3] test-runner: print Radio class path Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.