Commit graph

4553 commits

Author SHA1 Message Date
Jouni Malinen
0cd4207b52 tests: Avoid a race in wpas_ap_lifetime_in_memory*
Disconnect processing might require some more time with wpa_supplicant
AP mode.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-12-14 11:03:45 +02:00
Jouni Malinen
c26081bf92 tests: Wait for group key handshake before testing Michael MIC failure
Avoid potential race condition in ap_cipher_tkip_countermeasures_ap by
sending the first test frame only after the AP has completed processing
the 4-way handshake and also wait a bit to allow the group key handshake
to be completed.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-12-14 11:02:12 +02:00
Jouni Malinen
7629ac4def tests: Race condition in connect_cmd_concurrent_grpform_while_connecting
Wait for AP to complete connection before running the connectivity test.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-12-12 20:47:16 +02:00
Jouni Malinen
3104d8057e tests: Wait for AP to complete connection before testing connectivity
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-12-12 20:18:57 +02:00
Jouni Malinen
e020a98969 tests: Work around a race condition in p2p_device_grpform_timeout_go
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-12-12 20:14:15 +02:00
Johannes Berg
31792fa8d9 tests: Reset WARN_ON_ONCE() state in the kernel
If a tests hits a WARN_ON_ONCE then the retriggering will make it appear
to pass, since the warning will not happen again. Make this more
reliable by resetting the states at the beginning of each test.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-12-12 19:21:22 +02:00
Johannes Berg
29e998d75e tests: Query carrier before data test
The kernel has an asynchronous work to enable TX, which hasn't always
run by the time we get to TX tests. Do a sysfs read from the carrier
file before TX, on newer kernels this synchronises the needed state.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-12-12 19:21:11 +02:00
Jouni Malinen
8d8205f737 tests: Skip memory read errors in read_process_memory()
It looks like the lifetime_in_memory test cases can hit a read failure
(Errno 5 - Input/output error) every now and then, so skip memory areas
that report that, but go through all readable process memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 21:38:46 +02:00
Jouni Malinen
48bab76ab0 tests: DFS channel switch to VHT80/80+80/160
Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 21:05:01 +02:00
Jouni Malinen
9579d4eff9 tests: Wait for AP/GO event in addition to STA
Wait for AP/GO to complete processing before taking the next step in a
test instead of waiting just for STA. This avoids race conditions with
UML time-travel.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:40:49 +02:00
Jouni Malinen
fe26b7559f tests: Allow more time for DPP Authentication with chirping iteration
Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:40:18 +02:00
Jouni Malinen
a10158a49a tests: Fix wpas_mesh_pmksa_caching_ext to allow lifetime to decrease
The remaining lifetime of the PMKSA entry is decreasing, so need to
allow it to differ between the old and new entries.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:40:18 +02:00
Jouni Malinen
bdb44a2936 tests: Fix the regdom wait in wpas_config_file
In addition, print some more debug information to the log.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:40:18 +02:00
Jouni Malinen
e7d06b508f tests: Avoid race condition in ap_no_auth_ack
Avoid race condition with TX status reporting for the broadcast
Deauthentication frame. This could be delivered after the SET command
for ext_mgmt_frame_handled=1 and as such, could result in an
MGMT-TX-STATUS event that would confuse the next step in the test.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:40:18 +02:00
Jouni Malinen
4c4ba77e65 tests: Avoid race condition in scan_external_trigger
Wait for the externally triggered scan to actually start before issuing
the own scan command to avoid a race condition with UML time-travel.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:40:18 +02:00
Jouni Malinen
45817ad1a3 tests: Clear STA state at the end of ap_ft_reassoc_proto
Do not leave dev[0] in state where it is waiting for
NL80211_CMD_ASSOCIATE to complete since that might deliver an
ASSOC_TIMED_OUT event to the next test case.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:30:44 +02:00
Jouni Malinen
97f7f9ce9b tests: Make dpp_two_initiators more robust
This test case has a race condition between the first and second
initiated DPP exchange. New kernel scheduling with UML time-travel is
making the first exchange complete before the first one can be started.
Making this fully robust would likely need ext_mgmt_frame_handling=1 and
more complex test script, but as an initial workaround, split URI
parsing from dev[2] to happen before dev[1] is started so that only a
single DPP_AUTH_INIT command is needed during the race window.

In addition, detect the race condition and SKIP the test instead of
reporting FAIL.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-10 19:30:44 +02:00
Jouni Malinen
b0fc0154f5 tests: Wait for hostapd event in addition to wpa_supplicant
Wait for hostapd to complete processing before taking the next step in a
test instead of waiting just for wpa_supplicant. This avoids race
conditions with UML time-travel.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 19:02:38 +02:00
Jouni Malinen
37a7b14dd9 tests: Wait for regdom events in wpas_config_file
Make sure the pending regdom changes are processed before returning to
avoid some potential race conditions.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 19:02:38 +02:00
Jouni Malinen
5a4a5aa82d tests: Wait for CTRL-EVENT-REGDOM-CHANGE before starting AP
Wait for the country change to take effect before trying to start
wpa_supplicant AP mode on the 5 GHz band.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 19:02:38 +02:00
Jouni Malinen
e521477a38 tests: Wait a bit after radio work start in dpp_listen()
Even though the radio work has started here, kernel might not have
started ROC (i.e., the REMAIN_ON_CHANNEL event has not yet been
received). Wait a bit to increase likelihood of everything being ready
for the following DPP operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 19:02:38 +02:00
Jouni Malinen
c3c326d2a1 tests: Avoid race condition in RRM beacon report tests
At least with UML time-travel, it is possible for the response frame to
be received before the TX status of the request is delivered. Such a
sequence resulted in run_req_beacon() dropping the response event and
the following step failing due to a missing event. Avoid this by caching
the received response in run_req_beacon() and returning them to the
caller.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 19:02:38 +02:00
Jouni Malinen
0aecf9e62c tests: Make sigma_dut AP SAE tests more robust
Wait some time before requesting disconnection to allow hostapd to
complete 4-way handshake processing. Wait some time after disconnection
has been completed on the STA before trying to use SAE again with the AP
so that hostapd has a chance to complete disconnection with UML
time-travel.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 19:02:38 +02:00
Jouni Malinen
2bbcb9ec13 tests: bgscan_simple and BTM query
Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-09 11:38:21 +02:00
Benjamin Berg
5bbc9462a0 tests: Test driver association ML link rejection flow
The underlying driver can reject only specific links in an association
request. In that case we will only ignore the corresponding BSS. Add a
test for this flow by simulating an association failure on the second
link specifically.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2023-12-06 22:41:40 +02:00
Benjamin Berg
e086ce16a4 tests: Add some MLD association tests
Test ML association, automatic link discovery using ML probe requests
and marking BSSs as failed after an ML association failure, if the
corresponding link also rejected the association.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2023-12-06 22:39:23 +02:00
Andrei Otcheretianski
a02f52a055 tests: Update ML discovery test to also check probe requests
Also check that we can discover BSSs requests using ML probe requests.
Note that this requires a new enough mac80211 which parses the ML probe
request and reports the contained BSSs.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2023-12-06 22:37:14 +02:00
Johannes Berg
a40f64a198 tests: kernel: Add test for regulatory disconnect in cfg80211
Add a test for regulatory disconnect, since that was broken
for quite a while in various ways.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-12-06 12:51:19 +02:00
Jaap Keuter
e8121c52f4 tests: Drop use of ifconfig, use ip instead
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2023-12-06 11:57:57 +02:00
Jouni Malinen
b07f19e082 test: Mesh PMKSA entry validation with MESH_PMKSA_ADD
Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-02 20:32:56 +02:00
Andrei Otcheretianski
d5ef16e987 tests: Add a unit test for RNR/basic ML element parsing
Going through everything to test parsing of the basic ML element and the
RNR element is not really feasible for MBSSID mode. As such, add a unit
test to excercise parsing the available links from the RNR, basic ML
element and MBSSID-Index element if present.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2023-12-02 19:02:02 +02:00
Jouni Malinen
a7fdd58039 tests: Update capability checks to include OpenSSL 3.1 and 3.2
Signed-off-by: Jouni Malinen <j@w1.fi>
2023-12-02 11:22:24 +02:00
Ilan Peer
50526415cb tests: Test GTK rekey in test_eht_mld_link_removal()
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
2023-11-26 17:01:30 +02:00
Ilan Peer
782d897e3c tests: Verify link removal (MLO)
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
2023-11-26 13:25:57 +02:00
Ilan Peer
2a6d094278 tests: Add validation of number of valid and active links for MLO
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2023-11-26 13:03:55 +02:00
Benjamin Berg
a5d5b63d61 tests: Allow specifying multiple failure locations
Having the ability to trigger multiple failures in one test can be
useful. Add support to the test infrastructure to do this.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2023-11-26 12:56:03 +02:00
Benjamin Berg
85c96b7cf7 tests: Fix some incorrect failure waiting calls
These were either sending the command to the wrong
hostapd/wpa_supplicant instance or using the wrong command. This
currently causes the wait to just immediately stop, but with future
commits it would start failing.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2023-11-26 11:26:50 +02:00
Benjamin Berg
6f2289b6b4 tests: Avoid exception string matching for failures
Future commits change the related code and exception string. Avoiding
using the context is easy here and actually avoids two layers of
nesting.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2023-11-26 11:24:00 +02:00
Andrei Otcheretianski
d64ec94140 AP MLD: Don't include AP MLD ID in Beacon frames
IEEE P802.11be/D4.0, 9.4.2.312.2.3 states that the AP MLD ID should only
be included in some ML probe responses. Beacon frames shouldn't include
AP MLD ID.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2023-11-25 18:50:03 +02:00
Johannes Berg
e4f1a48bd2 tests: Give some operations more time
With more channels now available in some regulatory domains, some scan
operations can take longer. Give them more time to complete in tests.

For two cases this required adding a timeout parameter to connect(),
which is then passed through.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-11-24 22:36:58 +02:00
Jouni Malinen
6374bd899c tests: MBSSID beacon protection
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-11-24 12:55:18 +02:00
Jouni Malinen
9ea6e2695d tests: MBSSID with a single SSID and different AKMs
Test functionality in cases where MBSSID is used with a WPA2-Personal
only BSS as the transmitted BSS and WPA3-Personal BSS as the
nontransmitted BSS.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-11-23 23:21:18 +02:00
Jouni Malinen
d883b25760 tests: OWE transition mode disabled on STA and AP using transition mode
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-11-23 20:43:04 +02:00
Benjamin Berg
1bd5e35b87 tests: Disable IPv6 in WNM keep-alive test
Otherwise the station or AP might be doing router advertisements,
causing keep alive already without the mechnism that is being tested.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2023-11-23 11:30:30 +02:00
Jouni Malinen
73e9261c5e tests: Suite B 192-bit level RSA failing (no CS match)
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-11-22 19:42:06 +02:00
Jouni Malinen
86c0fbb6fb tests: WNM Disassociation Imminent and bssid set
Signed-off-by: Jouni Malinen <j@w1.fi>
2023-11-11 23:44:04 +02:00
Jouni Malinen
cab5f5fa7a tests: OWE and BSS entries after multiple scans/associations
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-11-08 14:21:41 +02:00
Jouni Malinen
1af364e3ce tests: AP MLD and GTK rekeying with MLD client connection using two links
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2023-11-06 19:56:41 +02:00
Jouni Malinen
effe5bbff7 tests: Fix DPP test case skipping without CONFIG_DPP
dpp_config_legacy_gen_two_conf_psk and dpp_config_legacy_gen_two_conf
tried to set a DPP parameter before having verified that CONFIG_DPP was
used in the build.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-11-04 18:18:25 +02:00
Jouni Malinen
004f618613 tests: Wait before initiating DPP from thread in sigma_dut testing
Starting a thread to initiate DPP before starting the responder through
sigma_dut can result in unexpected testing behavior since there may not
be enough time to get the responder enabled before timing out som
initiator actions. Wait a second at the beginning of the initiator
thread in dpp_init_conf() similarly to how this was handled in other
initiator-from-thread cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2023-11-04 12:41:02 +02:00