Commit graph

3515 commits

Author SHA1 Message Date
Jouni Malinen 6480e5a9a0 tests: PMKSA caching and PTK rekey triggered by AP
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-18 21:55:39 +03:00
Jouni Malinen 4731296759 tests: FILS and PTK rekeying
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-18 21:55:39 +03:00
Jouni Malinen 9f721917e7 tests: EAP-pwd protocol testing for the server
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-17 14:15:42 +03:00
Jouni Malinen 778ce8ae0b tests: EAP-pwd protocol tests - unexpected more-fragment frame
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-17 13:24:37 +03:00
Jouni Malinen a143bdc0d1 tests: EAP-pwd local error cases on server
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-17 13:24:37 +03:00
Jouni Malinen 0a9ff3810b tests: Addition WPS local error case coverage
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-17 00:55:16 +03:00
Jouni Malinen d45a241933 tests: OWE invalid Association Response frame contents
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 22:37:18 +03:00
Jouni Malinen 5a52d8da95 tests: Opportunistic Wireless Encryption - local errors on supplicant
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 22:02:39 +03:00
Jouni Malinen bfce94e094 tests: WPA2-PSK and local error cases on supplicant
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 21:35:04 +03:00
Jouni Malinen 50b915f055 tests: Additional coverage for EAP-MSCHAPv2 local error cases
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 21:25:27 +03:00
Jouni Malinen d804155783 tests: Milenage local error cases
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 21:09:50 +03:00
Jouni Malinen fad1a1e340 tests: Previously missed aes_s2v() error path
This targets the omac1_aes_vector() call from within the 0..num_elem-1
loop in aes_s2v().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 20:54:25 +03:00
Jouni Malinen 63215b32a8 tests: AES-EAX error cases that were previously missed in EAP-PSK
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 20:39:45 +03:00
Jouni Malinen 8030e2b594 tests: Protocol testing for supplicant PMF/IGTK KDE handling
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-16 19:31:34 +03:00
Jouni Malinen 5e6c54bee8 tests: AP with open mode and STA poll without ACK
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-16 01:52:36 +03:00
Jouni Malinen 9c4554a9b7 tests: SA Query timeout
Verify wpa_supplicant behavior on SA Query timeout and
disconnection/reconnection.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-16 00:48:27 +03:00
Jouni Malinen 6541b9dbe7 tests: Avoid confusing "DETACH failed" exception prints in D-Bus tests
dbus_p2p_go_neg_init, dbus_p2p_group_idle_timeout, and
dbus_p2p_group_termination_by_go could end up print a "DETACH failed"
exception as a warning from WpaSupplicant.__del__ for the dev1 instance
used within the TestDbusP2p class. This did not cause the test cases to
fail, but the output is a bit confusing, so clean this up be explicitly
closing the control interface monitor sockets and furthermore by
ignoring the "DETACH failed" exception within __del__.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-15 20:13:28 +03:00
Jouni Malinen 8860182449 tests: Unsupported WNM Action
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 17:38:15 +03:00
Jouni Malinen 327a2c786b tests: WNM Collocated Interference Reporting errors
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 17:38:15 +03:00
Jouni Malinen de3815c71b tests: WNM BSS Transition Management and steering timeout
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 17:21:13 +03:00
Jouni Malinen c6867fd3b1 tests: WNM BSS Transition Management query - TM disabled on AP
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 17:04:10 +03:00
Jouni Malinen 989bc22006 tests: WNM Sleep Mode disabled on AP
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 16:57:40 +03:00
Jouni Malinen 48bce38621 tests: Use helper function for starting WNM AP
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 16:57:40 +03:00
Jouni Malinen 9d21594354 tests: WNM Sleep Mode - RSN with OCV - local failure
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 16:02:54 +03:00
Jouni Malinen 815f58a96f tests: nl80211 freq reporting in station mode
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-14 12:41:26 +03:00
Jouni Malinen d7c98f9558 tests: eap_pwd_perform_confirm_exchange() local failure
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:35:47 +03:00
Jouni Malinen b95d79e7bc tests: eap_pwd_perform_commit_exchange() local failures
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:34:38 +03:00
Jouni Malinen c9065bd265 tests: EAP-pwd commit request error cases
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:28:05 +03:00
Jouni Malinen c7c267fa51 tests: EAP-pwd rejection of groups 25, 26, and 27
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:28:05 +03:00
Jouni Malinen caf4d1c979 tests: Remove testing of EAP-pwd groups 25, 26, and 27
This is in preparation of disallowing all use of these groups. Negative
test case for the groups will be added in a separate commit after the
implementation has been changed.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:28:05 +03:00
Jouni Malinen 6fe3ee722d tests: EAP-pwd local failure in crypto_bignum_rand()
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:28:05 +03:00
Jouni Malinen 8ff2401d54 tests: EAP-pwd eap_pwd_get_element() local failures
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 18:28:03 +03:00
Jouni Malinen 4f183becf0 tests: EAP-pwd compute_password_element() local failures
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 16:58:38 +03:00
Jouni Malinen b061b9e943 tests: CONFIG_TLS=linux build of wpa_supplicant
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 12:57:42 +03:00
Jouni Malinen 52b1cb5d73 tests: crypto_hash_finish() failure in eap_pwd_kdf()
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 12:53:42 +03:00
Jouni Malinen e8d8f4b680 tests: EAP-EKE rejection of unsupported DH groups 2 and 5
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 12:20:24 +03:00
Jouni Malinen 52ad367624 tests: Make regdom clearing in WNM tests more robust
It looks like the scan operation could end up reverting regdom back to
the previously configured one, so configure 00 country before starting
the disconnect-and-stop-scan operation to give some more time for the
regdom to be cleared.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 12:06:25 +03:00
Jouni Malinen e467d7ab4a tests: Show ifname in country code not cleared messages
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-13 12:06:09 +03:00
Avraham Stern 986bfb6ed6 tests: Update rrm_beacon_req_last_frame_indication to match implementation
The last beacon report indication was set in all the beacon report
elements in the last frame of the beacon report, while it should be set
only in the last beacon report element of the last frame. This is now
fixed in wpa_supplicant, so update the test case expectation to match
the fixed behavior.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
2019-04-13 11:56:08 +03:00
Johannes Berg 61876c7eed tests: Fix trace-cmd recording with python3
The change to python3 broke trace-cmd recording, two
strings need to be bytes instead. Fix that.

Also add a flush() that seems to be needed now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-04-12 20:43:33 +03:00
Jouni Malinen 2e3849bcf5 tests: EAP-pwd protocol tests for invalid EAP-pwd-Commit
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-09 17:11:15 +03:00
Jouni Malinen faddd025c3 tests: SAE commit invalid scalar/element
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-09 17:11:15 +03:00
Jouni Malinen 2b70a82cef tests: SAE and confirm after invalid commit
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-09 17:11:15 +03:00
Jouni Malinen 3ffeb7d8c8 tests: Test cases for X.509 certificate checking
This makes it easier to test various X.509 certificate validation steps
with the server certificate being generated and signed using pyOpenSSL
dynamically.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-09 16:24:38 +03:00
Jouni Malinen 85b3bb6cc7 tests: ERP enabled on RADIUS server and peer and no wildcard user
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-09 00:12:35 +03:00
Jouni Malinen 8f5b1c40bd tests: scan_multi_bssid_check_ie to allow for Multi BSSID Index IE
cfg80211 was modified to allow the Multiple BSSID Index element to be
included in the IEs for a nontransmitted BSS. Update the validation step
in this test case to allow that different with the IEs in the Beacon
frame (transmitted BSS).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-08 23:44:45 +03:00
Jouni Malinen 8e607b1b62 tests: Change most SAE test cases to use suitable groups
Reduce testing dependency on the unsuitable groups so that a test case
against a production build would not fail the test case unnecessarily.
This is in preparation of making production builds
(CONFIG_TESTING_OPTIONS not defined) of wpa_supplicant hostapd disable
all DH groups that have been indicated as being unsuitable.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-08 18:03:59 +03:00
Andrei Otcheretianski f6b5b6bb4f tests: Skip DPP configuration test
Skip wpas_config_file_key_mgmt if DPP is not supported.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2019-04-06 17:14:38 +03:00
Andrei Otcheretianski 0f7db7743d tests: Flush correct iface in P2PS stale group removal tests
FLUSH should be done on P2P device interface, otherwise the networks are
not removed. Fix that.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
2019-04-06 17:06:38 +03:00
Jouni Malinen 78ed42d8a2 tests: ERP/FILS with external hostapd process as RADIUS server
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-04-06 16:47:38 +03:00
Jouni Malinen d08ef5798d tests: sigma_dut controlled AP with PSK, SAE, FT
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-04-01 13:28:26 +03:00
Jouni Malinen 659f7954f4 tests: WPA2-EAP-FT with SHA384 using REASSOCIATE
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-28 01:57:10 +02:00
Jouni Malinen 1211031a60 tests: WPA2-FT-SAE AP and PMKSA caching for initial MD association
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-27 04:04:16 +02:00
Jouni Malinen 43f68853ab tests: sigma_dut controlled SAE association with Password Identifier/FT
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-26 22:50:17 +02:00
Jouni Malinen cdf5391013 tests: SAE + FT-SAE configuration
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-26 22:50:17 +02:00
Jouni Malinen 1b232c1b96 tests: sigma_dut and SAE Password Identifier
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-26 22:50:17 +02:00
Jouni Malinen 5be5b81678 tests: dpp_bootstrap_gen_failures to match implementation changes
The separate dpp_bootstrap_gen() functions were merged into a single
one, so the test case needs a matching change to avoid failures.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-24 17:29:45 +02:00
Jouni Malinen 74cb18c6b0 tests: sigma_dut sta_scan GetParameter,SSID_BSSID
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-23 12:50:46 +02:00
Jouni Malinen 7f1eeda2df tests: Reset sae_groups in sigma_dut_dpp_qr_init_enrollee_sae
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-18 19:00:06 +02:00
Jouni Malinen f9bac0f6b3 tests: Remove unnecessary dump_monitor() calls from end of test cases
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-18 18:32:31 +02:00
Jouni Malinen e105110f40 tests: Use a helper function for DPP_CONFIGURATOR_ADD/REMOVE
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-18 18:32:31 +02:00
Jouni Malinen 5725b3e355 tests: Use a helper function for DPP_AUTH_INIT
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-18 18:32:31 +02:00
Jouni Malinen 84438350ae tests: DPP AP+STA provisioning and connection with Brainpool curves
Increase testing coverage by going through all six possible curves with
full provisioning of AP and STA and connection (which includes PFS with
DPP2).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-18 18:32:31 +02:00
Jouni Malinen e71a90711d tests: Fix mesh_sae_groups_invalid to reset sae_groups setting
This test case did not clear a possibly modified sae_groups value from a
prior test case for adev[2] and could fail if the previously set group
was not supported by the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-18 00:02:16 +02:00
Jouni Malinen 96ad141e6c tests: Fix WPS with SAE test cases to reset sae_groups setting
These test cases did not clear a possibly modified sae_groups value from
a prior test case and could fail if the previously set group was not
supported by the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-18 00:02:11 +02:00
Jouni Malinen 95ace8670b tests: Fix ap_mixed_security to reset sae_groups setting
This test case did not clear a possibly modified sae_groups value from a
prior test case and could fail if the previously set group was not
supported by the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-18 00:02:08 +02:00
Jouni Malinen 296670aa94 tests: ap_mixed_security to use SAE capability from the correct station
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 21:38:34 +02:00
Jouni Malinen 203878d797 tests: Helper function for checking DPP-FAIL reporting
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 20:58:44 +02:00
Jouni Malinen 6d196e5928 tests: Helper functions for DPP PKEX initiator and responder
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 20:57:58 +02:00
Jouni Malinen 517f76b158 tests: DPP use the wait_auth_success() helper function
Use the already existing helper function and extend it to cover the most
common test sequences.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 19:17:31 +02:00
Jouni Malinen 7e0091007c tests: Use helper function for DPP_LISTEN commands
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 18:19:58 +02:00
Jouni Malinen e01a492caa tests: Helper function for DISCONNECT + ABORT_SCAN + wait
Use a helper function to perform this common sequence to disconnect and
stop any possibly started reconnection attempt.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 17:58:33 +02:00
Jouni Malinen 2b4263d06f tests: Handle scan result clearing more carefully in ap_country
If the ABORT_SCAN command succeeds, CTRL-EVENT-SCAN-RESULTS event is
delivered for the aborted scan. Following this with an immediate
flush_scan_cache() call can result in the first scan interpreting that
pending event as the completion and that results in trying to start
another scan while the first scan is still in progress.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 17:40:39 +02:00
Jouni Malinen 09bdbc6ed9 tests: Remove group at the end of p2p_ext_vendor_elem_invitation
This is needed to avoid leaving behind a ROC operation at the end of the
test case. This was found with the following test sequence:
p2p_ext_vendor_elem_invitation wifi_display_r2

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 17:06:04 +02:00
Jouni Malinen 421d658a67 tests: Fix ECDSA signature generation
Parsing of the DER encoded signature was unable to handle results that
were shorter than the prime. These need to be zero padded from left to
generate the correct value.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 16:53:05 +02:00
Jouni Malinen 3a88b7e6e9 tests: Split event wait in grpform_cred_ready_timeout
The long wait for the monitor socket events resulted in another socket
running out of TX buffer space. Split the wait into smaller segments and
clear the other socket in each iteration.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 16:08:53 +02:00
Jouni Malinen e4b4e1748a tests: Clear monitor socket queue in ap_hs20_interworking_oom
Do not leave all the event messages pending in the socket queue for the
full duration of the test case to avoid hitting the TX socket queue
limit.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 16:08:31 +02:00
Jouni Malinen b21540e682 tests: Close wpa_supplicant control interface more robustly
Some of the test cases left behind attached control interface monitor
sockets that could result in hitting the wpa_supplicant socket TX queue
limit. Try to be a bit more careful about detaching and closing the
sockets to avoid this.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 16:08:30 +02:00
Jouni Malinen 4d916a7f3e tests: Fix dump_monitor() without monitor attached
Do not try to dump pending event messages if the monitor socket has not
been attached.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-17 12:22:23 +02:00
Jouni Malinen fab49f6145 tests: Python coding style cleanup (pylint3 bad-whitespace)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-16 18:52:09 +02:00
Jouni Malinen 009b54bedd tests: DPP and provisoning DPP and legacy AKMs
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-16 18:52:09 +02:00
Jouni Malinen 3e1cfead0b tests: Use matching prefix for the ProxyARP IPv6 log files
The "_ipv6" part of the file name was missing and this resulted in file
names that conflicted with the IPv4 test cases and could overwrite logs
for those.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 23:57:44 +02:00
Jouni Malinen 39139d7ead tests: Decode brctl showmacs output for the debug log
This is needed with python3 to make the debug log more readable.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 23:57:44 +02:00
Jouni Malinen 649038e117 tests: Remove unnecessary second wait from connect_cmd_reject_assoc
It does not look like there would be two CTRL-EVENT-ASSOC-REJECT events
here, so only check the first one instead of requiring both to be
received with status_code=27. This test case could fail based on the
second connection attempt (due to that extra event wait) timing out.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 23:57:44 +02:00
Jouni Malinen a2d300765b tests: Make parallel-vm.py log easier to use for debugging failures
Print a list of full paths to log files from failed test cases both the
parallel.log and stdout so that they can be easily opened for analysis.
In addition, renumber the VM lines in the <timestamp>-parallel.log to
match the i+1 numbering used in the log directories and UI that is
tracking test execution.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 21:10:00 +02:00
Jouni Malinen 8cfc758827 tests: Make ap_wpa2_eap_peap_params more robust
One of the steps that expected failure due to PMKID mismatch did not
stop connection attempts. This could result in the following test step
failing due to the previous profile with peaplabel=1 getting used to
derive the MSK incorrectly.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 13:51:55 +02:00
Jouni Malinen 043a29ecc4 tests: Clear pending monitor events before starting scan
The wait_event() call for scan completion could have processed a
previously received event from a prior scan instead of the newly started
one. This could result in flush_scan_cache() assuming there are still
results in the cache even though the scan request to clear the cache had
not even be started yet.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 13:51:55 +02:00
Jouni Malinen 4131ba5c55 tests: External radio work and DISCONNECT clearing connection attempt
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 13:03:31 +02:00
Jouni Malinen a8b8da1132 tests: Python coding style cleanup (pylint3 unneeded-not)
Use more readable "foo not in bar" construction for the couple of places
that did "not foo in bar".

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 11:34:32 +02:00
Jouni Malinen 2f22ed4fab tests: Fix run-tests.py module file (-l) handling
Prior cleanup broke the indentation here and made the addition of test
cases unreachable.

Fixes: 0663ae22ff ("tests: Do not use tabs for indentation")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 11:18:20 +02:00
Jouni Malinen 3507968fd2 tests: SAE anti-clogging request with mesh BSS
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 00:31:09 +02:00
Jouni Malinen 8ad1009e50 tests: DPP and Enrollee rejecting Config Object
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 00:31:09 +02:00
Jouni Malinen 8b6c834ff9 tests: DPP test cases to handle new behavior due to config result
The new DPP Configuration Result message can result in a bit different
behavior at the end of the configuration exchange and some of the test
cases need more flexibility to work with that DPP2 behavior.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-15 00:31:09 +02:00
Jouni Malinen f77d106294 tests: Fix dpp_qr_code_auth_initiator_enrollee to clear gas_address3
gas_address3 was set to 1 in this test case, but it was never cleared.
That can result in unexpected behavior in other test cases that dpeends
on gas_address3 being in its default value 0. Clear the parameter
explicitly to avoid this.

This resulted in an error in the following test sequence:
dpp_qr_code_auth_initiator_enrollee gas_anqp_address3_ap_forced

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-14 00:13:35 +02:00
Jouni Malinen 86db4e63d3 tests: Make WNM test case scan clearing more robust
There was a race condition on starting the flush_scan_cache() operations
if a scan happened to be in progress when the test case ended since the
ABORT_SCAN success case did not wait for the pending scan operation to
be completed. Wait for the scan completion event in addition to the
disconnection event if the ABORT_SCAN command is accepted.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-13 23:33:41 +02:00
Jouni Malinen 64766a7783 tests: Make TDLS test case scan clearing more robust
There was a race condition on starting the flush_scan_cache() operations
if a scan happened to be in progress when the test case ended since the
ABORT_SCAN success case did not wait for the pending scan operation to
be completed. Wait for the scan completion event in addition to the
disconnection event if the ABORT_SCAN command is accepted.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-13 23:33:21 +02:00
Jouni Malinen 32e4ad4433 tests: Decode station dump output to restore pre-python3 behavior
These TDLS test cases missed Popen() result decode() calls in the
earlier python3 compatibility changes. Add those to make debug log more
readable.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-13 20:40:31 +02:00
Jouni Malinen 3d5cfa0f6d tests: Make DPP protocol failure testing more robust
Wait explicitly for the DPP-NOT-COMPATIBLE event when going through
protocol testing with local failures instead of just waiting for a fixed
0.1 second duration. This prevents a test failure at least in
dppauth_resp_status_failure in a case where the failing operation may be
delayed under heavy CPU load.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-13 19:44:50 +02:00
Jouni Malinen 8b944cf779 tests: Clear scan results from dev5 in WPS testing
Test case sequence "ap_wps_ap_scan_2 ap_wps_pbc_2ap" resulted in a
failure due to a scan entry being left behind from the first test case
and the second one ending up using that obsolete result during WPS_PBC
processing. Fix this by clearing the scan results explicitly on dev5.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-13 19:27:21 +02:00
Jouni Malinen ba6ce9c657 tests: DPP and duplicated Authentication Response
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-13 13:22:40 +02:00
Jouni Malinen a1983aa72c tests: Make sae_anti_clogging_during_attack more robust
Accept a smaller number of token responses in second round to avoid
failing this test case as frequently.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-12 17:31:40 +02:00
Jouni Malinen 53b4f0fe6a tests: Disable fragm/rts_threshold after testing it
The configurated fragmentation/RTS threshold value survives AP mode
interface restarts, so these values need to be explicitly cleared back
to default (disabled). This fixes an issue where some test cases could
not work correctly if fragmentation on the interface was enabled. For
example, this combination used to fail:
ap_fragmentation_open ap_hs20_fetch_osu

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-12 17:18:38 +02:00
Jouni Malinen abaa0893f0 tests: Fix scan_specific_bssid in case Beacon frame is seen
The first scan for the unknown BSSID could have been timed in a manner
that allows passive scanning to find the real AP even if that AP's
beacon interval was 1000 (e.g., heavy CPU load changed timing so that
the AP beaconing started at suitable time). The check for BSS result
entry not including Probe Response frame was comparing incorrect BSS
entries (bss2 vs. bss1) which resulted in the test case claiming failure
even when there was no unexpected Probe Response frame.

Fix this by comparing the beacon_ie and ie parameters from the same BSS
entry (bss1).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-12 16:36:46 +02:00
Jouni Malinen 9efd3447c7 tests: Make AP discovery more robust in eap_proto test cases
Number of these test cases start connection attempt in wpa_supplicant
and then expected a specific failure to happen relatively quickly. This
could result in timeouts if the first scanning round missed to find the
AP (e.g., due to CPU load pushing out the Probe Response frame long
enough for the station having left the channel) and wpa_supplicant then
waiting five seconds before starting a new scan.

Make this more robust by scanning explicitly for the specific BSSID
before starting the connection attempt.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-12 16:24:15 +02:00
Jouni Malinen 914d8ecac7 tests: SAE group negotiation (no match)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-12 00:25:48 +02:00
Jouni Malinen f4f17e9aa1 tests: check_cert_subject
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-11 14:09:45 +02:00
Lubomir Rintel 192d061add tests: Drop testing of the old D-Bus interface
This old interface has been obsoleted and should not have been used
since 2010, so remove testing for it in preparation to dropping the
interface completely from wpa_supplicant.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2019-03-09 18:23:09 +02:00
Jouni Malinen a5387062e5 tests: Use a helper function for DPP_BOOTSTRAP_GEN commands
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-09 18:13:10 +02:00
Jouni Malinen 0422d06b54 tests: Use a helper function for DPP_QR_CODE commands
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-09 16:55:54 +02:00
Jouni Malinen 7010f4bed5 tests: DPP provisioning updating wpa_supplicant configuration file
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-09 16:23:04 +02:00
Jouni Malinen 0defc42a49 tests: Add wlantest description for ap_ft_pmf_*_over_ds
This is convenient to allow easier examination of the FT Action frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-09 11:37:02 +02:00
Jouni Malinen 0c481b7866 tests: Use run_ap_ft_pmf_bip_over_ds() for ap_ft_pmf_over_ds
No need to duplicate this functionality when all the ap_ft_pmf_*_over_ds
test cases are doing practically the same thing and the
no-specific-cipher-configuration case can be addressed easily with the
same helper function.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-09 11:33:49 +02:00
Jouni Malinen 46b8ea2105 tests: Fix ap_ft_pmf_over_ds
The main step of the test case was accidentally removed when adding the
cipher specific versions.

Fixes: ffcaca68d3 ("tests: FT with different BIP algorithms")
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-03-09 11:26:38 +02:00
Jouni Malinen 9ebbdd0aa3 tests: Report authentication server memory leaks more visible
It was too easy to miss memory leaks in the hostapd-as-AS log.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-08 16:52:52 +02:00
Jouni Malinen dc0f727c99 tests: WPS with PSK+SAE
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-06 21:52:49 +02:00
Jouni Malinen e43352ff41 tests: SAE anti clogging during an attack
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-06 13:07:25 +02:00
Jouni Malinen a053ab9590 tests: More complete group list for sae_groups
Add group 1 for completeness sake and also and Brainpool groups with
OpenSSL 1.1.*.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-06 13:05:23 +02:00
Jouni Malinen c097f12c8f tests: Enable needed SAE groups explicitly in sae_oom_wpas
Configure the sae_groups parameter for hostapd explicitly in preparation
for the default value change in the implementation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-05 17:14:05 +02:00
Jouni Malinen 656f4a3edd tests: Enable needed SAE groups explicitly in sigma_dut_sae
Configure the sae_groups parameter for hostapd explicitly in preparation
for the default value change in the implementation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-03-05 17:12:44 +02:00
Jouni Malinen 3d5b88b5a0 tests: FT-SAE with Password Identifier
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-26 20:40:32 +02:00
Jouni Malinen 05103c400b tests: More robust connect command testing
Avoid an invalid failure case due to scan results being left behind from
connect_cmd_bssid_hint when executing connect_cmd_reject_assoc by
explicitly clearing the scan results from dev5. This fixes an error case
that happened with the following test case sequence:
connect_cmd_bssid_hint connect_cmd_reject_assoc

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-25 21:58:28 +02:00
Jouni Malinen fe5400dda2 tests: Make MACsec test cases clear monitor socket more thoroughly
The wpas (dev5) control interface socket did not always get cleared in
the MACsec test cases and this could result in issues with following
test cases if the dev5 message queue hit the maximum limit.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-25 21:40:23 +02:00
Lubomir Rintel 5644f0ce3a tests: Remove CONFIG_PEERKEY
The functionality has been removed in commit a0bf1b68c0 ('Remove all
PeerKey functionality').

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2019-02-25 19:48:49 +02:00
Jouni Malinen f3e671591e tests: libFuzzer integration for test-json and test-x509
Allow these test tools to be used with libFuzzer in addition to
afl-fuzz.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-25 19:48:49 +02:00
Arnout Vandecappelle (Essensium/Mind) b1daf498a1 tests: Multi-AP WPS provisioning
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-02-18 22:35:42 +02:00
Arnout Vandecappelle (Essensium/Mind) cb3c156e7b tests: Update multi_ap_fronthaul_on_ap to match implementation
Now that the backhaul STA Multi-AP association is not rejected anymore
by the AP, update the test case to expect disconnection to be triggered
by the STA.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-02-18 20:26:32 +02:00
Arnout Vandecappelle (Essensium/Mind) a1debd3384 tests: Refactor test_multi_ap
With just one additional argument, the run_multi_ap_association()
function can be used for all tests.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-02-18 20:15:22 +02:00
Jouni Malinen 61929f4b07 tests: Empty token in wpa_psk_file
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-18 18:41:43 +02:00
Jouni Malinen 5a3a131993 tests: Mark log files to use utf-8 encoding
This seems to be needed when using python3 in VM for the ssid_utf8 test
case debug prints from the control interface requests. This breaks
python2 support for the same logging entries, but there does not seem to
be any easy way of addressing this in a manner that works for both
python versions, so move ahead with the python3-only support from now
on.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-18 18:19:06 +02:00
Masashi Honma 432496cdd8 tests: Switch default python version to 3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-17 17:26:01 +02:00
Jouni Malinen 258d88248b tests: AP VLAN based on SAE Password Identifier
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-17 17:24:23 +02:00
Jouni Malinen cf4643aa7d tests: Force diff chan in p2ps_channel_active_go_and_station_different_mcc
This test case was failing pretty frequently due to an issue in being
able to send out the Provision Discovery Response frame on the operating
channel. Now that wpa_supplicant has a fix for that issue, modify this
test case to hit this error condition every time. In addition, make sure
the possible exception from p2ps_exact_seek() does not get hidden with a
failing remove_group() call in the finally section.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-17 16:55:50 +02:00
Jouni Malinen e1348d21e9 tests: OpenSSL ECDH curve configuration
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-17 14:01:57 +02:00
Jouni Malinen 836f0ddac1 tests: EAP-PEAP/EAP-GTC
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-15 12:03:45 +02:00
Jouni Malinen 810dcfb667 tests: Wi-Fi generation indication for HT and VHT
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-15 02:09:41 +02:00
Jouni Malinen dd12e58e5f tests: ap_wpa_ie_parsing to allow EAPOL-Key msg 2/4 rejection
Once mac80211 starts reporting the used Association Request frame IEs in
the association event, wpa_supplicant will update RSN supplicant IE
information based on that and that will make the AP reject EAPOL-Key msg
2/4 in this particular test scenario due to the hack of including two
RSN IEs in the Association Request frame. Accept this sequence as a
valid test execution in addition to the previously expected connection
to avoid reporting incorrect failures.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-15 02:09:41 +02:00
Jouni Malinen b4788908ca tests: AP VLAN based on PSK/passphrase
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-14 13:36:54 +02:00
Jouni Malinen 051c8cae6a tests: DPP and two initiators
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-14 11:50:40 +02:00
Jouni Malinen 6c02fa214b tests: AP not receiving Authentication frame ACK
Verify that the not-associated STA gets deauthenticated, not
disassociated, on inactivity timeout.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-11 17:42:59 +02:00
Masashi Honma 51c83edfca tests: Catch only specific exceptions
This allows unexpected cases to terminate parallel-vm.py without being
hidden by the exception handler.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-11 12:42:52 +02:00
Jouni Malinen b623634262 tests: Document some of the test tools
This will hopefully make it easier for others to use these test tools.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-11 02:35:29 +02:00
Jouni Malinen a4a9737d6b tests: Fix wnm-fuzzer by adding dummy configuration
Some of the WNM implementation expects configuration to be available
(e.g., ieee802_!1_rx_wnm_coloc_intf_req() dereferences wpa_s->conf), so
add a dummy configuration to allow the fuzzer tool to be used.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-11 02:35:29 +02:00
Jouni Malinen 525923b1d7 tests: EAPOL-Key fuzzing tool
Add test-eapol program that can be used for fuzzing the EAPOL-Key
Supplicant and Authenticator implementations. This tool can write
Supplicant or Authenticator messages into a file as an initialization
step and for the fuzzing step, that file (with potential modifications)
can be used to replace the internally generated message contents.

The TEST_FUZZ=y build parameter is used to make a special build where a
hardcoded random number generator and hardcoded timestamp are used to
force deterministic behavior for the EAPOL-Key operations. This will
also make the implementation ignore Key MIC and AES keywrap errors to
allow processing of modified messages to continue further.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-11 02:35:29 +02:00
Jouni Malinen 79fa1b4530 tests: JSON parser fuzzer
test-json can be used for fuzz testing the JSON parser implementation in
src/utils/json.c.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-11 02:35:29 +02:00
Jouni Malinen 1ac9c020b5 tests: TLS fuzzing tool
Add test-tls program that can be used for fuzzing the internal TLS
client and server implementations. This tool can write client or server
messages into a file as an initialization step and for the fuzzing step,
that file (with potential modifications) can be used to replace the
internally generated message contents.

The TEST_FUZZ=y build parameter is used to make a special build where a
hardcoded random number generator and hardcoded timestamp are used to
force deterministic behavior for the TLS operations.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-11 02:35:29 +02:00
Jouni Malinen b49ec25979 tests: Add a simple HTTPS server for TLS testing
This makes it easier to use TLS testing tools against the internal TLS
implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-10 01:55:39 +02:00
Masashi Honma 45d3e2edbd tests: Explicitly flush stdin for python3
Without this flush(), test does not run.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-10 01:43:50 +02:00
Masashi Honma 3069be8fe3 tests: Encode VM input for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-10 01:43:50 +02:00
Masashi Honma 689a956049 tests: Decode VM output for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-10 01:43:50 +02:00
Masashi Honma 0da6d93dbf tests: Change handling of reading non blocked empty stream for python3
The result of reading non blocked empty stream is different between
python2 and 3. The python2 sends "[Errno 11] Resource temporarily
unavailable" exception. The python3 could read "None" without
exception, so handle this "None" case as well.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-10 01:43:50 +02:00
Jouni Malinen 6447b87400 tests: EAP-TLS and TLS 1.3
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-10 01:43:50 +02:00
Johannes Berg 3281c1590d tests: hwsim: macsec: correct configuration reference
You need CONFIG_DRIVER_MACSEC_LINUX, not CONFIG_MACSEC_LINUX,
so fix this in the messages.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-06 23:04:54 +02:00
Johannes Berg e5a410f472 tests: Make /etc/alternatives work in VM
In recent Debian versions, ebtables is an alias managed by
the alternatives(8) mechanism. This means /usr/sbin/ebtables
is a symlink to /etc/alternatives/ebtables, which in turn
links to the real binary.

As we mount a tmpfs over /etc, we cannot access this.

Fix this by bind-mounting the real /etc to /tmp/etc and
adding a symlink from /etc/alternatives to this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 23:51:37 +02:00
Johannes Berg 4b1cc13914 tests: Add sigma_dut to .gitignore
Evidently this file must exist when running the sigma_dut
dependent tests, add it to .gitignore so it's not seen as
making the tree "unclean" when it is added manually.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 23:51:36 +02:00
Johannes Berg 00bd8157aa tests: Build hs20-osu-client
For tests, build the HS 2.0 OSU client (without browser to avoid
having webkit/curl dependencies).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 23:51:36 +02:00
Johannes Berg b513ed429d tests: Remove useless test list from run-tests.py help
There's no point in printing out a 3k+ long list, just remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 23:51:36 +02:00
Johannes Berg 3691db26f7 tests: Add test reconnecting on assoc failure
Add a test that drops the authentication frame, so that
hostapd thinks the station is unknown, and then sends one
by itself, so the station thinks it's associated. This
tests mostly the kernel's capability to recover from this
scenario.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 23:51:31 +02:00
Jouni Malinen cdc23db2a6 tests: PEAP/GTC key lifetime in memory
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-02-05 23:34:30 +02:00
Jouni Malinen 43e3114c5f tests: Fix EAP-FAST protocol testing with python3
This was hit on Ubuntu 18.04 (newer python3 and OpenSSL library versions
compared to earlier tests).

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-05 15:50:45 +02:00
Johannes Berg e339511007 tests: Optionally start telnet server inside VMs
If telnetd is installed and --telnet <port> is passed on the
vm-run.sh command line, start a telnet server (directly connected
to bash, no login) inside the VM(s) to be able to look into them
when something is wrong. Use a user network in qemu with a single
host forward from the specified port for this, listening only on
'localhost'.

Please note that this provides unauthenticated access to the guest
system from anything that can open a TCP connection on the host system.
The guess system does have access to reading all files on the host that
the user account running kvm has access to (and even write access if the
default ROTAG ,readonly parameter is cleared). In other words, this
option should not be used on any multiuser systems where kvm is run
under user accounts that are not dedicated for testing purposes (i.e.,
do not have access to any files that should not be readable to
everyone).

This needs CONFIG_VIRTIO_NET=y in the guest kernel.

For parallel-vm.py, the --telnet argument specifies the base port
and each VM index (0, 1, ...) is added to it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 14:26:36 +02:00
Johannes Berg b0797ec955 tests: Suppress annoying console reset from VMs
Recently, qemu/seabios grew an annoying console/terminal reset,
which also causes my terminal to be left in a state where long
lines don't work well and less gets confused because of this.

Suppress this by suppressing all output from qemu before a new
magic string printed from inside.sh.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 13:35:15 +02:00
Jouni Malinen 06faf9e40b tests: Support python3 in multi-ocsp test cases
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-05 03:04:56 +02:00
Jouni Malinen 671c390a23 tests: Fix multi-ocsp response conents
These were not updated when the server certificates were updated the
last time (or the previous time).

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-05 03:01:38 +02:00
Jouni Malinen 2e5397d5db tests: Create radio for p2ps_channel_active_go_and_station_different_mcc
Instead of relying on existing configuration (which may conflict
with other tests) and skipping otherwise, create a new radio with
two channels in this test and use it.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-05 02:12:00 +02:00
Johannes Berg d25f16e478 tests: Create radio for p2ps_channel_both_connected_different_mcc
Instead of relying on existing configuration (which may conflict
with other tests) and skipping otherwise, create a new radio with
two channels in this test and use it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-05 02:06:36 +02:00
Jouni Malinen d5cac05952 tests: Multi-BSSID test cases with python3
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 20:03:29 +02:00
Jouni Malinen 200ac5daf6 tests: Encode Disconnect-Request attributes in sorted order for python3
This is needed to fix issues with dict iteration resulting in different
order of attributes when trying to calculate Message-Authenticator
externally to pyrad.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 20:03:29 +02:00
Jouni Malinen 55845e190b tests: Clean up pyrad test cases for python3 compatibility
All other test cases seem to work, but radius_das_disconnect_time_window
is still failing due to incorrect authenticator or Message-Authenticator
in Disconnect-Request.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 20:03:29 +02:00
Jouni Malinen 366ada0412 tests: Decode sigma_dut output for python3
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 16:48:22 +02:00
Jouni Malinen 37df1775ad tests: Read sigma_dut-ap.conf as binary data for python3 compatibility
Sending UTF-8 encoded data to logger file is currently not working
properly, so create a separate binary file with a copy of
sigma_dut-ap.conf instead to work with both python2 and python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 16:46:31 +02:00
Jouni Malinen e50c58e585 tests: Replace file() with open() to work with python3
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 16:11:42 +02:00
Jouni Malinen c37ef330d0 tests: MAC address ASCII string generation in python3 compatible manner
Use struct.unpack() to get a list of int and then generate a list of
hexstr octets from it for ':'.join() to get consistent behavior for both
python2 and python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:35 +02:00
Masashi Honma b723b25926 tests: Replace dict.has_key() with the in operator for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:35 +02:00
Masashi Honma 4aa2336ed5 tests: Use binary mode for writing WPS attributes
This is needed for python3.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Masashi Honma 59aecb1c42 tests: Decode StreamRequestHandler read for python3
WPSAPHTTPServer class needs to explicitly decode the read value from
a bytes object to a str object.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Masashi Honma 732b76139a tests: Decode upnp_soap_action() response for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Masashi Honma 69f58282bc tests: ElementTree string representation in python3 compatible manner
Use ET.tostring() to avoid implicit bytes/str conversion issues within
ET implementation. Add XML declaration separately to match previous
behavior.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Masashi Honma 308ecbc16e tests: urlopen() compatibility for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Jouni Malinen b7da11fd95 tests: Extend build_wsc_attr() to accept both bytes and str objects
This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Jouni Malinen 786ce912ce tests: Fix struct.unpack() call for a single octet with python3
python3 needs this to be a bytes object, not the first octet of that
object.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Jouni Malinen fd86ea402e tests: Remove forgotten development time print
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Masashi Honma 27a7e75651 tests: Open Hotspot 2.0 icon files in binary modes for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Masashi Honma c4e333fa43 tests: Encode/decode base64 operations for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Jouni Malinen 5c9ba3412d tests: python3 compatible way of importing gobject for D-Bus testing
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Jouni Malinen 236bbda8e4 tests: Use floor division (//) to avoid issues with python3
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Masashi Honma 4d364d9ee0 tests: Decode Popen output in wmediumd test sets for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Jouni Malinen c45b969d6a tests: python3 compatible str/bytes ord()
Need to skip ord() for python3 when going through bytes object (instead
of str object in python2).

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Jouni Malinen 95d013f530 tests: Replace str.translate() with str.replace()
This is needed for python3 since the two argument version of
str.translate() is not available for unicode. Furthermore, these cases
of delete colons from the string are simple enough for replace.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Masashi Honma edab6c9dac tests: Fix erp_home_realm_oom error on python3
Only python3 warns to this bug.

TypeError: '>' not supported between instances of 'type' and 'int'
Exception: '>' not supported between instances of 'type' and 'int'

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Jouni Malinen b3361e5dc9 tests: Explicit str/bytes conversion for key_lifetime_in_memory
This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Jouni Malinen a42ec6611c tests: Explicit str/bytes conversion in sigma_dut_venue_url
This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Masashi Honma e1810300c9 tests: Replace str.decode('hex') with binascii.unhexlify() for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Masashi Honma 54c58f29c0 tests: Replace str.encode('hex') with binascii.hexlify() for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:34 +02:00
Masashi Honma 1c48c9bcf9 tests: Decode Popen() output for python3
Need to do this to avoid issues with following operations that assume
the output to be a str object.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:34 +02:00
Masashi Honma 15dfcb69df tests: Use 'b' prefix to mark Bytes literals explicitly for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:33 +02:00
Masashi Honma d5e6ffd661 tests: Decode subprocess.check_output() return value for python3
Explicit conversion to str is needed here for python3 compatibility.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:33 +02:00
Masashi Honma 1cfaecf70e tests: rfkill with python3 compatible version
Update rfkill helpers to not depend on python2 implicit conversions.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:33 +02:00
Masashi Honma a3e00682ab tests: nl80211 attr with python3 compatible version
Update nl80211 attribute building helpers to not depend on
python2 implicit conversions.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:33 +02:00
Masashi Honma e285418bed tests: HWSimController class with python3 compatible version
Update class HWSimController and netlink helpers to not depend on
python2 implicit conversions.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:33 +02:00
Masashi Honma f94df3c0b0 tests: Explicitly encode str to bytes when needed for python3
Avoid implicit conversion errors when constructing bytes objects or
passing a str object to a function that needs a bytes object.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:33 +02:00
Masashi Honma a444a6d262 tests: Fix failure for WPA-EAP-SUITE-B-192 key_mgmt
The wpas_config_file_key_mgmt fails with this error if wpa_supplicant is
built without CONFIG_SUITEB192=y:

Exception: SET_NETWORK failed
Exception: SET_NETWORK failed

Skip the WPA-EAP-SUITE-B-192 case if it is not supported in
wpa_supplicant so that the rest of the key_mgmt test coverage is
included.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:33 +02:00
Masashi Honma cc02ce96cf tests: Explicit str/bytes conversion for socket operations for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:33 +02:00
Jouni Malinen 6395b9eb3e tests: Read binary file in add_log_file() for python3
python3 requires sqlite3.Binary() input to be bytes instead of str, so
open the files for binary mode reading.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:33 +02:00
Jouni Malinen 2a79a8ce14 tests: Convert tshark output to string object for python3
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:33 +02:00
Masashi Honma 7ab74770e7 tests: Convert binascii.hexlify() output to a string object for python3
This is needed in cases the hexlify() output is used to concatenate with
a string or used in string comparisons.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-04 12:26:33 +02:00
Masashi Honma 04fa9fc7fd tests: Decode Popen() output values for python3
Explicit conversion to str is needed here for python3 compatibility.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-04 12:26:33 +02:00
Jouni Malinen 45b0b88f80 tests: Decode command execution output to a str for python3
Need to convert from bytes to str to allow the following string
operations to work with python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-02 12:51:13 +02:00
Jouni Malinen 58be42b264 tests: Remove trailing semicolons from python code
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-02 12:10:53 +02:00
Masashi Honma 9c06eda01c tests: Use python3 compatible libraries
This patch is made by using 2to3 command with some modifications.

$ find . -name *.py | xargs 2to3 -f imports -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-02 12:03:04 +02:00
Jouni Malinen 2974633d0c tests: Remove unused import statements
These were not used at all and caused unnecessary operations and in some
cases, compatibility issues with python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-02 11:35:13 +02:00
Masashi Honma bc664dfc09 tests: python3 requires a raw string due to the backslash
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-02-02 11:35:05 +02:00
Jouni Malinen b198d281b0 tests: Enable ERP testing with PEAP
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-02-02 00:06:04 +02:00
Johannes Berg a2674fd902 tests: wpasupplicant: Refactor code duplication in wait_global_event()
This code is identical to the wait_event() code, except for the
mon/global_mon instance. Create a _wait_event() function that
encapsulates this, and use it for both.

While at it, fix the bug in wait_global_event() where in the case
of not having a global_mon it always returns None.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-01 23:02:43 +02:00
Johannes Berg 8bdefe511c tests: vm-run: Create a symlink to the latest logs
This is useful when running a test multiple times, looking at
log output etc. to not have to pick out the right directory
each and every time.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2019-02-01 23:00:42 +02:00
Jouni Malinen 0c1e29fd30 tests: WNM-Sleep Mode Request bounds checking for empty contents
The wnm_sleep_mode_proto test case was already covering number of
invalid WNM-Sleep Mode Request frame cases, but it was missing the
shortest possible case with a missing Dialog Token field. Add that as a
regression test case for bounds checking in
ieee802_11_rx_wnmsleep_req().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-01-28 15:05:09 +02:00
Jouni Malinen a18d58f47c tests: EAP-TLS and server reloading CRL from ca_cert
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-27 18:48:16 +02:00
Jouni Malinen 0eb34f8f28 tests: WPA2-PSK AP with PSK from a file (keyid and reload)
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-26 17:52:04 +02:00
Masashi Honma 1699309378 tests: Modify pmksa_cache test sets for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:15:40 +02:00
Masashi Honma 26b91346b9 tests: Modify ocv test sets for python3
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:15:32 +02:00
Masashi Honma 255f3846a9 tests: ap_eap test requires more memory in VM
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:05:44 +02:00
Masashi Honma 26b0c29042 tests: Python3 does not allow mixed indentation
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:04:38 +02:00
Masashi Honma e6b283f758 tests: Use int instead of long for python3 compatibility
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f long -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:02:50 +02:00
Masashi Honma e1bb41bfde tests: Use python3 compatible raise statement
This patch is made by using 2to3 command.

find . -name *.py | xargs 2to3 -f raise -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:01:33 +02:00
Masashi Honma 8c851c2e36 tests: Use python3 compatible function attribute
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f funcattrs -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 13:00:03 +02:00
Masashi Honma 330f2dd6bb tests: Use python3 compatible range operation
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f xrange -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 12:56:02 +02:00
Masashi Honma 35d8c2545e tests: Use python3 compatible dict operation
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f dict -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 12:53:05 +02:00
Masashi Honma 89896c0008 tests: Use python3 compatible print statement
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f print -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 12:37:25 +02:00
Masashi Honma bab493b904 tests: Use python3 compatible "except" statement
This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f except -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2019-01-26 12:11:35 +02:00
Jouni Malinen 6de2a80940 tests: SAE and password identifier (exclusively)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2019-01-24 00:20:49 +02:00
Jouni Malinen ad171ccd82 tests: Update README to refer to parallel-vm.py
parallel-vm.sh was removed earlier.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-22 13:27:31 +02:00
Jouni Malinen 3cd0adea26 tests: wpa_supplicant config parsing and storing for new variables
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-12 19:21:45 +02:00
Jouni Malinen 9b8e1f9044 tests: P2P group formation with random interface addresses
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-12 19:18:02 +02:00
Arnout Vandecappelle (Essensium/Mind) 222ff97bc3 tests: start.sh: fix logs/current symlink creation
Since 3bdc651a62, start.sh creates the logs/current symlink even if
LOGDIR was set in the environment, as is the case when using run-all.sh.
However, run-all.sh and start.sh use a separate 'date' invocation so the
resulting string may be different. Usually it is the same because the
two invocations immediately follow each other, *except* if run-all.sh
also does a build. In addition, if the user sets LOGDIR to something
else, the symlink is completely bogus.

Fix this by not relying on the 'date' invocation for creating the
symlink. Instead, use the basename of LOGDIR. To keep things consistent
with current behavior, only create the symlink if LOGDIR points to a
subdirectory of DIR/logs.

The following use cases now work reliably:
* run-all.sh with or without the -B option;
* manually calling start.sh followed by run-tests.py without setting
  LOGDIR.
* manually calling start.sh with LOGDIR set to a subdirectory of logs
  and calling run-tests.py without --logdir option (which makes it
  default to logs/current).
* run-all.sh with LOGDIR set to a subdirectory of logs.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2019-01-12 17:39:59 +02:00
Jouni Malinen cbf25808b9 tests: Build with various LibreSSL and OpenSSL versions
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-12 17:32:15 +02:00
Jouni Malinen 78a9ba72d0 tests: DFS CAC interrupted and restarted
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-08 01:12:02 +02:00
Jouni Malinen 72d909e749 tests: Supported operating classes with constraints
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-08 00:20:10 +02:00
Jouni Malinen 08e6721e87 tests: Remove MIB counter check from radius_auth_unreachable2
This is in preparation for an implementation change that results in this
unreachable server case not incrementing radiusAuthClientAccessRequests.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-07 23:38:18 +02:00
Jouni Malinen 5d2e9d1cf8 tests: Reduce mesh result code duplication with helper functions
These checks were repeated in almost every test case, so use helper
functions to get rid of duplicated (copy-pasted) code.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-07 00:25:08 +02:00
Jouni Malinen dc1aaa5d07 tests: Mesh with VHT20 and VHT40
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-07 00:01:23 +02:00
Jouni Malinen 06809f618d tests: WPA2-PSK+FT AP and workaround for incorrect STA behavior
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-06 21:20:34 +02:00
Jouni Malinen 2e71d0415b tests: disable_sgi with VHT
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-06 20:59:36 +02:00
Jouni Malinen 9aac73121b tests: More workarounds for cfg80211 regulatory state clearing (ap_open)
Add even more workarounds for cfg80211 regulatory state clearing since
these DFS test cases seem to be the most likely ones to fail due to
country=98 issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-06 13:21:19 +02:00
Jouni Malinen df71e16021 tests: More workarounds for cfg80211 regulatory state clearing (DFS)
Add even more workarounds for cfg80211 regulatory state clearing since
these DFS test cases seem to be the most likely ones to fail due to
country=98 issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-06 13:16:17 +02:00
Jouni Malinen 1185294944 tests: ACS for 160 MHz channel
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-06 01:45:26 +02:00
Jouni Malinen 24451276a1 tests: More workarounds for cfg80211 regulatory state clearing (WNM)
Add even more workarounds for cfg80211 regulatory state clearing since
these WNM test cases seem to be the most likely ones to fail due to
country=98 issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-05 22:06:03 +02:00
Jouni Malinen 67e34a284a tests: OpenSSL systemwide policy and overrides
Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-05 17:14:26 +02:00
Jouni Malinen cc0a04ac86 tests: Split mbo_supp_oper_classes into multiple test cases
In addition, add even more workarounds for cfg80211 regulatory state
clearing since this test case seems to be the most likely one to fail
due to country=98 issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-05 00:21:41 +02:00
Jouni Malinen 02a4ac0feb tests: WPA2-PSK-FT AP over DS and separate hostapd process
This is a regression test case for FT-over-DS that got broken on
mac80211-based drivers when the extra key reinstallation checks were
added.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-04 23:22:46 +02:00
Jouni Malinen 63a7683b2d tests: Split ap_ft_oom into separate test cases
ap_ft_oom seemed to depend on undesired wpa_supplicant behavior of
trying to do FT protocol even without being ready for reassociation.
This is going to be fixed in wpa_supplicant which would make this test
case fail, so split it into separate test cases for each failure item to
be able to avoid incorrect test failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-04 23:22:04 +02:00
Jouni Malinen 04e17e5024 tests: Verify that roaming attempts do not get rejected
The previous roam() and roam_over_ds() checks would have ignored failing
association rejection if a consecutive attempt to connect succeeds
within the initial time limit. This can miss incorrect behavior, so
check explicitly for association rejection.

Signed-off-by: Jouni Malinen <j@w1.fi>
2019-01-04 20:27:40 +02:00