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

6089 Commits

Author SHA1 Message Date
James Prestwood
3adb91fc9e auto-t: iwd.py: allow renaming in copy_to_storage
By providing a 'name' keyword argument the file copied will be
renamed to that.
2021-08-13 14:54:53 -05:00
James Prestwood
78f5a5dde4 auto-t: speed up testRoamRetry
This test took quite a while to execute (~2 minutes on my machine)
because there was simply no other way to test this scenario but
waiting. Now the no-roam-candidates condition can be waited for
rather than just sleeping for 20 seconds. Additionally the default
RoamRetryInterval was being used which is 60 seconds. Instead
main.conf can set this to 5 seconds and really cut down on the time
to wait.

Part of a comment was also removed due to being incorrect. Even
with neighbor reports IWD still must scan, its just that the
scan is more limited and, in theory, faster.
2021-08-13 14:45:14 -05:00
James Prestwood
36777d1e68 auto-t: iwd.py: add StationDebug.Event support
Adds a new wait_for_event API which waits for a StationDebug.Event.
2021-08-13 14:45:12 -05:00
James Prestwood
cd2dd4e2dc station: Add generic Event signal
This is meant to be used as a generic notification to autotests. For
now 'no-roam-candidates' is the only event being sent. The idea
is to extend these events to signal conditions that are otherwise
undiscoverable in autotesting.
2021-08-13 14:44:24 -05:00
James Prestwood
b705a579ad auto-t: ead.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
5ebbe07fa6 auto-t: hostapd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
732871b601 auto-t: iwd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
80ee406e3e auto-t: ofono.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
4e3cedc901 test-runner: wait for individual hostapd control sockets 2021-08-13 11:16:19 -05:00
James Prestwood
23cf6cb2e4 test-runner: implement non_block_wait
There was a common bit of code all over test-runner and utilities
which would wait for 'something' in a loop. At best these loops
would do the right thing and use the GLib.iteration call as to not
block the main loop, and at worst would not use it and just busy
wait.

Namespace.non_block_wait unifies all these into a single API to
a) do the wait correctly and b) prevent duplicate code.
2021-08-13 11:16:19 -05:00
Andrew Zaborowski
2af0166970 ap: Make station removal safer
Replace instances of the ap_del_station() +
ap_sta_free()/ap_remove_sta() with calls to ap_station_disconnect to
make sure we consistently remove the station from the ap->sta_states
queue before using ap_del_station().  ap_del_station() may generate an
event to the ap.h API user (e.g. P2P) and this may end up tearing down
the AP completely.

For that scenario we also don't want ap_sta_free() to access sta->ap so
we make sure ap_del_station() performs these cleanup steps so that
ap_sta_free() has nothing to do that accesses sta->ap.
2021-08-13 10:49:28 -05:00
Andrew Zaborowski
97a34e6b4a ap: Fix an invalid access in ap_write_wsc_ie
client_frame is not valid for a beacon frame as beacons are not sent in
response to another frame.  Move the access to client_frame->address_2
to the conditional blocks for Probe Response and Association Response
frames.
2021-08-13 10:49:28 -05:00
Andrew Zaborowski
5c9de0cf23 eapol: Store IP address in network byte order
Switch handshake_state's .client_ip_addr, .subnet_mask and .go_ip_addr
from host byte order to network by order.
2021-08-13 10:47:05 -05:00
James Prestwood
541dca499a auto-t: hostapd.py: remove get_freq()/get_config_value() 2021-08-13 10:46:21 -05:00
James Prestwood
876ac5f569 auto-t: use .frequency property in SAQuery-spoofing test 2021-08-13 10:46:18 -05:00
James Prestwood
7a74a825a4 auto-t: iwd.py: scan only on needed frequencies
get_ordered_network() now scans automatically and has been updated
to use the StationDebug.Scan() API rather than doing a full
dbus scan (unless full_scan = True). The frequencies to be scanned
are picked automatically based on the current hostapd status
(hidden behind ctx.hostapd.get_frequency()).
2021-08-13 10:46:16 -05:00
James Prestwood
57933425ca test-runner: start HostapdCLI from test-runner
This gives the benefit of test-runner itself having access to
the CLI, e.g. for getting status information.
2021-08-13 10:46:13 -05:00
James Prestwood
c7466cd56a auto-t: add python API for StationDebug.Scan 2021-08-13 10:46:10 -05:00
James Prestwood
dffff73e89 station: implement Scan on debug interface
This is to support the autotesting framework by allowing a smaller
scan subset. This will cut down on the amount of time spent scanning
via normal DBus scans (where the entire spectrum is scanned).
2021-08-13 10:44:26 -05:00
James Prestwood
ba6c8174d2 test-runner: run individual test functions manually
While losing the convenience of unittest this patch breaks out
each individual test function in order to run it manually and
get results. This vastly improves the user experience by seeing
which test file and function is being executed rather than simply
seeing "PASSED" for the entire test set.

In addition exceptions/failures are printed out as they happen
rather than at the end.
2021-08-13 10:43:47 -05:00
James Prestwood
89bddf551a test-runner: pass **kwargs in dbg() 2021-08-13 10:43:47 -05:00
James Prestwood
c23c37c07c test-runner: print uncaught test exceptions always 2021-08-13 10:43:47 -05:00
James Prestwood
ea3ce7a119 station: set autoconnect via setter
This updates the autoconnect property for the debug interface
2021-08-13 10:41:25 -05:00
James Prestwood
836f0d9a08 auto-t: set autoconnect=True for tests that need it
After the default behavior was changed to disable autoconnect there
were several tests which still needed it to be turned on.
2021-08-12 16:59:05 -05:00
James Prestwood
a15b781feb auto-t: update all tests to remove bad scanning logic
This changes all tests to use the default get_ordered_network behavior
rather than some custom or incorrect logic. Any use of
scan_if_needed=True has been removed since this is now the default.
Also any explicit scanning has been removed for tests which do not
require it (where the default behavior is good enough).
2021-08-12 16:59:03 -05:00
James Prestwood
89c1ec3d79 auto-t: make hwsim registration off by default
With the addition of connect_bssid/roam very few tests actually
require hwsim. Since hwsim can lead to problems with scan results
its best to have it off by default and have each test that needs
it explicitly turn it on.

Tests which previously turned it off have had that option removed.

Tests that do require hwsim still are vulnerable to scan result
problems, so for these tests beacon_int was added to the hostapd
config which seems to help with reliability somewhat.
2021-08-12 16:59:01 -05:00
James Prestwood
5519faecba auto-t: iwd.py: make scan_if_needed True by default
There is a common block of code in nearly every test which is incorrect,
most likely a copy-paste from long ago. It goes something like:

wd.wait_for_object_condition(device, 'not obj.scanning')
device.scan()
wd.wait_for_object_condition(device, 'not obj.scanning')

network = device.get_ordered_network("ssid")

The problem here is that sometimes the scanning property does not get
updated fast enough before device.scan() returns, meaning get_ordered_network
comes up with nothing. Some tests pass scan_if_needed=True which 'fixes'
this but ends up re-scanning after the original scan finishes.

To put this to rest scan_if_needed is now defaulted to True, and no
explicit scan should be needed.
2021-08-12 16:58:39 -05:00
James Prestwood
4f5010f69d auto-t: iwd.py: add autoconnect property/StationDebug 2021-08-12 16:58:30 -05:00
James Prestwood
f6f08f9b96 station: disable autoconnect when in developer mode
Most autotests do not want autoconnect behavior so it is being
turned off by default. There are a few tests where it is needed
and in these few cases the test can enable autoconnect through
the new station debug property.
2021-08-12 16:53:58 -05:00
James Prestwood
249a1ef1c0 station: make autoconnect settable via debug interface
This adds the property "AutoConnect" to the station debug interface
which can be read/written to disable or enable autoconnect globally.
As one would expect this property is only going to be used for testing
hence why it was put on the debug interface. Mosts tests disable
autoconnect (or they should) because it leads to unexpected connections.
2021-08-12 15:57:00 -05:00
James Prestwood
7af6aac440 auto-t: use connect_bssid in APRoam
In addition the send_bss_transition call was updated to only send a
single BSS. By sending two BSS's IWD is left to pick whichever one
it wants which makes the test behavior undefined.
2021-08-12 15:14:07 -05:00
James Prestwood
6e331efbda auto-t: update testPreauth-roam to use connect_bssid/roam() 2021-08-12 15:14:07 -05:00
James Prestwood
1addaf3355 auto-t: remove FT-over-DS test, and rename testFT-PSK-roam 2021-08-12 15:14:07 -05:00
James Prestwood
20f7907436 auto-t: use connect_bssid/roam APIs in testFT-PSK-roam
This also adds FT-over-DS into this test, as well as a reassociation
test for good measure.
2021-08-12 15:14:07 -05:00
James Prestwood
49eb17973e auto-t: remove testFT-FILS-SHA384 2021-08-12 15:14:07 -05:00
James Prestwood
85759a6f3c auto-t: rename testFT-FILS-SHA256 to testFT-FILS 2021-08-12 15:14:07 -05:00
James Prestwood
3800f991b2 auto-t: combine testFT-FILS* tests
This combines the SHA256 and SHA384 tests into one, as well as
utilizes the new connect_bssid() and roam() APIs for much faster
test execution.
2021-08-12 15:14:07 -05:00
James Prestwood
7d0cbf15bc auto-t: update testFT-8021x-roam to use roam() API 2021-08-12 15:14:07 -05:00
James Prestwood
5bf614a7af auto-t: add reassociation test for OWE
The timeout test was also modified to handle the additional
radio.
2021-08-12 15:14:07 -05:00
James Prestwood
e819ee6df6 auto-t: rename testFT-SAE-roam to testSAE-roam
Since reassociation is now tested this name fits better
2021-08-12 15:14:07 -05:00
James Prestwood
15236f30db auto-t: add reassociate test to FT-SAE-roam
This refactors to test both FT and reassociation.
2021-08-12 15:14:07 -05:00
James Prestwood
77d5b57e9e auto-t: iwd.py: add roam() method
This will use the Roam() developer method to force a roam to
a certain BSS. This is particularly useful for any test requiring
roams that are not testing IWD's BSS selection logic. Rather than
creating hwsim rules, setting low RSSI values, and waiting for the
roam logic/scan to happen Roam() can be used to force the roam
logic immediately.
2021-08-12 15:14:07 -05:00
James Prestwood
3402f5994b auto-t: iwd.py: add connect_bssid() method
Python API for ConnectBssid() developer method
2021-08-12 15:14:07 -05:00
James Prestwood
518808c709 auto-t: testutil.py: add expect_fail flag
Several tests tests for connectivity with the expectation that it
will fail. This ends up taking 30+ seconds because testutil retries
3 times, each with a 10 second timeout. By passing expect_fail=True
this lowers the timeout to zero, and skips any retries.
2021-08-12 15:14:07 -05:00
James Prestwood
30158fe89c test-runner: don't run duplicate tests
If the user provides duplicate tests in the list only append one
of them to the list. This can happen accidentally when using
glob matches.
2021-08-12 15:14:07 -05:00
James Prestwood
9a15a46df5 test-runner: don't fatally exit on bad test configuration
If a test has no hw.conf file test-runner was fully exiting and not
running any additional tests. This shouldn't happen in practice
since all upstreamed tests should run, but if any locally created
tests existed like this, it would cause the entire test run to exit
early.

Instead raise an exception which bails out of only that test, and
allows the rest to continue.
2021-08-12 15:14:07 -05:00
James Prestwood
8203b1d542 test-runner: start IWD in developer mode
This is being done to utilize the Roam() developer method
2021-08-12 15:14:07 -05:00
James Prestwood
80123efabd auto-t: hostapd.py: add 'bssid' property
This gets the APs BSSID, bypassing the need to use hwsim
for obtaining this address.
2021-08-12 15:14:07 -05:00
James Prestwood
7321705e90 test: update force-roam to use Debug interface 2021-08-12 14:59:26 -05:00
James Prestwood
77c4d311ff station: move Roam() under station debug interface 2021-08-12 14:59:19 -05:00