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

726 Commits

Author SHA1 Message Date
James Prestwood
1d3455ba16 auto-t: add two tests for new FT behavior
These tests ensure proper behavior if FT fails to authenticate
2022-10-06 09:01:38 -05:00
James Prestwood
7d1968b086 auto-t: remove old debug print from wpas.py 2022-10-06 09:01:32 -05:00
James Prestwood
1f044b8f45 auto-t: remove rekey timeouts from autotests
Any autotest which rekeys will do so explicitly. There is no need
to potentially introduce an unexpected rekey.
2022-10-06 09:01:24 -05:00
Andrew Zaborowski
5abf980b70 autotests: Add a stateless DHCPv6 test case 2022-10-04 12:45:07 -05:00
James Prestwood
174e9f2fe9 auto-t: add a no candidate test to testAPRoam
This tests the new behavior where the roam request does not
indicate disassociation is imminent. In this case if no
candidates are found IWD should not roam.
2022-09-28 12:36:20 -05:00
James Prestwood
cd258df337 auto-t: update uses of wait_for_object_change
This removes waiting for DeviceState.roaming, which is now done
automatically by wait_for_object_change.
2022-09-28 12:36:16 -05:00
James Prestwood
23a22edaed auto-t: change wait_for_object_change behavior
Instead of requiring the initial condition be met when calling
wait_for_object_change, wait for it.

This is how every caller of this function uses it, specifically
with roaming where we first wait for DeviceState.roaming, then
call wait_for_object_change. This can be simplified for the caller
so the initial condition is first waited for.
2022-09-28 12:36:14 -05:00
James Prestwood
0f6d461779 auto-t: set disassociation imminent for bss transitions
Allow the caller to set the disassociation imminent bit when
sending the BSS transition request.
2022-09-28 12:35:41 -05:00
Andrew Zaborowski
3b87e12c49 autotests: Add a SLAAC test 2022-09-20 10:06:50 -05:00
James Prestwood
0e72ce8861 auto-t: add more checks to testRRM
The hostapd events for RRM come regardless of success
so they need to be checked as such. In addition one more
RRM request was added to scan on a frequency which is
disabled (operating class 82, channel 14).
2022-09-09 09:11:15 -05:00
Andrew Zaborowski
e28243a584 autotests: Test ACD failure during connect
Previously we had an ACD failure scenario where a new client forces its
IP to create an IP conflict and an already-connected client detects the
conflict and reacts.  Now first test a scenario where a newly connecting
IWD client runs ACD before setting its statically configured IP, detects
a conflict and refuses to continue, then run the second scenario where
the newly connecting DHCP-configured client ignores the conflict and
starts ACD in defend-indefinitely mode and the older client in
defent-once mode gives up its IP.
2022-08-23 15:47:06 -05:00
Andrew Zaborowski
818ec70549 autotests: Fix class variables that should be object vars
Due to those variables being global (IWD class variables) calling either
unregister_psk_agent or del on one IWD class instance would unregister
all agents on all instances.  Move .psk_agents and two other class
variables to the object.  They were already referenced using "self."
as if they were object variables throughout the class.
2022-08-23 15:47:06 -05:00
Andrew Zaborowski
f6a890f5cb autotests: Fix testNetconfig ACD test
Part of static_test.py starts a second IWD instance and tries to make
it connect to the AP with the same IP address as the first IWD instance
which is already connected, to produce an IP conflict.  For this, the
second instance uses DHCP and the test expects the DHCP server to offer
the address 192.168.1.10 to it.  However in the current setup the DHCP
server manages to detect that 192.168.1.10 is in use and offers .11
instead.  Break the DHCP server's conflict detection by disabling ICMP
ping replies in order to fix the test.

Previously this has worked because the AP's and the DHCP server's
network interface is in the same network namespace as the first IWD
instance's network interface meaning that pings between the two
interfaces shouldn't work (a known Linux kernel routing quirk...).
I am not sure why those pings currently do work but take no chances and
disable ICMP pings.
2022-08-23 15:47:06 -05:00
James Prestwood
950624761c auto-t: remove bringing up lo interface
Several tests were setting lo up which is already done by
test-runner.
2022-08-22 12:53:16 -05:00
James Prestwood
4545f80e58 auto-t: update tests to use set_address/group_neighbors
This reduces the big blocks of copied code with a few function calls.
2022-08-22 12:53:16 -05:00
James Prestwood
3439d09817 auto-t: hostapd: add set_address/group_neighbors
This adds a few utilities for setting up an FT environment. All the
roaming tests basically copy/paste the same code for setting up the
hostapd instances and this can cause problems if not done correctly.

set_address() sets the MAC address on the device, and restarts hostapd
group_neighbors() takes a list of HostapdCLI objects and makes each a
    neighbor to the others.

The neighbor report element requires the operating class which isn't
advertised by hostapd. For this we assume operating class 81 but this
can be set explicitly if it differs. Currently no roaming tests use
5/6GHz frequencies, and just in case an exception will be thrown if
the channel is greater than 14 and the op_class didn't change.
2022-08-22 12:53:16 -05:00
James Prestwood
41ce56bf0d auto-t: fix unreliable behavior in testPSK-roam
The packet loss test had a few problems. First being that the RSSI for
the original BSS was not low enough to change the rank. This meant any
roam was just lucky that the intended BSS was first in the results.

The second problem is timing related, and only happens on UML. Disabling
the rules after the roaming condition sometimes allows IWD to fully
roam and connect before the next state change checks.
2022-08-22 12:53:16 -05:00
James Prestwood
fb76a4ef13 auto-t: add packet loss test to testPSK-roam
A new test which blocks all data frames once connected, then tries
to send 100 packets. This should result in the kernel sending a
packet loss event to userspace, which IWD should react to and roam.
2022-08-16 15:30:03 -05:00
James Prestwood
1e1a6d6754 auto-t: add generic tx_packet function
This sends data over the raw sockets similar to test_ifaces_connected
2022-08-16 15:29:59 -05:00
James Prestwood
7d6a38de93 auto-t: iwd.py: let IWD class specify developer mode 2022-07-26 13:11:39 -05:00
Andrew Zaborowski
d58e754344 autotests: Also validate correct hostname sent over DHCPv4 2022-07-12 12:47:09 -05:00
Andrew Zaborowski
187706c348 autotests: DHCPv4 renewal/resend test in testNetconfig
Test that the DHCPv4 lease got renewed after the T1 timer runs out.
Then also simulate the DHCPREQUEST during renew being lost and
retransmitted and the lease eventually getting renewed T1 + 60s later.

The main downside is that this test will inevitably take a while if
running in Qemu without the time travel ability.

Update the test and some utility code to run hostapd in an isolated net
namespace for connection_test.py.  We now need a second hostapd
instance though because in static_test.py we test ACD and we need to
produce an IP conflict.  Moving the hostapd instance unexpectedly fixes
dhcpd's internal mechanism to avoid IP conflicts and it would no longer
assign 192.168.1.10 to the second client, it'd notice that address was
already in use and assign the next free address, or fail if there was
none.  So add a second hostapd instance that runs in the main namespace
together with the statically-configured client, it turns out the test
relies on the kernel being unable to deliver IP traffic to interfaces on
the same system.
2022-07-12 12:47:09 -05:00
James Prestwood
ac8e9f53f2 auto-t: add client test to testAP
Tests iwctl functionality with ap commands
2022-06-30 13:38:02 -05:00
James Prestwood
d1c5e42ae2 auto-t: refactor testAP to reuse code
All the AP tests were basically doing the same validation. Refactor
this code into validation.py and import that into the tests.
2022-06-30 13:38:02 -05:00
James Prestwood
0d953f22e4 auto-t: add client test to testDPP
Tests iwctl functionality with dpp commands
2022-06-30 13:38:02 -05:00
James Prestwood
d6c129a30b auto-t: add client test to testAdHoc
Tests iwctl functionality with ad-hoc commands
2022-06-30 13:38:02 -05:00
James Prestwood
ac2aee288f auto-t: add client test to testEAP-WPS
Tests iwctl functionality with wsc commands
2022-06-30 13:38:02 -05:00
James Prestwood
d127c5b997 auto-t: add client test to testKnownNetworks
Tests iwctl functionality with known-networks command
2022-06-30 13:38:02 -05:00
James Prestwood
de1f078897 auto-t: iwd.py: add DPP properties 2022-06-30 13:38:02 -05:00
James Prestwood
5b58390b8d auto-t: fix unpredictability/pointless test from testAgent
testAgent had a few tests which weren't reliable, and one was not
actually testing anything, or at least not what the name implied it
should be testing.

The first issue was using iwctl in the first place. There is not a
reliable way to know when iwctl has registered its agent so relying on
that with a sleep, or waiting for the service to become available isn't
100% fool proof. To fix this use the updated PSKAgent which allows
multiple to be registered. This ensures the agent is ready for requests.
This test was also renamed to be consistent with what its actually
testing: that IWD uses the first agent registered.

This removes test_connection_with_other_agent as well because this test
case is covered by the client test itself. There is no need to re-test
iwctl's agent functionality here.
2022-06-29 13:18:29 -05:00
James Prestwood
01ae1a9d88 auto-t: allow multiple PSKAgent's to be registered
By creating a new bus connection for each agent we can register multiple
with IWD. This did mean the agent interface needs to be unique for each
agent (removing _agent_manager_if) as well as tracking multiple agents
in a list.
2022-06-29 13:18:00 -05:00
Andrew Zaborowski
b878be31ae autotests: In testNetconfig verify routes from RIOs
Verify that IWD with NetworkConfigurationEnabled creates the off-link
routes for Route Information Options in the Router Advertisements.
2022-06-27 13:11:28 -05:00
James Prestwood
cfb782cfff auto-t: remove sleep in testAgent
The test here is verifying that a DBus Connect() call will still
work with 'other' agents registered. In this case it uses iwctl to
set a password, then call Connect() manually.

The problem here is that we have no way of knowing when iwctl fully
starts and registers its agent. There was a sleep in there but that
is unreliable and we occationally were still getting past that without
iwctl having started fully.

To fix this properly we need to wait for iwctl's agent service to appear
on the bus. Since the bus name is unknown we must first find all names,
then cross reference their PID's against the iwctl PID. This is done
using ListNames, and GetConnectionUnixProcessID APIs.
2022-06-24 18:11:49 -05:00
James Prestwood
267feb94b0 auto-t: fix rekey/reauth logic in a few ways
The rekey/reauth logic was broken in a few different ways.

For rekeys the event list was not being reset so any past 4-way
handshake would allow the call to pass. This actually removes
the need for the sleep in the extended key ID test because the
actual handshake event is waited for correctly.

For both rekeys and reauths, just waiting for the EAP/handshake
events was not enough. Without checking if the client got
disconnected we essentially allow a full disconnect and reconnect,
meaning the rekey/reauth failed.

Now a 'disallow' array can be passed to wait_for_event which will
throw an exception if any events in that array are encountered
while waiting for the target event.
2022-06-24 18:11:33 -05:00
James Prestwood
53e8bf4cb0 auto-t: fix testEncryptedProfiles mtime check
Yet another weird UML quirk. The intent of this tests was to ensure
the profile gets encrypted, and to check this both the mtime and
contents of the profile were checked.

But under UML the profile is copied, IWD started, and the profile
is encrypted all without any time passing. The (same) mtime was
then updated without any changes which fails the mtime check.

This puts a sleep after copying the profile to ensure the system
time differs once IWD encrypts the profile.
2022-06-24 18:11:15 -05:00
James Prestwood
1ecadc3952 test-runner: fix UML blocking on wait_for_socket/service
In UML if any process dies while test-runner is waiting for the DBus
service or some socket to be available it will block forever. This
is due to the way the non_block_wait works.

Its not optimal but it essentially polls over some input function
until the conditions are met. And, depending on the input function,
this can cause UML to hang since it never has a chance to go idle
and advance the time clock.

This can be fixed, at least for services/sockets, by sleeping in
the input function allowing time to pass. This will then allow
test-runner to bail out with an exception.

This patch adds a new wait_for_service function which handles this
automatically, and wait_for_socket was refactored to behave
similarly.
2022-06-24 18:11:10 -05:00
James Prestwood
d7136483c3 auto-t: fix timing issue in testEncryptedProfiles
test_decryption_failure is quite simple and only verifies that a known
network exists after starting. This causes the test to end before IWD can
fully start up leaving the DBus utilities in limbo having not fully
initialized.

Then, on the next test, stale InterfaceAdded signals arrive (for Station
and P2P) which throw exceptions when trying to get the bus (since IWD is
long gone). In addition the next IWD instance has started so any paths
included in the InterfaceAdded signals are bogus and cause additional
exceptions.

At the end of this test we can call list_devices() which will wait for
the InterfaceAdded signal, and cleanly exit afterwards.
2022-06-22 18:42:40 -05:00
James Prestwood
f4279ebf53 auto-t: fix hardcoded 'wlan1' in testNetconfig
This works, if testNetconfig is the only test. Otherwise it will always
fail since the interface naming increments for each test.
2022-06-22 18:37:15 -05:00
James Prestwood
72fac7f1b8 auto-t: rename testHiddenNetwork's test class
This was copy pasted from the autoconnect test, and depending on
how the python module cache is ordered can incorrectly use the
wrong test class. This should nothappen because we insert
the paths to the head of the list but for consistency the class
should be named something that reflects what the test is doing.
2022-06-22 18:37:15 -05:00
Andrew Zaborowski
2c0bb06d1a auto-t: Verify DNS entries added from DHCP/static
Add a fake resolvconf executable to verify that the right nameserver
addresses were actually committed by iwd.  Again use unique nameserver
addresses to reduce the possibility that the test succeeds by pure luck.
2022-06-22 15:57:36 -05:00
Andrew Zaborowski
c4fe900a71 auto-t: In testNetconfig verify routes created
Check that the right set of routes is being added for IPv4 and IPv6.
Chane gateway addresses to differ from the AP or dhcpd addresses.
2022-06-22 15:57:22 -05:00
Andrew Zaborowski
c65b2ec317 auto-t: In testNetconfig add static IPv6, add comments
In static_test.py add IPv6.  Add comments on what we're actually testing
since it wasn't very clear.  After the expected ACD conflict detection,
succeed if either the lost address was removed or the client disconnected
from the AP since this seems like a correct action for netconfig to
implement.
2022-06-22 15:57:09 -05:00
Andrew Zaborowski
a46707a595 auto-t: Ensure storage_dir exists, clean up
In iwd.py make sure all the static methods that touch IWD storage take the
storage_dir parameter instead of hardcoding IWD_STORAGE_DIR, and make
sure that parameter is actually used.

Create the directory if it doesn't exist before copying files into it.
This fixes a problem in testNetconfig where

`IWD.copy_to_storage('ssidTKIP.psk', '/tmp/storage')`

would result in /tmp/storage being created as a file, rather than a
directory containing a file, and resulting in IWD failing to start with:

`Failed to create /tmp/storage`

runner.py creates /tmp/iwd but that doesn't account for IWD sessions
with a custom storage dir path.
2022-06-22 15:56:57 -05:00
Andrew Zaborowski
57888632a3 auto-t: Validate netmasks in testNetconfig, add utility
Extend test_ip_address_match to support IPv6 and to test the
netmask/prefix length while it reads the local address since those are
retrieved using the same API.

Modify testNetconfig to validate the prefix lengths, change the prefix
lengths to be less common values (not 24 bits for IPv4 or 64 for IPv6),
minor cleanup.
2022-06-22 15:56:35 -05:00
Andrew Zaborowski
8237264848 autotests: Drop unused file+directory 2022-06-17 14:13:33 -05:00
Andrew Zaborowski
cb6289b622 auto-t: Work around wpa_s config issue in testP2P
Since commit 922fa099721903b106a7bc1ccd1ffe8c4a7bce69 in hostap, our
setting of config_methods on P2P-client interface was ignored.  Work
around that commit, in addition to the previous workaround we have in
this test, to again ensure the correct config_methods value is used.
2022-06-06 10:39:00 -05:00
James Prestwood
0545dbcf24 auto-t: remove ifconfig call from testScan
ifconfig isn't available by default in several linux distros
so instead use 'ip' which seems to be much more widespread.
2022-06-03 11:59:07 -05:00
James Prestwood
df46776046 auto-t: allow skipping tests is wpa_supplicant is not found
Similarly to ofono/phonesim allow tests to be skipped if wpa_supplicant
is not found on the system.

This required some changes to DPP/P2P where Wpas() should be called first
since this can now throw a SkipTest exception.

The Wpas class was also made to allow __del__ to be called without
throwing additional exceptions in case wpa_supplicant was not found.
2022-06-02 16:47:02 -05:00
James Prestwood
1296e4eacb auto-t: allow wildcard phase1 for EAP tests
This allows the EAP tests to pass, but the fix really needs to be in
hostapd itself. Hostapd currently tries to lookup the EAP session
immediately after receiving EAPOL_REAUTH. This uses the identity
it has stored which, in the case of PEAP/TTLS, will always be a phase2
identity. During this initial lookup hostapd hard codes the identity
to be phase1 which is not true for PEAP/TTLS, and the lookup fails.
2022-06-01 11:02:01 -05:00
James Prestwood
e2aca6e917 auto-t: correctly import Mapping from collections
The current way this was being done was to import collections and
use collections.Mapping. This has been deprecated since python 3.3
but has worked up until python 3.10. After python 3.10 this will
no longer work, and Mapping must be imported from collections.abc.
2022-06-01 11:01:50 -05:00
James Prestwood
7290989e15 auto-t: add EAP reauth to testEAP 2022-05-26 11:24:56 -05:00
James Prestwood
a18c6e10a7 auto-t: fix eapol_reauth utility
This was passing IFNAME= along with EAPOL_REAUTH which does not work
in the context of a hostapd socket where the iface is already implied.
This fixes that issue as well as resets the events array and actually
waits for the required events afterwards.
2022-05-26 11:24:52 -05:00
James Prestwood
0e77e33a4d auto-t: fix testRSSIAgent after signal agent changes
The signal agent notifications were changed which breaks this test.
Specifically commit ce227e7b94 sends a notification when connected
which breaks the 'agent.calls' check. Since this check is done both
after connecting and once already connected the initial value may
be 1 or 0. Because of this that check was removed entirely.
2022-05-25 15:00:06 -05:00
James Prestwood
e000eff492 auto-t: use copy_to_storage in address randomization test
This test was just piping the PSK files into /tmp/iwd/ssidCCMP.psk
which is a bit fragile if the storage dir was ever to change. Instead
use copy_to_storage and the 'name' keyword to copy the file.
2022-05-25 15:00:06 -05:00
Denis Kenzior
503ce2e488 auto-t: Use NameResolvingService=none
Since this test isn't actually running name resolving service of any
kind, use NameResolvingService=none to quiet down the logs.
2022-05-20 10:15:17 -05:00
Denis Kenzior
f3c633e222 auto-t: Add EAPoL spoofing test
Make sure that unencrypted EAPoL packets received after the initial
handshake is complete do not break the connection.
2022-05-11 17:23:54 -05:00
Denis Kenzior
e44ccf3daa auto-t: Rework spoofing code
Use scapy library which allows one to easily construct and fudge various
network packets.  This makes constructing spoofed packets much easier
and more readable compared to hex-encoded, hand-crafted frames.
2022-05-11 17:20:30 -05:00
Denis Kenzior
2019823443 auto-t: Fix TA/BSSID addresses of spoofed disassoc
The TA/BSSID addresses of spoofed disassociate frames were set
incorrectly.  They should be using the 02:00:00:XX:XX:XX address, but
instead were being converted over to 42:00:00:XX:XX:XX address
2022-05-11 14:05:51 -05:00
James Prestwood
5caeb82d61 auto-t: disable update_config for testDPP
update_config=1 lets wpa_supplicant write config changes
to the config file. In the real world this is what you want
so your DPP credentials are persistant. But for testing this
is not correct since multiple tests use the same config file
and expect it to be pristine.

Occationally wpa_supplicant was connecting to the AP without
running DPP because the config already had the network
credentials.
2022-04-15 12:17:29 -05:00
James Prestwood
1a903001f9 auto-t: cleanup the few uses of is_verbose
These were used outside of run-tests in a couple places. Replace
these with Process.is_verbose()
2022-04-06 14:47:32 -05:00
James Prestwood
197368dcfc auto-t: hwsim.py: set NoVirtualInterface by default
There is really no reason to have hwsim create interfaces automatically
for test-runner. test-runner already does this for wpa_supplicant and
hostapd, and IWD can create the interface itself.
2022-04-05 13:33:35 -05:00
James Prestwood
57ae02ab71 auto-t: delay rekeys in extended key ID test
The test was rekeying in a loop which ends up confusing hostapd
depending on the timing of when it gets the REKEY command and any
responses from IWD. UML seemed to handle this fine but not QEMU.

Instead delay the rekey a bit to allow it to fully complete before
sending another.
2022-04-04 11:14:26 -05:00
James Prestwood
5c7f34d66b auto-t: iwd.py: use IO watch for station debug events
Similarly to hostapd.wait_for_event, IWD's variant needed to act on
an IO watch because events were being received prior to even calling
wait_for_event.
2022-03-31 18:13:02 -05:00
James Prestwood
31b5275c1f auto-t: hostapd.py: use IO watch for hostapd events
With how fast UML is hostapd events were being sent out prior to
ever calling wait_for_event. Instead set an IO watch on the control
socket and cache all events as they come. Then, when wait_for_event
is called, it can reference this list. If the event is found any
older events are purged from the list.

The AP-ENABLED event needed a special case because hostapd gets
started before the IO watch can be registered. To fix this an
enabled property was added which queries the state directly. This
is checked first, and if not enabled wait_for_event continues normally.
2022-03-31 18:12:59 -05:00
James Prestwood
dbd6ddfc95 auto-t: cleanup testRRM
This removes prints which were never supposed to make it upstream as
well as changes sleep() to wd.wait() as well as increase the wait
period to fix issues with how fast UML runs the tests.
2022-03-31 18:12:56 -05:00
James Prestwood
95ad47bd98 auto-t: wait for roam events in proper order
These were out of order and would sometimes fail the check.
2022-03-31 18:12:53 -05:00
James Prestwood
1e56898606 auto-t: fix testBSSBlacklist typo
The property is 'enabled' not 'enable'
2022-03-31 18:12:49 -05:00
James Prestwood
040b8c2d5f auto-t: use full_scan=True on testBSSBlacklist
This test was missed during the test-wide change.
2022-03-30 16:16:49 -05:00
James Prestwood
fa366c79e4 auto-t: test-wide replacement of assertTrue(list_sta())
Any test using assertTrue(hostapd.list_sta()) improperly has been
replaced with wait_for_event(). There were a few places where this
was actually ok (i.e. IWD is already connected) but most needed to
be changed since the check was just after IWD connected and hostapd's
list_sta() API may not return a fully updated list.
2022-03-30 15:26:44 -05:00
James Prestwood
416ad05ce7 auto-t: fix up a few issues in testNetconfig
- Setting the IP address was resulting in an error:

   Error: any valid prefix is expected rather than "wln58".

   This is fixed by reordering the arguments with the IP address first

 - Remove the sleep, and use non_block_wait to wait for the IPv6 address
   to be set.
2022-03-30 15:26:42 -05:00
James Prestwood
b1bc8fb7fb auto-t: testSAE-roam: wait for ip link down
Before setting the address, wait for the interface to go down. This
fixes somewhat rare cases where setting the address returns -EBUSY
and ultimately breaks the neighbor reports.
2022-03-30 15:26:39 -05:00
James Prestwood
1fca13f07a auto-t: testutil: wait for operstate
Depending on timing the operstate may not be set even when IWD shows
as connected. Instead wait for the operstate to become set.
2022-03-30 15:26:36 -05:00
James Prestwood
a773aa6a07 auto-t: remove direct scan() call when possible
All tests which could avoid calling scan() directly have been
changed to use the 'full_scan' argument to get_ordered_network.

This was done because of unreliable scanning behavior on slower
systems, like VMs. If we get unlucky with the scheduler some beacons
are not received in time and in turn scan results are missing.
Using full_scan=True works around this issue by repeatedly scanning
until the SSID is found.
2022-03-30 15:25:55 -05:00
James Prestwood
cc9f8d7489 auto-t: don't wait for wpa_supplicant to connect
When configuring wpa_supplicant all we care about is that it
received the configuration object. wpa_supplicant takes quite a bit
of time to connect in some cases so waiting for that is unneeded.

This also increases the DPP timeout which may be required on slower
systems or if the timing is particularly unlucky when receiving
frames.
2022-03-28 12:38:15 -05:00
James Prestwood
f717480c18 auto-t: do a full scan when getting network
This ensures the network will be scanned for again if not found.
2022-03-28 12:38:15 -05:00
James Prestwood
12c77ef647 auto-t: use wait_for_event in testPSK-roam
Depending on timing hostapd may not show a station with list_sta()
Instead use wait_for_event
2022-03-28 12:38:15 -05:00
James Prestwood
51d4e14440 auto-t: do full scan for testSAE
This will ensure the IWD scans until the network is found.
2022-03-28 12:38:15 -05:00
James Prestwood
c852892426 auto-t: use wait_for_event in testSAE-roam
Depending on timing hostapd may not show a station with list_sta().
Instead use wait_for_event.
2022-03-28 12:38:15 -05:00
James Prestwood
2ee4e95193 auto-t: use wait_for_event in testBSSBlacklist
Depending on timing hostapd may not show a station with list_sta().
Instead use wait_for_event.
2022-03-28 12:38:15 -05:00
James Prestwood
f1a7e23eea auto-t: fixup testRoamRetry for better timing reliability
Change a few critical checks that were failing sometimes:
 - A few asserts were changed to wait_for_object_condition
 - A 15 second timeout was removed (default used instead)
 - Do a full scan at beginning of each test to clear any
   cached BSS's. The second test run was getting stale results
   and the RSSI values were not expected.
2022-03-28 12:38:15 -05:00
James Prestwood
6e608b14f5 auto-t: iwd.py: fix full_scan argument
This was not being properly honored when existing networks were
already populated. This poses an issue for any test which uses
full_scan after setting radio values such as signal strength.
2022-03-28 12:38:15 -05:00
James Prestwood
327f719f91 auto-t: remove waitstatus_to_exitcode for better compatibility
This was added in Python 3.9 which isn't always supported. Instead use
the subprocess module which automatically checks the command output.
2022-03-28 12:38:15 -05:00
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