]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
5 years agotests: AP not receiving Authentication frame ACK
Jouni Malinen [Mon, 11 Feb 2019 15:41:13 +0000 (17:41 +0200)] 
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>
5 years agoDo not disassociate not-associated STA on timeout
Jouni Malinen [Mon, 11 Feb 2019 15:37:08 +0000 (17:37 +0200)] 
Do not disassociate not-associated STA on timeout

If the ap_handle_timer() timeout is reached for a not-associated STA, do
not default to disassociating that STA first since Disassociation frame
is not really appropriate to send to a STA that is not in associated
state. Instead, skip directly to deauthentication and STA entry removal.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoOpenSSL: Fix uninitialized variable in CRL reloading corner case
Jouni Malinen [Mon, 11 Feb 2019 12:00:13 +0000 (14:00 +0200)] 
OpenSSL: Fix uninitialized variable in CRL reloading corner case

The flags variable needs to be initialized to 0 if check_crl is 0 in
the updated configuration.

Fixes: 159a7fbdeafe ("crl_reload_interval: Add CRL reloading support")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUse for_each_element() in ieee802_11_parse_elems()
Jouni Malinen [Mon, 11 Feb 2019 11:51:11 +0000 (13:51 +0200)] 
Use for_each_element() in ieee802_11_parse_elems()

Use the new iteration macro to simplify the impelmentation and make it
more consistent with other IE parsers.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agocommon: Use for_each_element_id/_extid for get_ie/get_ie_ext/get_vendor_ie
Johannes Berg [Fri, 8 Feb 2019 16:57:52 +0000 (17:57 +0100)] 
common: Use for_each_element_id/_extid for get_ie/get_ie_ext/get_vendor_ie

Simplifications based on the new iteration macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Use for_each_element_id() in mb_ies_info_by_ies()
Johannes Berg [Fri, 8 Feb 2019 16:57:51 +0000 (17:57 +0100)] 
common: Use for_each_element_id() in mb_ies_info_by_ies()

The change is bigger because here we need to catch the error
condition if the last element doesn't fit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Use for_each_element_id() in ieee802_11_vendor_ie_concat()
Johannes Berg [Fri, 8 Feb 2019 16:57:50 +0000 (17:57 +0100)] 
common: Use for_each_element_id() in ieee802_11_vendor_ie_concat()

Simple cleanup using the new iteration helper macro.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Use for_each_element() in ieee802_11_ie_count()
Johannes Berg [Fri, 8 Feb 2019 16:57:49 +0000 (17:57 +0100)] 
common: Use for_each_element() in ieee802_11_ie_count()

Simple cleanup using the new macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Add strongly typed element iteration macros
Johannes Berg [Fri, 8 Feb 2019 16:57:48 +0000 (17:57 +0100)] 
common: Add strongly typed element iteration macros

Rather than always iterating elements from frames with pure
u8 pointers, add a type "struct element" that encapsulates
the id/datalen/data format of them.

Then, add the element iteration macros
 * for_each_element
 * for_each_element_id
 * for_each_element_extid

which take, as their first 'argument', such a structure and
iterate through a given u8 array interpreting it as elements.

While at it also add
 * for_each_subelement
 * for_each_subelement_id
 * for_each_subelement_extid

which instead of taking data/length just take an outer element
and use its data/datalen.

Also add for_each_element_completed() to determine if any of
the loops above completed, i.e., it was able to parse all of
the elements successfully and no data remained.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agotests: Catch only specific exceptions
Masashi Honma [Sun, 10 Feb 2019 08:43:10 +0000 (17:43 +0900)] 
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>
5 years agotests: Document some of the test tools
Jouni Malinen [Sun, 10 Feb 2019 15:59:38 +0000 (17:59 +0200)] 
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>
5 years agotests: Fix wnm-fuzzer by adding dummy configuration
Jouni Malinen [Sun, 10 Feb 2019 15:55:42 +0000 (17:55 +0200)] 
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>
5 years agotests: EAPOL-Key fuzzing tool
Jouni Malinen [Sun, 10 Feb 2019 15:02:49 +0000 (17:02 +0200)] 
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>
5 years agoRSN: Do not start preauthentication timer without candidates
Jouni Malinen [Sun, 10 Feb 2019 11:41:10 +0000 (13:41 +0200)] 
RSN: Do not start preauthentication timer without candidates

There is no need to schedule the postponed RSN preauthentication start
if there are no candidates. Avoid wasting eloop resources for this.

This is most useful for fuzz testing of the 4-way handshake
implementation to avoid getting stuck waiting for this unnecessary one
second time when using eloop to coordinate the Authenticator and
Supplicant state machines.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoeap_example: Update expired certificates
Jouni Malinen [Sun, 10 Feb 2019 09:39:05 +0000 (11:39 +0200)] 
eap_example: Update expired certificates

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoJSON: Fix string parsing when \\ escape is at the end of buffer
Jouni Malinen [Sat, 9 Feb 2019 23:40:36 +0000 (01:40 +0200)] 
JSON: Fix string parsing when \\ escape is at the end of buffer

This would have resulted in reading one octet past the end of the buffer
before rejecting the string.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoJSON: Fix parsing of a number from the end of the buffer
Jouni Malinen [Sat, 9 Feb 2019 23:33:42 +0000 (01:33 +0200)] 
JSON: Fix parsing of a number from the end of the buffer

Avoid reading one octet past the end of the buffer when parsing a number
that is at the very end of the buffer.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: JSON parser fuzzer
Jouni Malinen [Sat, 9 Feb 2019 19:38:56 +0000 (21:38 +0200)] 
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>
5 years agoTLS: Fix X.509 certificate name conversion into empty string
Jouni Malinen [Sat, 9 Feb 2019 23:51:51 +0000 (01:51 +0200)] 
TLS: Fix X.509 certificate name conversion into empty string

If none of the supported name attributes are present, the name string
was nul terminated only at the end. Add an explicit nul termination at
the end of the last written (or beginning of the buffer, if nothing is
written) to avoid writing uninitialized data to debug log.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS: Fix ASN.1 parsing with no room for the header
Jouni Malinen [Sat, 9 Feb 2019 23:34:24 +0000 (01:34 +0200)] 
TLS: Fix ASN.1 parsing with no room for the header

Explicitly check the remaining buffer length before trying to read the
ASN.1 header values. Attempt to parse an ASN.1 header when there was not
enough buffer room for it would have started by reading one or two
octets beyond the end of the buffer before reporting invalid data at the
following explicit check for buffer room.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS: Fix AlertDescription for missing partial processing case
Jouni Malinen [Sat, 9 Feb 2019 23:08:07 +0000 (01:08 +0200)] 
TLS: Fix AlertDescription for missing partial processing case

tlsv1_record_receive() did not return error here and as such, &alert was
not set and must not be used. Report internal error instead to avoid use
of uninitialized memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: TLS fuzzing tool
Jouni Malinen [Sat, 9 Feb 2019 19:07:24 +0000 (21:07 +0200)] 
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>
5 years agotests: Add a simple HTTPS server for TLS testing
Jouni Malinen [Sat, 9 Feb 2019 15:05:36 +0000 (17:05 +0200)] 
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>
5 years agoTLS server: Check credentials have been configured before using them
Jouni Malinen [Sat, 9 Feb 2019 16:06:33 +0000 (18:06 +0200)] 
TLS server: Check credentials have been configured before using them

Allow ServerHello to be built without local credential configuration.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS server: Local failure information on verify_data mismatch
Jouni Malinen [Sat, 9 Feb 2019 16:05:45 +0000 (18:05 +0200)] 
TLS server: Local failure information on verify_data mismatch

Mark connection state FAILED in this case even though TLS Alert is not
sent.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS server: Add internal callbacks get_failed, get_*_alerts
Jouni Malinen [Sat, 9 Feb 2019 15:58:43 +0000 (17:58 +0200)] 
TLS server: Add internal callbacks get_failed, get_*_alerts

These can be used to implement cleaner termination of the handshake in
case of failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS server: More complete logging of ClientHello decode errors
Jouni Malinen [Sat, 9 Feb 2019 15:30:02 +0000 (17:30 +0200)] 
TLS server: More complete logging of ClientHello decode errors

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS client: Fix peer certificate event checking for probing
Jouni Malinen [Sat, 9 Feb 2019 14:10:47 +0000 (16:10 +0200)] 
TLS client: Fix peer certificate event checking for probing

conn->cred might be NULL here, so check for that explicitly before
checking whether conn->cred->cert_probe is set. This fixes a potential
NULL pointer dereference when going through peer certificates with
event_cb functionality enabled.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoOpenSSL: Add more handshake message names to debug
Jouni Malinen [Sat, 9 Feb 2019 21:58:58 +0000 (23:58 +0200)] 
OpenSSL: Add more handshake message names to debug

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Explicitly flush stdin for python3
Masashi Honma [Fri, 8 Feb 2019 22:51:10 +0000 (07:51 +0900)] 
tests: Explicitly flush stdin for python3

Without this flush(), test does not run.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Encode VM input for python3
Masashi Honma [Fri, 8 Feb 2019 22:51:09 +0000 (07:51 +0900)] 
tests: Encode VM input for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Decode VM output for python3
Masashi Honma [Fri, 8 Feb 2019 22:51:08 +0000 (07:51 +0900)] 
tests: Decode VM output for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Change handling of reading non blocked empty stream for python3
Masashi Honma [Fri, 8 Feb 2019 22:51:07 +0000 (07:51 +0900)] 
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>
5 years agotests: EAP-TLS and TLS 1.3
Jouni Malinen [Sat, 9 Feb 2019 22:10:53 +0000 (00:10 +0200)] 
tests: EAP-TLS and TLS 1.3

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl80211: Use wpa_ssid_txt() for debug messages more consistently
Jouni Malinen [Sat, 9 Feb 2019 22:06:26 +0000 (00:06 +0200)] 
nl80211: Use wpa_ssid_txt() for debug messages more consistently

Print the SSID with printf escaping instead of wpa_hexdump_ascii()
format to clean up the debug log a bit. This was already done for number
of SSID debug prints.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoNote HT overrides in debug log only if set
Jouni Malinen [Sat, 9 Feb 2019 22:00:35 +0000 (00:00 +0200)] 
Note HT overrides in debug log only if set

This makes the debug log cleaner by removing the mostly confusing prints
about HT override parameters if they are not actually used.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoP2P: Update find_start timer only when p2p_scan is started.
Purushottam Kushwaha [Fri, 1 Feb 2019 11:46:40 +0000 (17:16 +0530)] 
P2P: Update find_start timer only when p2p_scan is started.

p2p->find_start timer was updated on each p2p_find call irrespective of
p2p_find being successful/failed/rejected. For cases where p2p_find was
in progress/pending, another call to p2p_find would be rejected but
p2p->find_start timer would still be updated.

p2p->find_start is maintained in wpa_supplicant to reject the kernel
scan entries before the p2p->find_start time. In above scenario, some of
the scan entries could be discarded even if the Probe Respons frame(s)
were received during the last scan/p2p_find.

This commit changes this to update the p2p->find_start timer only when
call to p2p_find is successful, i.e., a new scan is actually started.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: hwsim: macsec: correct configuration reference
Johannes Berg [Wed, 6 Feb 2019 09:43:49 +0000 (10:43 +0100)] 
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>
5 years agoMBO: Move the WNM-Notification subtype definitions to common location
Jouni Malinen [Thu, 31 Jan 2019 10:57:04 +0000 (12:57 +0200)] 
MBO: Move the WNM-Notification subtype definitions to common location

Do not use a separate enum for MBO WNM-Notification Request frame
subtype values since these share the same number space with the Hotspot
2.0 ones.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoHS 2.0: Update the T&C Acceptance subtype value
Jouni Malinen [Thu, 31 Jan 2019 10:54:33 +0000 (12:54 +0200)] 
HS 2.0: Update the T&C Acceptance subtype value

The previously used value 2 was already assigned for another purpose
(MBO non-preferred channel report), so the newer T&C Acceptable
definition needs to be updated with a unique value.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Make /etc/alternatives work in VM
Johannes Berg [Sat, 2 Feb 2019 22:38:35 +0000 (23:38 +0100)] 
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>
5 years agotests: Add sigma_dut to .gitignore
Johannes Berg [Sat, 2 Feb 2019 22:16:07 +0000 (23:16 +0100)] 
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>
5 years agotests: Build hs20-osu-client
Johannes Berg [Sat, 2 Feb 2019 22:16:05 +0000 (23:16 +0100)] 
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>
5 years agoHS 2.0: Add QUIET=1 support for building hs20-osu-client
Johannes Berg [Sat, 2 Feb 2019 22:16:05 +0000 (23:16 +0100)] 
HS 2.0: Add QUIET=1 support for building hs20-osu-client

Add QUIET=1 support to its Makefile and add the created binary to a
.gitignore file.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agotests: Remove useless test list from run-tests.py help
Johannes Berg [Sat, 2 Feb 2019 22:16:04 +0000 (23:16 +0100)] 
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>
5 years agotests: Add test reconnecting on assoc failure
Johannes Berg [Sat, 2 Feb 2019 22:16:03 +0000 (23:16 +0100)] 
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>
5 years agoAdd FT-PSK to GET_CAPABILITY key_mgmt
Masashi Honma [Tue, 5 Feb 2019 21:06:44 +0000 (06:06 +0900)] 
Add FT-PSK to GET_CAPABILITY key_mgmt

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: PEAP/GTC key lifetime in memory
Jouni Malinen [Tue, 5 Feb 2019 19:26:49 +0000 (21:26 +0200)] 
tests: PEAP/GTC key lifetime in memory

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Clear PMKID add command message buffer
Jouni Malinen [Tue, 5 Feb 2019 18:36:28 +0000 (20:36 +0200)] 
nl80211: Clear PMKID add command message buffer

This command has now been extended to include PMK for offload needs, so
the message buffer needs to be cleared explicitly after use to avoid
leaving such material in heap memory unnecessarily.

Fixes: 061a3d3d5300 ("nl80211: Add support for FILS Cache Identifier in add/remove_pmkid()")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Clear connect command message buffer
Jouni Malinen [Tue, 5 Feb 2019 18:34:34 +0000 (20:34 +0200)] 
nl80211: Clear connect command message buffer

This command can include keys (WEP or PSK for offload), so the message
buffer needs to be cleared explicitly after use to avoid leaving such
material in heap memory unnecessarily.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Request kernel to trim off payload of netlink requests from acks
Jouni Malinen [Tue, 5 Feb 2019 18:30:08 +0000 (20:30 +0200)] 
nl80211: Request kernel to trim off payload of netlink requests from acks

We do not need such payload in the acknowledgment, so adding it uses
resources unnecessarily. Furthermore, the original request can include
key material (e.g., NL80211_ATTR_PMK). libnl does not explicitly clear
this received message buffer and it would be inconvenient for
wpa_supplicant/hostapd to try to clear it with the current libnl design
where a duplicated buffer is actually passed to the callback. This means
that keys might be left unnecessarily in heap memory. Avoid this by
requesting the kernel not to copy back the request payload.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoEAP peer: Clear temporary message buffers before freeing
Jouni Malinen [Tue, 5 Feb 2019 18:26:50 +0000 (20:26 +0200)] 
EAP peer: Clear temporary message buffers before freeing

These buffers in TLS-based EAP methods might contain keys or password
(e.g., when using TTLS-PAP or PEAP-GTC), so clear them explicitly to
avoid leaving such material into heap memory unnecessarily.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoClear config item writing buffer before freeing it
Jouni Malinen [Tue, 5 Feb 2019 18:25:21 +0000 (20:25 +0200)] 
Clear config item writing buffer before freeing it

This buffer may be used to store items like passwords, so better clean
it explicitly to avoid possibility of leaving such items in heap memory
unnecessarily.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Fix EAP-FAST protocol testing with python3
Jouni Malinen [Tue, 5 Feb 2019 13:50:45 +0000 (15:50 +0200)] 
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>
5 years agotests: Optionally start telnet server inside VMs
Johannes Berg [Tue, 5 Feb 2019 11:26:58 +0000 (12:26 +0100)] 
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>
5 years agotests: Suppress annoying console reset from VMs
Johannes Berg [Tue, 5 Feb 2019 11:26:46 +0000 (12:26 +0100)] 
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>
5 years agotests: Support python3 in multi-ocsp test cases
Jouni Malinen [Tue, 5 Feb 2019 01:04:56 +0000 (03:04 +0200)] 
tests: Support python3 in multi-ocsp test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Fix multi-ocsp response conents
Jouni Malinen [Tue, 5 Feb 2019 01:01:38 +0000 (03:01 +0200)] 
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>
5 years agotests: Create radio for p2ps_channel_active_go_and_station_different_mcc
Jouni Malinen [Tue, 5 Feb 2019 00:12:00 +0000 (02:12 +0200)] 
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>
5 years agotests: Create radio for p2ps_channel_both_connected_different_mcc
Johannes Berg [Sat, 2 Feb 2019 23:04:31 +0000 (00:04 +0100)] 
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>
5 years agotests: Multi-BSSID test cases with python3
Jouni Malinen [Mon, 4 Feb 2019 18:01:48 +0000 (20:01 +0200)] 
tests: Multi-BSSID test cases with python3

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Encode Disconnect-Request attributes in sorted order for python3
Jouni Malinen [Mon, 4 Feb 2019 17:27:57 +0000 (19:27 +0200)] 
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>
5 years agotests: Clean up pyrad test cases for python3 compatibility
Jouni Malinen [Mon, 4 Feb 2019 16:26:53 +0000 (18:26 +0200)] 
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>
5 years agoD-Bus: Fix P2P DeleteService dict iteration
Jouni Malinen [Mon, 4 Feb 2019 15:13:54 +0000 (17:13 +0200)] 
D-Bus: Fix P2P DeleteService dict iteration

The previous implementation assumed the first entry coming out from the
dict is always service_type. That may not be the case, so properly
iterate over all dict entries in one loop instead of assuming what the
first entry is.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Decode sigma_dut output for python3
Jouni Malinen [Mon, 4 Feb 2019 14:48:22 +0000 (16:48 +0200)] 
tests: Decode sigma_dut output for python3

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Read sigma_dut-ap.conf as binary data for python3 compatibility
Jouni Malinen [Mon, 4 Feb 2019 14:46:31 +0000 (16:46 +0200)] 
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>
5 years agotests: Replace file() with open() to work with python3
Jouni Malinen [Mon, 4 Feb 2019 14:11:42 +0000 (16:11 +0200)] 
tests: Replace file() with open() to work with python3

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: MAC address ASCII string generation in python3 compatible manner
Jouni Malinen [Mon, 4 Feb 2019 10:23:45 +0000 (12:23 +0200)] 
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>
5 years agoD-Bus: Fix a memory leak in DeleteService handler
Jouni Malinen [Mon, 4 Feb 2019 01:02:25 +0000 (03:02 +0200)] 
D-Bus: Fix a memory leak in DeleteService handler

If the service_type string entry is not included, the dict entry was not
cleared.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Replace dict.has_key() with the in operator for python3
Masashi Honma [Mon, 4 Feb 2019 00:56:53 +0000 (02:56 +0200)] 
tests: Replace dict.has_key() with the in operator for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Use binary mode for writing WPS attributes
Masashi Honma [Mon, 4 Feb 2019 00:41:19 +0000 (02:41 +0200)] 
tests: Use binary mode for writing WPS attributes

This is needed for python3.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Decode StreamRequestHandler read for python3
Masashi Honma [Mon, 4 Feb 2019 00:39:10 +0000 (02:39 +0200)] 
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>
5 years agotests: Decode upnp_soap_action() response for python3
Masashi Honma [Mon, 4 Feb 2019 00:32:52 +0000 (02:32 +0200)] 
tests: Decode upnp_soap_action() response for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: ElementTree string representation in python3 compatible manner
Masashi Honma [Mon, 4 Feb 2019 00:30:15 +0000 (02:30 +0200)] 
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>
5 years agotests: urlopen() compatibility for python3
Masashi Honma [Mon, 4 Feb 2019 00:13:31 +0000 (02:13 +0200)] 
tests: urlopen() compatibility for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Extend build_wsc_attr() to accept both bytes and str objects
Jouni Malinen [Sun, 3 Feb 2019 23:48:43 +0000 (01:48 +0200)] 
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>
5 years agotests: Fix struct.unpack() call for a single octet with python3
Jouni Malinen [Sun, 3 Feb 2019 23:46:32 +0000 (01:46 +0200)] 
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>
5 years agotests: Remove forgotten development time print
Jouni Malinen [Sun, 3 Feb 2019 23:22:45 +0000 (01:22 +0200)] 
tests: Remove forgotten development time print

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Open Hotspot 2.0 icon files in binary modes for python3
Masashi Honma [Sun, 3 Feb 2019 23:15:36 +0000 (01:15 +0200)] 
tests: Open Hotspot 2.0 icon files in binary modes for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Encode/decode base64 operations for python3
Masashi Honma [Sun, 3 Feb 2019 16:33:00 +0000 (18:33 +0200)] 
tests: Encode/decode base64 operations for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: python3 compatible way of importing gobject for D-Bus testing
Jouni Malinen [Sun, 3 Feb 2019 15:16:28 +0000 (17:16 +0200)] 
tests: python3 compatible way of importing gobject for D-Bus testing

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Use floor division (//) to avoid issues with python3
Jouni Malinen [Sun, 3 Feb 2019 13:06:05 +0000 (15:06 +0200)] 
tests: Use floor division (//) to avoid issues with python3

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Decode Popen output in wmediumd test sets for python3
Masashi Honma [Thu, 31 Jan 2019 08:16:12 +0000 (17:16 +0900)] 
tests: Decode Popen output in wmediumd test sets for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: python3 compatible str/bytes ord()
Jouni Malinen [Sun, 3 Feb 2019 10:44:17 +0000 (12:44 +0200)] 
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>
5 years agotests: Replace str.translate() with str.replace()
Jouni Malinen [Sun, 3 Feb 2019 10:24:49 +0000 (12:24 +0200)] 
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>
5 years agotests: Fix erp_home_realm_oom error on python3
Masashi Honma [Thu, 31 Jan 2019 08:15:55 +0000 (17:15 +0900)] 
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>
5 years agotests: Explicit str/bytes conversion for key_lifetime_in_memory
Jouni Malinen [Sat, 2 Feb 2019 16:50:13 +0000 (18:50 +0200)] 
tests: Explicit str/bytes conversion for key_lifetime_in_memory

This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Explicit str/bytes conversion in sigma_dut_venue_url
Jouni Malinen [Sat, 2 Feb 2019 16:29:11 +0000 (18:29 +0200)] 
tests: Explicit str/bytes conversion in sigma_dut_venue_url

This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Replace str.decode('hex') with binascii.unhexlify() for python3
Masashi Honma [Sat, 2 Feb 2019 16:01:41 +0000 (18:01 +0200)] 
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>
5 years agotests: Replace str.encode('hex') with binascii.hexlify() for python3
Masashi Honma [Sat, 2 Feb 2019 16:19:35 +0000 (18:19 +0200)] 
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>
5 years agotests: Decode Popen() output for python3
Masashi Honma [Thu, 31 Jan 2019 08:16:02 +0000 (17:16 +0900)] 
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>
5 years agotests: Use 'b' prefix to mark Bytes literals explicitly for python3
Masashi Honma [Sat, 2 Feb 2019 15:52:25 +0000 (17:52 +0200)] 
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>
5 years agotests: Decode subprocess.check_output() return value for python3
Masashi Honma [Thu, 31 Jan 2019 08:15:42 +0000 (17:15 +0900)] 
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>
5 years agotests: rfkill with python3 compatible version
Masashi Honma [Thu, 31 Jan 2019 08:15:43 +0000 (17:15 +0900)] 
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>
5 years agotests: nl80211 attr with python3 compatible version
Masashi Honma [Thu, 31 Jan 2019 08:15:43 +0000 (17:15 +0900)] 
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>
5 years agotests: HWSimController class with python3 compatible version
Masashi Honma [Thu, 31 Jan 2019 08:15:43 +0000 (17:15 +0900)] 
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>
5 years agotests: Explicitly encode str to bytes when needed for python3
Masashi Honma [Sat, 2 Feb 2019 14:25:57 +0000 (16:25 +0200)] 
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>
5 years agotests: Fix failure for WPA-EAP-SUITE-B-192 key_mgmt
Masashi Honma [Thu, 31 Jan 2019 08:16:14 +0000 (17:16 +0900)] 
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>
5 years agotests: Explicit str/bytes conversion for socket operations for python3
Masashi Honma [Thu, 31 Jan 2019 08:16:15 +0000 (17:16 +0900)] 
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>
5 years agotests: Read binary file in add_log_file() for python3
Jouni Malinen [Sat, 2 Feb 2019 11:08:08 +0000 (13:08 +0200)] 
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>