From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 2/3] auto-t: make spoof_frame more robust
Date: Fri, 05 Feb 2021 10:09:10 -0800 [thread overview]
Message-ID: <20210205180911.320809-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20210205180911.320809-1-prestwoj@gmail.com>
[-- 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
next prev 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 ` James Prestwood [this message]
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
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-2-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