Commit Graph

594 Commits

Author SHA1 Message Date
James Prestwood 521960c7d6 auto-t: add test for IWD as configurator + initiator 2022-02-22 16:25:57 -06:00
James Prestwood cfb0987eb5 auto-t: wpas.py: handle enrollee as responder
This adds support for wpa_supplicant to generate its own URI and
start presence announcements (DPP_CHIRP).
2022-02-22 16:25:55 -06:00
James Prestwood 69c1a1ba7c auto-t: wpas.py: allow arbitrary events to be handled
If an event is in response to some command which is returning an
unexpected value (unexpected with respect to wpas.py) handle_eow
would raise an exception.

Specifically with DPP this was being hit when the URI was being
returned.
2022-02-22 16:25:53 -06:00
James Prestwood 50a546705e auto-t: iwd.py: allow passing uri to start_configurator
If a URI is passed this will envoke ConfigureEnrollee()
2022-02-22 16:25:50 -06:00
James Prestwood 15c0920777 auto-t: hwsim.py: support async radio creation
Adds a new wait argument which, if false, will call the DBus method
and return immediately. This allows the caller to create multiple
radios very quickly, simulating (as close as we can) a wifi card
with dual phy's which appear in the kernel simultaneously.

The name argument was also changed to be mandatory, which is now
required by hwsim.
2022-02-16 16:27:42 -06:00
James Prestwood 73e428cf3f auto-t: add test for encrypted profiles 2022-02-15 17:44:25 -06:00
James Prestwood 9966533e6a auto-t: add test for fixed scanning crash
This simulates the conditions that trigger a free-after-use which was
fixed with:

2c355db7 ("scan: remove periodic scans from queue on abort")

This behavior can be reproduced reliably using this test with the above
patch reverted.
2022-02-14 16:02:23 -06:00
James Prestwood 94cc957c5e auto-t: iwd.py: add wait argument to scan()
Lets the test continue without waiting for the method return
2022-02-14 16:02:23 -06:00
James Prestwood b44e32fde9 auto-t: only wait for wpa_s to get the DPP configuration
As far as wpa_supplicant goes we don't need to test if it can actually
connect to the network, just that it receives the DPP configuration.
2022-02-03 13:54:54 -06:00
James Prestwood c3b18c44e0 auto-t: roam test to simulate reported crash
During investigation another separate crash was found. The original is
caused by a disconnect event coming in after a neighbor report scan
was completed (roam failed) during the full roam scan.

The second crash is caused by a disconnect coming in during a full
roam scan when no neighbor report scan was ever issued.
2022-01-19 16:37:51 -06:00
James Prestwood 301a55c8c3 auto-t: hostapd.py: add remove_neighbor() 2022-01-19 16:37:51 -06:00
James Prestwood b7b0b4eb02 auto-t: improve testDPP reliablity
First disconnect wpa_supplicant to make sure it wont miss frames if
it decides to connect. Also alter the order of things for the
configurator test so autoconnect doesn't start until after hostapd
is up (avoids additional scanning and delays)
2022-01-12 12:46:27 -06:00
James Prestwood c5fb68bb2e auto-t: wpas.py: add disconnect() 2022-01-12 12:46:24 -06:00
James Prestwood 627e54eb20 auto-t: wpas.py: increase timeout for auth protocol
Sometimes wpa_supplicant takes some time to respond to the initial
presence anouncements.
2022-01-12 12:46:21 -06:00
James Prestwood 7a3d4dabb1 auto-t: add a few more DPP tests
This adds 3 more tests:
 - Channel switch during authentication
 - Scan after configuring
 - Retransmit auth frames
2022-01-12 10:05:16 -06:00
James Prestwood 692d137a21 auto-t: wpas.py: add configurator_remove
wpa_supplicant has a limited number of configurator IDs, and its
good practice to remove them after we are done.
2022-01-12 10:05:13 -06:00
James Prestwood 0b36f497c5 auto-t: wpas.py: add freq argument to configurator_start
This forces the configurator to request a new channel during the
authentication protocol.
2022-01-12 10:05:11 -06:00
James Prestwood c78573b468 auto-t: wpas.py: read DPP event until expected result
Controlling wpa_supplicant/hostapd from a text based interface is
problematic in that there is no way of knowing if an event corresponds
to a request. In certain cases if wpa_s/hostapd is sending out multiple
events and we make a request, a random event may come back after the
request, but before the actual result.

To fix this, at least for this specific case, we can continue to read
from the socket until the result is numeric.
2022-01-12 09:27:45 -06:00
James Prestwood f8459427d3 auto-t: update wpas.py to use non_block_wait
This should be used as a replacement for the common GLib
wait loop (internally this is all it does).
2022-01-12 09:27:39 -06:00
James Prestwood 994c18c44e auto-t: iwd.py: use spaces instead of tabs 2022-01-04 12:34:22 -06:00
James Prestwood 7d9b198df6 auto-t: add DPP autotests 2022-01-04 12:02:42 -06:00
James Prestwood 0fd7cdcb78 auto-t: wpas.py: add DPP utilities 2022-01-04 12:02:42 -06:00
James Prestwood 7ef165035e auto-t: iwd.py: add DPP utilities 2022-01-04 12:02:42 -06:00
James Prestwood 88f2309796 auto-t: wpas.py: add wait_for_result
Some wpa_cli utilities return some result which isn't possible to
get with wait_for_event unless you know what the result will be.
This adds wait_for_result which just returns the first event that
comes in.
2022-01-04 12:02:42 -06:00
James Prestwood 8178ea17fd auto-t: iwd.py: remove unused members 2022-01-04 12:02:42 -06:00
James Prestwood cbe454a46a auto-t: wpas.py: don't require strict match on wait_for_event
wait_for_event was checking the event string presence in the rx_data
array which meant the event string had to match perfectly to any
received events. This poses problems with events that include additional
information which the caller may not be able to know or does not care
about. For example:

DPP-RX src=02:00:00:00:02:00 freq=2437 type=11

Waiting for this event previously would require the caller know src, freq,
and type. If the caller only wants to wait for DPP-RX, it can now do that.
2022-01-04 12:02:42 -06:00
James Prestwood 4ee44ee0ea auto-t: iwd.py: remove StationDebug out of Device init
Since a Device class can represent multiple modes (AP, AdHoc, station)
move StationDebug out of the init and only create this class when it
is used (presumably only when the device is in station mode).

The StationDebug class is now created in a property method consistent
with 'station_if'. If Device is not in station mode it is automatically
switched if the test tries any StationDebug methods.

If the Device mode is changed from 'station' the StationDebug class
instance is destroyed.
2022-01-04 11:40:52 -06:00
Denis Kenzior c3a76e0f9d auto-t: Drop !used hostapd instances in testHotspot 2021-12-24 14:28:55 -06:00
Denis Kenzior 4e2005d53b auto-t: Disable Scan address randomization 2021-12-23 18:38:18 -06:00
James Prestwood 1825fd7ab7 auto-t: iwd.py: fix namespaces on StationDebug
Passing the full argument list to StationDebug was removed
because any existing properties (for Device) were being
included and causing incorrect behavior.

This neglected to handle namespaces which should also be
passed to StationDebug. Unfortunately the arguments are not
named when Device() is initialized so they cannot easily be
sorted. Instead just define Device() arguments to match the
DBus abstraction and pass only the path and namespace to
StationDebug
2021-12-22 19:10:43 -06:00
James Prestwood 76d54b28ea auto-t: add missing config files (testOWE-transition) 2021-12-22 18:10:42 -06:00
Andrew Zaborowski 7ecdee6eaa autotests: p2p: Make waiting for dhclient more reliable
Make sure we wipe the leases file both for server and client, so that
dhclient doesn't try to re-use leases from previous tests (should really
happen) and waste time waiting for a reply.  Extend the timeout from 1s
to 5s, sometimes it takes dhclient 1s just to start.  Disable verbose
mode if not needed to avoid dhclient stalling if the pipe is not being
read.
2021-11-30 15:49:08 -06:00
James Prestwood 61dfa943c6 auto-t: testPSK-roam deauthenticate IWD after roam
After roaming deauth IWD and check the connection state.
2021-11-23 12:19:18 -06:00
James Prestwood 44faa81a06 auto-t: iwd.py: use args[0] for station debug interface
Passing *args, **kwargs into StationDebug ended up initializing the
class with Station properties since devices can be initialized from
existing property dictionaries. Since the object path is all
StationDebug needs, pass args[0] instead.
2021-11-22 15:29:42 -06:00
Torsten Schmitz 22c77cc037 auto-t: replace ifconfig with ip commands
ifconfig has long been deprecated in favor of ip from iproute2.
It is usually no longer installed by default.
2021-11-11 14:29:54 -06:00
Denis Kenzior 05ae9689eb auto-t: use tmp radvd pid file
On some systems the default radvd pid file location is not accessible.
Specify it to be under /tmp instead.

While there, enable full radvd debug output so it is logged when
test-runner is invoked with the --log option.
2021-11-10 09:17:17 -06:00
Andrew Zaborowski d30fc97815 autotests: Test DHCPv6 client in testNetconfig 2021-11-09 14:32:50 -06:00
James Prestwood 017069bf68 auto-t: add OWE transition test with extra open network
A user reported a crash in situations where there was an OWE transition
pair, with an extra open network using the same SSID but not advertising
the OWE transition IE:

++++++++ backtrace ++++++++
 0x7f199cadf320 in /lib64/libc.so.6
 0x418c08 in network_has_open_pair() at /home/jprestwo/iwd/src/station.c:712
 0x4262ce in scan_finished() at /home/jprestwo/iwd/src/scan.c:1718
 0x4273cd in get_scan_done() at /home/jprestwo/iwd/src/scan.c:1733
 0x47cf7a in destroy_request() at /home/jprestwo/iwd/ell/genl.c:674
 0x479f1c in io_callback() at /home/jprestwo/iwd/ell/io.c:120
 0x47922d in l_main_iterate() at /home/jprestwo/iwd/ell/main.c:472 (discriminator 2)
 0x4792dc in l_main_run() at /home/jprestwo/iwd/ell/main.c:521
 0x47950c in l_main_run_with_signal() at /home/jprestwo/iwd/ell/main.c:649
 0x403e97 in main() at /home/jprestwo/iwd/src/main.c:532
 0x7f199cac9b75 in /lib64/libc.so.6
+++++++++++++++++++++++++++
2021-11-08 13:50:25 -06:00
James Prestwood 09f4bd9210 auto-t: add a DGAF Disable hotspot test 2021-11-04 14:30:55 -05:00
James Prestwood 72dbab789d auto-t: allow testAP to benefit from re-scanning
If a beacon is lost testAP will fail since it did not utilize any
rescanning logic. Now it can use this feature by passing full_scan.
This is required since IWD APs are not known to test-runner like
hostapd APs are.
2021-11-02 16:14:55 -05:00
James Prestwood 392eebc0a9 auto-t: iwd.py: fix re-scanning bug on get_ordered_networks
Certain scenarios coupled with lost beacons could result in OrderedNetwork
being initialized many times until the dbus library reached its maximum
signal registrations. This could happen where there are two networks,
IWD finds one in a scan but continues to scan for the other and the beacons
are lost. The way get_ordered_networks was written it returns early if any
networks are found. Since get_ordered_network (not plural) uses
get_ordered_networks() in a loop this caused OrderedNetwork's to be created
rapidly until python raises an exception.

To fix this, pass an optional list of networks being looked for to
get_ordered_networks. Only if all the networks in the list are found will
it return early, otherwise it will continue to scan.
2021-11-02 16:14:28 -05:00
James Prestwood e782911d33 auto-t: use tearDownClass in hidden network test
A failure in this test could leave stale network profiles, which
may cause future tests to fail.
2021-10-20 16:52:18 -05:00
James Prestwood 2dec023f63 auto-t: fix testConnectAutoconnect
There was no open ssid provisioning file, which was fine as the
first test should have created one. But to be safe, include one
explicitly and use the proper setUp/tearDown functions.
2021-10-20 16:51:58 -05:00
James Prestwood 6a4fffe6da auto-t: update blacklist test to use 'enable' on rules 2021-10-20 16:44:28 -05:00
James Prestwood bec0cabde4 auto-t: add missing ocv option and wait to testChannelSwitch
This should have been added to the original test
2021-10-19 15:29:26 -05:00
James Prestwood b16621b9ee auto-t: Add channel switch test 2021-10-19 13:33:54 -05:00
James Prestwood 74e7e341fd auto-t: hostapd.py: add chan_switch()
Forces hostapd to channel switch
2021-10-19 13:33:51 -05:00
James Prestwood 850d2c7ea8 auto-t: add OCV to testSAQuery-spoofing 2021-10-19 13:28:03 -05:00
James Prestwood 1c86327029 auto-t: SAQuery-spoofing replace sleep with condition wait
By sleeping for 4 seconds IWD had plenty of time to fully disconnect
and reconnect in time to pass the final "connected" check. Instead
use wait_for_object_condition to wait for disconnected and expect
this to fail. This will let the test fail if IWD disconnects.
2021-10-19 13:27:59 -05:00
James Prestwood adceab280b auto-t: Add test for extended key IDs 2021-10-08 13:28:04 -05:00