3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-15 16:39:24 +01:00
Commit Graph

736 Commits

Author SHA1 Message Date
James Prestwood
f81855349a auto-t: add SAE-H2E test for setting the default ECC group 2024-08-12 16:19:16 -05:00
James Prestwood
f9a55e3728 auto-t: fix several DPP tests after station state changes
After the station state changes in DPP setting autoconnect=True was
causing DPP to stop prior to being able to scan for the network.
Instead we can start autoconnect earlier so we aren't toggling the
property while DPP is running.
2024-07-24 15:26:57 -05:00
James Prestwood
a63fd6abb9 auto-t: add DPP tests for state change checks 2024-07-24 15:26:55 -05:00
James Prestwood
06c8080664 auto-t: a few random autotest fixes
testEncryptedProfiles:
 - This would occationally fail because the test is expecting
   to explicitly connect but after the first failed connection
   autoconnect takes over and its a race to connect.
testPSK-roam:
 - Several rules were not being cleaned up which could cause
   tests afterwards to fail
 - The AP roam test started failing randomly because of the SNR
   ranking changes. It appears that with hwsim _sometimes_ the
   SNR is able to be determined which can effect the ranking. This
   test assumed the two BSS's would be the same ranking but the
   SNR sometimes causes this to not be true.
2024-07-18 16:08:46 -05:00
James Prestwood
b7da34a5d2 auto-t: Add deauth during the 4-way handshake test
This test will fail with current upstream as IWD hangs when the
deauthenticate event arrives. Once this is fixed the test should
pass.
2024-07-18 16:08:43 -05:00
James Prestwood
a972b77dc2 auto-t: add reason/test arguments to hostapd deauthenticate
The reason code is obvious, but the test argument is actually a
toggle to send the frame encrypted or unencrypted.
2024-07-18 16:08:40 -05:00
James Prestwood
d27de1b111 auto-t: add clear_events() to IWD class
The wait_for_event() function allows past events to cause this
function to return immediately. This behavior is known, and
relied on for some tests. But in some cases you want to only
handle _new_ events, so we need a way to clear out prior events.
2024-07-18 16:08:36 -05:00
James Prestwood
9232991e25 auto-t: add test for a deauth coming in during an FT-roam 2024-06-26 09:38:06 -05:00
James Prestwood
31b18a8c8b auto-t: add test for deauth after authentication
This code path is not exercised in the autotest but commonly does
happen in the real world. There is no associated bug with this, but
its helpful to have this event triggered in case something got
introduced in the future.
2024-06-26 09:38:06 -05:00
James Prestwood
4bfc794a37 auto-t: remove default group SAE test for specific OUI
There are already tests for UseDefaultEccGroup and this test is
not longer valid as the static OUI list has been removed.
2024-05-14 10:26:17 -05:00
James Prestwood
816d258cab auto-t: Add frame fuzzing test
Add a test to validate a crash found by Alex Radocea when sending
a fuzzed beacon frame.

Co-authored-by: Alex Radocea <alex@supernetworks.org>
2024-02-29 14:32:33 -06:00
James Prestwood
cdbd59103e auto-t: fix netconfig to handle resolvconf values out of order
The slaac_test was one that would occationally fail, but very rarely,
due to the resolvconf log values appearing in an unexpected order.

This appears to be related to a typo in netconfig-commit which would
not set netconfig-domains and instead set dns_list. This was fixed
with a pending patch:

https://lore.kernel.org/iwd/20240227204242.1509980-1-denkenz@gmail.com/T/#u

But applying this now leads to testNetconfig failing slaac_test
100% of the time.

I'm not familiar enough with resolveconf to know if this test change
is ok, but based on the test behavior the expected log and disk logs
are the same, just in the incorrect order. I'm not sure if this the
log order is deterministic so instead the check now iterates the
expected log and verifies each value appears once in the resolvconf
log.

Here is an example of the expected vs disk logs after running the
test:

Expected:

-a wlan1.dns
nameserver 192.168.1.2
nameserver 3ffe:501:ffff💯:10
nameserver 3ffe:501:ffff💯:50
-a wlan1.domain
search test1
search test2

Resolvconf log:

-a wlan1.domain
search test1
search test2
-a wlan1.dns
nameserver 192.168.1.2
nameserver 3ffe:501:ffff💯:10
nameserver 3ffe:501:ffff💯:50
2024-02-28 11:50:54 -06:00
James Prestwood
9f18bf402c auto-t: add OWE test for auto default group 2024-02-27 13:55:37 -06:00
James Prestwood
9d4c34dc7a auto-t: Add test for new SAE default group behavior
Tests the 3 possible options to UseDefaultEccGroup behave as
expected:
 - When not provided use the "auto" behavior.
 - When false, always use higher order groups
 - When true, always use default group
2024-02-27 13:55:37 -06:00
James Prestwood
e296a61e3f auto-t: refactor/fix testSAE
The SAE test made some assumptions on certain conditions due to
there being no way of checking if those conditions were met
Mainly the use of H2E/hunt-and-peck.

We assumed that when we told hostapd to use H2E or hunt/peck it
would but in reality it was not. Hostapd is apparently not very
good at swapping between the two with a simple "reload" command.
Once H2E is enabled it appears that it cannot be undone.
Similarly the vendor elements seem to carry over from test to
test, and sometimes not which causes unintended behavior.

To fix this create separate APs for the specific scenario being
tested:
 - Hunt and peck
 - H2E
 - Special vendor_element simulating buggy APs

Another issue found was that if password identifies are used
hostapd automatically chooses H2E which was not intented, at
least based on the test names (in reality it wasn't causing any
problems).

The tests have also been improved to use hostapds "sta_status"
command which contains the group number used when authenticating,
so now that at least can be verified.
2024-02-27 13:55:37 -06:00
James Prestwood
82161909a1 auto-t: add HostapdCLI.sta_status
Gets information about a specific STA hostapd is tracking. This
object will contain detailed information such as the SAE group
number used.
2024-02-27 13:55:37 -06:00
James Prestwood
c2ef5f3f68 auto-t: add Device.event_ocurred
Checks that an event happened previously, and consumes events. This
is useful for checking that an event did not happen after some
testing operations.
2024-02-27 13:55:37 -06:00
James Prestwood
a507c08bfe auto-t: fix failed_roam_test to pass when run on its own
When running this test with others the hostapd neighbors are already
grouped which lets the test pass. On its own this does not happen
and it fails.
2024-02-22 09:28:55 -06:00
James Prestwood
593c9dee6c auto-t: add netconfig timeout test
Tests that netconfig eventually times out and that IWD disconnects
2024-01-30 14:00:30 -06:00
James Prestwood
1a79092383 auto-t: add test for known frequency sorting/maximum
Modify the existing frequency test to check that the ordering
lines up with the ranking of the BSS.

Add a test to check that quick scans limit the number of known
frequencies.
2024-01-29 20:45:32 -06:00
James Prestwood
5abf54f2dc auto-t: add test for roaming + netconfig
This test ensures IWD will continue to roam and restart netconfig if
roam conditions are met prior to netconfig finishing.
2024-01-08 22:08:53 -06:00
James Prestwood
aaf1d91d51 auto-t: fix random testPSK-roam failure
This was caused by the unused hostapd instance running after being
re-enabled by mistake. This cause an additional scan result with the
same rank to be seen which would then be connected to by luck of the
draw.
2024-01-04 11:59:41 -06:00
James Prestwood
b0ad6158e1 auto-t: improve failure handling in testPSK-roam
This really needs to be done to many more autotests but since this
one seems to have random failures ensure that all the tests still
run if one fails. In addition add better cleanup for hwsim rules.
2024-01-04 11:59:37 -06:00
James Prestwood
0a3797a4d4 auto-t: update roam test to use new debug events 2024-01-04 11:57:32 -06:00
James Prestwood
0f1d9685e7 auto-t: add DPP tests to check extra settings are applied
In order to test that extra settings are applied prior to connecting
two tests were added for hidden networks as well as one testing if
there is already an existing profile after DPP.

The reason hidden networks were used was due to the requirement of
the "Hidden" settings in the profile. If this setting doesn't get
sync'ed to disk the connection will fail.
2023-12-19 19:48:45 -06:00
James Prestwood
60e165095a auto-t: add H2E password identifier test
In order to support identifiers the test profiles needed to be
reworked due to hostapd allowing multiple password entires. You
cannot just call set_value() with a new entry as the old ones
still exist. Instead use a unique password for the identifier and
non-identifier use cases.

After adding this test the failure_test started failing due to
hostapd not starting up. This was due to the group being unsupported
but oddly only when hostapd was reloaded (running the test
individually worked). To fix this the group number was changed to 21
which hostapd does support but IWD does not.
2023-12-15 10:21:01 -06:00
James Prestwood
d756e60f24 auto-t: only call set_value for changed values in default()
The default() method was added for convenience but was extending the
test times significantly when the hostapd config was lengthy. This
was because it called set_value for every value regardless if it
had changed. Instead store the current configuration and in default()
only reset values that differ.
2023-12-13 10:07:23 -06:00
James Prestwood
65a03d8049 auto-t: add association timeout test
This tests ensures IWD disconnects after receiving an association
timeout event. This exposes a current bug where IWD does not
transition to disconnected after an association timeout when
FT-roaming.
2023-12-13 10:07:20 -06:00
James Prestwood
5a426433dd auto-t: add explicit stop() to IWD class
If tests end in an unknown state it is sometimes required that IWD
be stopped manually in order for future tests to run. Add a stop()
method so test tearDown() methods can explicitly stop IWD.
2023-12-13 10:07:18 -06:00
James Prestwood
84d018e722 auto-t: fix SignalAgent Release arguments
The path for IWD to call this doesn't ever happen in autotests
but during debugging of the DPP agent it was noticed that the
DBus signature was incorrect and would always result in an error
when calling from IWD.
2023-12-13 10:06:32 -06:00
James Prestwood
4b147217ac auto-t: add checks for DPP 3rd party settings
Ensure the newly configured profile contains the additional
SendHostname setting that the configurator sends.
2023-11-17 09:49:06 -06:00
James Prestwood
dbce8f9ff9 auto-t: get DPP PKEX test running reliably
Several tests do not pass due to some additional changes that have
not been merged. Remove these cases and add some hardening after
discovering some unfortunate wpa_supplicant behavior.

 - Disable p2p in wpa_supplicant. With p2p enabled an extra device
   is created which starts receiving DPP frames and printing
   confusing messages.
 - Remove extra asserts which don't make sense currently. These
   will be added back later as future additions to PKEX are
   upstreamed.
 - Work around wpa_supplicant retransmit limitation. This is
   described in detail in the comment in pkex_test.py
2023-11-13 09:47:13 -06:00
James Prestwood
13952ff350 auto-t: add stop APIs and fix some issues wpas.py
- wait_for_event was returning a list in certain cases, not the
   event itself
 - The configurator ID was not being printed (',' instead of '%')
 - The DPP ID was not being properly waited for with PKEX
2023-11-13 09:46:58 -06:00
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