Commit graph

4748 commits

Author SHA1 Message Date
Janusz Dziedzic
9ff4fd30ff tests: Allow to use remote hostapd_cli in Hostapd classes
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
2024-08-03 18:35:10 +03:00
Janusz Dziedzic
871bfdcdf6 tests: Allow to use remote wpa_cli in WpaSupplicant class
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
2024-08-03 18:35:02 +03:00
Janusz Dziedzic
d3f340c869 tests: Add RemoteCtrl class
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
2024-08-03 18:17:37 +03:00
Benjamin Berg
3cf4b4ad88 tests: Add a WNM tests to check candidate list is used if not required
This tests that the candidate list is used even if it is not required
because the abridged and preferred candidate list included bits are not
set.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-08-02 13:49:32 +03:00
Benjamin Berg
020f20a222 tests: Set the abridged bit in BTM tests
Many of the WNM tests assume that the supplicant will only select a
neighbor that was included in the candidate list. However, without the
abridged bit being set, the supplicant is allowed to also select any BSS
that is not explicitly included in the list.

Prepare for the supplicant handling the abridged bit by setting it in
the tests where relevant.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
2024-08-02 13:16:10 +03:00
Jouni Malinen
4d110b4f87 tests: More detailed error logging for RSN overriding with MLD
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-30 18:52:15 +03:00
Jouni Malinen
e0053bf9d0 tests: Long extra KDE in EAPOL-Key msg 3/4
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-24 20:35:11 +00:00
Jouni Malinen
296104d35c Testing functionality to allow EAPOL-Key Reserved field to be set
The new hostapd configuration parameter eapol_key_reserved_random=1 can
be used for testing STA/Supplicant functionality to accept a random
value in the Reserved field within EAPOL-Key frames.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-24 17:22:42 +00:00
Jouni Malinen
2e4c612dd2 Allow RSNE/RSNXE/RSNOE/RSNO2E/RSNXOE to be replace for testing
This is convenient for testing STA behavior with various RSN element
combinations and special cases.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-24 01:01:29 +00:00
Jouni Malinen
8b2ddfdbb6 RSNO: Allow RSNXE to be omitted
Add an explicit rsn_override_omit_rsnxe=1 configuration parameter to
allow the RSNXE to be omitted when using the RSNXOE and wanting to
minimize interoperability issues with STAs that might recognize the
RSNXE, but not handle it correctly, e.g., when multiple octets of
payload is included.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-23 21:20:45 +00:00
Jouni Malinen
8d54863550 tests: RSNE/RSNXE overriding
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-20 21:28:28 +03:00
Davide Caratti
aa2dfae5eb dbus: Fix memory leak with Bonjour params for a P2P UPnP service
Using D-Bus, it is possible to add a valid UPnP service where 'query'
and 'response' are specified. In this case, memory for 'query' and
'response' is allocated but not used nor freed. Valgrind complains as
follows:

 42 bytes in 1 blocks are definitely lost in loss record 32 of 75
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54F41A: wpas_dbus_handler_p2p_add_service (dbus_new_handlers_p2p.c:2762)
    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)

 49 bytes in 1 blocks are definitely lost in loss record 37 of 75
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54F348: wpas_dbus_handler_p2p_add_service (dbus_new_handlers_p2p.c:2755)
    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 this ensuring that query and resp are freed both in the error and
non-error path of wpas_dbus_handler_p2p_add_service(). Also, add a test
in test_dbus.py to verify the correct behavior.

Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
2024-07-20 20:28:40 +03:00
marek@mazekey.pl
6809f2b955 tests: Check CSA between non DFS and DFS chan
Add test to validate CSA between non DFS channel
and DFS channel with different operating class.

Signed-off-by: Marek Kwaczynski <marek@mazekey.pl>
2024-07-13 18:09:32 +03:00
Jouni Malinen
90344c323e tests: Set sta_wds in multi_ap_backhaul_shared_bss
This is needed to add the WDS interface for a STA with stricter
implementation checks.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-13 18:09:32 +03:00
Jouni Malinen
49fe24e6f5 tests: wpa_supplicant secure mesh and injected SAE messages
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-13 16:38:48 +03:00
Chien Wong
f250c34d10 tests: NAN: Check USD publish type
Signed-off-by: Chien Wong <m@xv97.com>
2024-07-12 16:37:15 +03:00
Jouni Malinen
3137a41247 tests: Make SSID verification through beacon protection more robust
Clear scan results at the beginning of the test case to avoid incorrect
behavior if there are multiple entries for the same BSS. In addition,
use a bit longer wait for receiving an updated Beacon frame in scan
results.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-07-12 13:15:57 +03:00
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