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

703 Commits

Author SHA1 Message Date
James Prestwood
29778733e5 auto-t: add DPP PKEX tests 2023-11-09 10:35:21 -06:00
James Prestwood
6f7384d5c7 auto-t: add APIs for PKEX
Also added some sanity checks to the existing DPP APIs to make
sure started/role gets set correctly.
2023-11-09 10:35:11 -06:00
James Prestwood
809ddcebbd auto-t: add utils for wpa_supplicant PKEX 2023-11-09 10:35:00 -06:00
James Prestwood
c193d36499 auto-t: fix testDPP after Stop() change
Stop() will now return NotFound if DPP is not running. This causes
the DPP test to fail since it calls this regardless if the protocol
already stopped. Ignore this exception since tests end in various
states, some stopped and some not.
2023-11-09 10:20:51 -06:00
James Prestwood
9205308c47 auto-t: add fallback to reassociate test 2023-09-01 23:01:14 -05:00
James Prestwood
927e27b8b5 auto-t: Update tests to use hostapd.default() 2023-08-30 20:41:25 -05:00
James Prestwood
df4d0eef5c auto-t: require a complete hostapd default config
In many tests the hostapd configuration does not include all the
values that a test uses. Its expected that each individual test
will add the values required. In many cases its required each test
slightly alter the configuration for each change every other test
has to set the value back to either a default or its own setting.
This results in a ton of duplicated code mainly setting things
back to defaults.

To help with this problem the hostapd configuration is read in
initially and stored as the default. Tests can then simply call
.default() to set everything back. This significantly reduces or
completely removes a ton of set_value() calls.

This does require that each hostapd configuration file includes all
values any of the subtests will set, which is a small price for the
convenience.
2023-08-30 20:40:55 -05:00
James Prestwood
b1cc4c236b auto-t: fix testNetconfig lease parsing
The parsing code was breaking out of the loop on the first comment
which is incorrect and causes only part of the file to be parsed.
Its odd this hasn't popped up until now but its likely due to
differing dhcpd versions, some which add comments and others that
do not.
2023-06-19 20:54:25 -05:00
James Prestwood
6f7dd97607 auto-t: add comment about FILS rekeys
FILS rekeys were fixed in hostapd somewhat recently but older
versions will fail this test. Document that so we don't get
confused when running tests against older hostapd versions.
2023-06-19 20:54:17 -05:00
James Prestwood
0f5da071fa auto-t: increase timeout in testPSK-roam
This was causing random failures and increasing the timeout seems
to be a lot more reliable.
2023-05-22 09:35:15 -05:00
James Prestwood
563ecc63e8 auto-t: modify PSK-roam test to use FT failure path
This adds another radio so IWD hits the FT failure path after
authentication to the first BSS fails. This causes a wiphy work
item to be rescheduled which previously was unsafe.
2023-05-22 09:35:08 -05:00
James Prestwood
428f1914ef auto-t: update testPSK-roam with changed FT behavior 2022-12-14 16:15:13 -06:00
James Prestwood
ee850422ba auto-t: update test to work with PairwiseCiphers array 2022-11-04 12:04:00 -05:00
James Prestwood
809067c924 auto-t: add test for scanning in AP mode 2022-11-04 12:03:24 -05:00
James Prestwood
9ef440eb8e auto-t: iwd.py: allow certain APIs to be used in AP mode
AP mode implements a few DBus methods/properties which are named
the same as station: Scan, Scanning, and GetOrderedNetworks. Allow
the Device object to work with these in AP mode by calling the
correct method if the Mode is 'ap'.
2022-11-04 12:03:18 -05:00
James Prestwood
b9855f7d62 auto-t: add AP test for all pairwise/group cipher combos
Iterates through every possible cipher combination and verifies the
AP can authenticate the clients.
2022-11-03 09:23:58 -05:00
James Prestwood
13b7aa9715 auto-t: test AP fails to start with unsupported ciphers
If the profile lists unsupported ciphers it should fail to start with
NotSupported.
2022-11-03 09:23:55 -05:00
James Prestwood
ba067fcf94 auto-t: add proper AccessPoint object class
The AP mode device APIs were hacked together and only able to start
stop an AP. Now that the AP interface has more functionality its
best to use the DBus class template to access the full AP interface
capabilities.
2022-11-03 09:23:49 -05:00
James Prestwood
91daa22ed4 auto-t: fix testAP-no-support disabled ciphers
The disabled cipher list contained a '.' instead of ',' which prevented
the subsequent ciphers from being disabled. This was only group management
ciphers so it didn't have any effect on the test.
2022-11-01 15:51:53 -05:00
James Prestwood
4af66b8cac auto-t: test AP mode using TKIP
This limits all supported ciphers to TKIP and verifies the AP
starts and can authenticate clients.
2022-10-27 09:40:41 -05:00
James Prestwood
1f9d9e1eb1 auto-t: allow printing devices in AP mode
The __str__ function assumed station mode which throws an exception
if the device is in AP mode. Fix this as well as print out the mode
the device is in.
2022-10-26 14:19:55 -05:00
James Prestwood
8bc871ba62 auto-t: fix get_ordered_network if hostapd isn't running
This API optimizes scanning to run tests quickly by only scanning
the frequencies which hostapd is using. But if a test doesn't use
hostapd this API raises an uncaught exception.

Check if hostapd is being used, and if not just do a full scan.
2022-10-26 14:19:35 -05:00
Denis Kenzior
60bd973441 auto-t: Add tests for GMAC/GMAC-256/CMAC-256 2022-10-24 11:05:24 -05:00
Denis Kenzior
3f60bd7e63 auto-t: Add GCMP|CCMP-256 to WPA2 test 2022-10-24 11:05:24 -05:00
Denis Kenzior
e30298d957 auto-t: Support multiple pairwise ciphers in WPA2 2022-10-24 11:05:24 -05:00
James Prestwood
0c8f06441e auto-t: speed up testScan
This test was taking about 5 minutes to run, specifically
the requested scan test. One slight optimization is to
remove the duplicate hidden network, since there is no
need for two. In addition the requested scan test was
changed so it does not periodic scan and only issues a dbus
scan.
2022-10-06 14:41:26 -05:00
James Prestwood
2acbe26684 auto-t: speed up testHiddenNetworks
The CI was sometimes taking ~10-15 minutes to run just this
test. This is likely due to the test having 7 radios and
which is a lot of beacons/probes to process.

Disabling the unused hostapd instances drops the runtime down
to about 1 minute.
2022-10-06 14:41:04 -05:00
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