Commit graph

4549 commits

Author SHA1 Message Date
Ilan Peer
b946a800f0 tests: Fix run_eht_mld_sae_two_links()
In the case that the AP MLD is disabled and enabled again, flush
the wpa_supplicant BSS table before reconnecting as otherwise
the previous AP MLD BSSs would be in the BSS table and the wpa_supplicant
would try to connect to them.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
2024-07-12 13:00:46 +03:00
Andrei Otcheretianski
c3b3c506b6 tests: Use different groups in test_sae_no_ffc_by_default
The test assumes that STA will try to reconnect with the same SAE group
after the first authentication attempt is rejected due to unsupported
group. Since this behaviour is fixed in the previous patch, configure
two different groups to trigger the second authentication attempt.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2024-07-12 12:59:26 +03:00
Jouni Malinen
454a22daba tests: SSID verification using beacon protection
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-11 23:55:14 +03:00
Jouni Malinen
d5d0012bfb tests: Verify bigtk_set=1 indication
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-11 23:16:05 +03:00
Jouni Malinen
42c1a512d9 tests: Verify that ssid_verified=1 is set appropriately
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-11 23:04:07 +03:00
Benjamin Berg
7f3fe956d8 tests: Ignore large memory blocks when searching for keys
wpa_supplicant will generally never allocate a memory block of that
size. We can therefore assume that it belongs to ASAN and we need to
ignore it.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-07-11 19:55:48 +03:00
Benjamin Berg
58b2759551 trace: Only permit explicit prefix matching for functions
The matching code currently only tests whether the prefix of a function
matches. Make this more strict by ensuring that the function name is not
longer.

However, as this breaks some tests (due to inlining), add the ability to
do an explicit prefix match by appending a '*' to the function name. Use
this to change the eap_eke_prf match to eap_eke_prf_* in order to match
one of the actual implementations.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-07-11 19:54:50 +03:00
Benjamin Berg
918da644e1 tests: Use sha256_prf_bits for failure stack matching
It seems that sha256_prf may not always be in the stack trace for
failure checking, possibly due to tail call optimization as it simply
calls sha256_prf_bits with updated parameters. Simply match against
sha256_prf_bits directly to avoid issues due to optimizations.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-07-11 19:51:29 +03:00
Benjamin Berg
9ba372a23d tests: Remove duplicate fail test check
The wpas_p2p_nfc_handover failure test and the more specific
wps_build_nfc_handover_req_p2p were effectively the same as the matching
currently does a prefix match. The code-path tested in these two cases
only hit a single TEST_FAIL macro in openssl_digest_vector.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-07-11 19:51:06 +03:00
Benjamin Berg
f6ba44d6f9 tests: Use more specific alloc_fail location
The test here is triggering the allocation failure in the static
wpa_config_parse_password() helper. Use this and decrease the count
instead of matching both wpa_config_set_quoted() and wpa_config_set()
and counting down based on that.

This is in preparation to fix the failure function matching to not do a
prefix match.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-07-11 19:50:42 +03:00
Benjamin Berg
050bd6e2b1 tests: Specify correct function name for failure
The test expects rsn_pmkid_suite_b_192() to fail but specified only
rsn_pmkid_suite_b without the _192 postfix. Add the postfix so that the
function matching can be fixed later.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-07-11 19:49:46 +03:00
Davide Caratti
d22401d895 dbus: Fix memory leak in case dbus provides 'tlvs' in invalid P2P SD response
Using D-Bus it is possible to request an invalid SD response where
"tlvs" is specified and there is an unknown key (e.g. "bar": "foo"). In
this case, "tlv" is allocated and then never used nor freed. Valgrind
complains as follows:

 36 bytes in 1 blocks are definitely lost in loss record 20 of 74
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54FB94: wpas_dbus_handler_p2p_service_sd_res (dbus_new_handlers_p2p.c:3016)
    by 0x53B9A2: msg_method_handler (dbus_new_helpers.c:356)
    by 0x53B9A2: message_handler (dbus_new_helpers.c:412)
    by 0x4EAB4B8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.13)
    by 0x5495DF: dispatch_data (dbus_common.c:37)
    by 0x5495DF: process_watch (dbus_common.c:73)
    by 0x5495DF: process_watch_read (dbus_common.c:89)
    by 0x41EE8E: eloop_sock_table_dispatch.part.0 (eloop.c:603)
    by 0x41FA46: eloop_sock_table_dispatch (eloop.c:597)
    by 0x41FA46: eloop_run (eloop.c:1233)
    by 0x56A3EE: wpa_supplicant_run (wpa_supplicant.c:8074)
    by 0x40DB06: main (main.c:393)

Fix it ensuring that "tlv" is freed both in the error and non-error path
of wpas_dbus_handler_p2p_service_sd_res(). Also, add a test case in
test_dbus.py to verify correct behavior.

Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
2024-07-11 18:39:39 +03:00
Davide Caratti
0c2d8417c6 dbus: Fix memory leak in case dbus provides tlv in P2P UPnP SD request
Using D-Bus it is possible to trigger a valid UPnP SD request where
"tlv" is specified: in this case "tlv" is allocated, and then not used
nor freed. Valgrind complains as follows:

 72 bytes in 2 blocks are definitely lost in loss record 46 of 68
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54F8B5: wpas_dbus_handler_p2p_service_sd_req (dbus_new_handlers_p2p.c:2928)
    by 0x53B9A2: msg_method_handler (dbus_new_helpers.c:356)
    by 0x53B9A2: message_handler (dbus_new_helpers.c:412)
    by 0x4EAB4B8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.13)
    by 0x5495DF: dispatch_data (dbus_common.c:37)
    by 0x5495DF: process_watch (dbus_common.c:73)
    by 0x5495DF: process_watch_read (dbus_common.c:89)
    by 0x41EE8E: eloop_sock_table_dispatch.part.0 (eloop.c:603)
    by 0x41FA46: eloop_sock_table_dispatch (eloop.c:597)
    by 0x41FA46: eloop_run (eloop.c:1233)
    by 0x56A3CE: wpa_supplicant_run (wpa_supplicant.c:8074)
    by 0x40DB06: main (main.c:393)

Fix it ensuring that "tlv" is freed, both in the error and non-error
path of wpas_dbus_handler_p2p_service_sd_req(). Also, add a test case in
test_dbus.py to verify correct behavior.

Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
2024-07-11 18:37:14 +03:00
Aditya Kumar Singh
b7c6aa3ac6 tests: Extend color change test for a non-first link of an AP MLD
Currently color change test is supported only on the first link of the
AP MLD. Extend the support to test on non-first link as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-07-11 17:25:25 +03:00
Jouni Malinen
566dc139a0 tests: Include Message-Authenticator attribute in RADIUS tests
This is in preparation for hostapd requiring this attribute for all
cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-09 14:58:39 +03:00
Jouni Malinen
2846b74f14 tests: SAE H2E and rejected groups with different APs and different config
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 12:14:34 +03:00
Jouni Malinen
368aa0230b tests: SAE protocol testing - Invalid Rejected Groups element
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 12:14:33 +03:00
Jouni Malinen
7cf0021267 tests: SAE protocol testing and a valid commit after a failed one
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-20 18:24:10 +03:00
Jouni Malinen
b54ccd4129 tests: SAE with SSID protection in 4-way handshake
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-19 12:38:14 +03:00
Aditya Kumar Singh
cb5c4e49c7 tests: Add color change test for an AP MLD
Add the eht_mlo_color_change test case to perform color change on the
first link of an AP MLD. Performing on non-first link will be done
later.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:42:33 +03:00
Aditya Kumar Singh
72203b8fe3 tests: Add HE BSS color change test
Add the he_bss_color_change test case which brings up an HE AP and
performs color change operations and validates the result.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:38:32 +03:00
Jouni Malinen
e4e91f5320 tests: WNM BSS max idle period management
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 23:46:02 +03:00
Jouni Malinen
829ab90d27 tests: Use consistent indentation level for clear_regdom_state()
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 13:21:02 +03:00
Jouni Malinen
fdf23679f8 tests: More coverage for WNM BSS max idle period management
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 13:20:02 +03:00
Aditya Kumar Singh
1dda619ed2 tests: Cohosted MLDs connectivity testing
Add a test case 'eht_mld_cohosted_connectivity' which creates two 2 link
AP MLDs and connect a 2 link MLD client to each one of them and test
data traffic.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-04-24 21:58:49 +03:00
Aditya Kumar Singh
a1e585fb63 tests: Basic cohosted MLDs functionality testing
Add test cases to test basic cohosted MLDs functionality. Add helper
functions to create the configuration file, start hostapd instance.

Client connectivity test case will be added via a subsequent commit.

eht_mld_cohosted_discovery: 2 co-hosted MLDs without non-MLD RNR. Basic
bring up and beacon, MLD RNR, scan validation.

eht_mld_cohosted_discovery_with_rnr: Same like eht_mld_cohosted_discovery
but additionally non-MLD RNR (rnr=1) is also enabled. Validate the non-MLD
RNR as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-04-24 21:58:49 +03:00
Jouni Malinen
b38f14e13d tests: Update opclass 124 test to use opclass 125
This is needed to match the implementation change to map the 5 GHz
channels 149-175 to the global operating class 125 instead of 124.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-24 21:58:49 +03:00
Jouni Malinen
ef5d2f9e8f tests: Fix a typo in opclass test descriptions
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-24 21:58:49 +03:00
Jouni Malinen
e141b33a66 tests: Fix a race condition in mesh_link_probe
Wait for both peers to be connected before checking MESH_LINK_PROBE
behavior. Without this, it was possible for a MESH_LINK_PROBE command to
be issues before the specific peer had been added and that would result
in the nl80211 command failing.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-22 23:14:08 +03:00
Jouni Malinen
97da087c0c tests: Fix autogo_chan_switch to not drop HT capability
This test case ended up dropping HT capability on channel switch which
is now resulting in mac80211 disconnecting. Avoid this by leaving HT
enabled. In addition, check the P2P Client events explicitly.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-22 16:17:39 +03:00
Jouni Malinen
42080798b5 tests: AP MLD with two links when only one of the links is negotiated
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-22 14:38:59 +03:00
Jouni Malinen
8f83b7d7d1 tests: WPA2-PSK from RADIUS during 4-way handshake with Session-Timeout
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-04-21 11:55:53 +03:00
Ilan Peer
0df2c72c54 tests: Wait after removing a BSS
When a BSS is removed, the flow continues without actually
waiting for the AP to be stopped. This is racy in flows that
actually expect the AP to be stopped, e.g., test_ap_bss_add_remove().

Try to mitigate such cases by adding a short sleep after the
AP is removed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
2024-04-21 10:53:39 +03:00
Jouni Malinen
42517eb3b0 tests: Clear scan cache in ap_hs20_anqp_invalid_gas_response
This is needed to avoid unexpected behavior if a previously executed
test case has left a BSS entry with Interworking emabled into the case.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-04-20 18:31:11 +03:00
Jouni Malinen
9e3988fc64 tests: Enable TLSv1.3 test cases with OpenSSL 3.3
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-04-20 11:08:50 +03:00
Jouni Malinen
25e465d5b7 tests: Update RSA 3k certificates (2024)
These have not yet expired, but it is easier to get in sync with all
certificate updates.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-04-17 21:26:36 +03:00
Jouni Malinen
9e59cb8392 tests: Update server and user certificates (2024)
At least some of the previous versions have expired, so need to re-sign
these to avoid EAP test case failures. This contains updates from
running tests/hwsim/auth_server/update.sh.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-04-17 21:25:56 +03:00
Jouni Malinen
ea2c5fe4d1 tests: Fix sigma_dut_dpp_pb_ap to clear sae_groups
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-16 11:22:41 +03:00
Johannes Berg
ae1a9909e0 tests: Add test with stuck ECSA in Probe Response frames
Add a test behaving like an Asus RT-AC53 with firmware
3.0.0.4.380_10760-g21a5898, which (in some cases?) can have an ECSA
element stuck in the probe response, when the channel switch is long
finished.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-04-16 10:46:15 +03:00
Johannes Berg
41fd49958d tests: Add connecting-while-CSA tests
Add a few tests to validate what happens with connections
while an AP is doing CSA:
 - quiet to diff channel (shouldn't connect)
 - quiet to same channel (shouldn't connect)
 - non-quiet to diff channel (shouldn't connect)
 - non-quiet to same channel (should connect)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-04-16 10:46:13 +03:00
Jouni Malinen
a6062568ab tests: Fix he_6ghz_reg to clear sae_groups
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-15 23:35:29 +03:00
Jouni Malinen
e2ae53e1db tests: MBSSID and beacon protection disabled/enabled
Verify that the Extended Capabilities element for the TX BSS shows
beacon protection disabled and the Extended Capabilities element for the
non-TX BSS (within the Multiple BSSID element) shows it enabled.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-04 20:44:22 +03:00
Jouni Malinen
07c9f183ea tests: Avoid control interface throttling in various test cases
These can cause unexpected test failures, so dump the pending monitor
socket events more frequently in some cases where event throttling is
seen.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 23:48:39 +02:00
Jouni Malinen
0e4bff095b tests: Flush scan cache to make dbus_anqp_get more reliable
This test could have failed if scan results from a previously executed
test case were still the in the driver cache.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 22:33:38 +02:00
Aditya Kumar Singh
e51f1109b0 tests: AP MLD: Remove mld_id config
mld_id config is not used anymore. Remove its use from test cases.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-26 20:20:55 +02:00
Jouni Malinen
272c253dc9 tests: Clear sae_groups in eht_mld_legacy_stas
This is needed to avoid failures due to previous test cases having left
sae_groups set to something else than the default.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-26 19:14:48 +02:00
Jouni Malinen
bd52684498 tests: Convert sigma_dut control to a context manager class
This cleans up the implementation and makes stopping of sigma_dut (and
cleanup after some parameters it might leave behind) more robust.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-03-24 00:24:07 +02:00
Jouni Malinen
64c3c58080 tests: Make rrm_reassociation more robust
It was possible for this test case to fail if a previously executed test
case left another BSS entry for the BSSID used by the second AP here.
That could have skipped the needed scan with scan_for_bss(bssid2). Force
this command to run a new scan to discover the second AP correctly.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-03-23 22:22:07 +02:00
Janusz Dziedzic
2342d95821 tests: remotehost: Extend proc API
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
2024-03-23 21:58:59 +02:00
Jouni Malinen
b83797a3eb tests: Clear scan cache for SAE-EXT-KEY tests
These test cases check the BSS entry information and if the kernel scan
cache maintains an old BSS entry for a previous test case for the same
BSSID this can result in a false failure.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-20 18:13:08 +02:00