]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
5 years agotests: Clear regulatory domain on the correct remote device
Janusz Dziedzic [Sun, 8 Mar 2020 13:27:03 +0000 (14:27 +0100)] 
tests: Clear regulatory domain on the correct remote device

In case we run remote tests we need to clear/set regulatory domain on
the correct device.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Allow to run module tests
Janusz Dziedzic [Sun, 8 Mar 2020 13:27:02 +0000 (14:27 +0100)] 
tests: remote: Allow to run module tests

Add a new command line option -f (--modules) that will run all test
cases from the specified module(s).

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agoSAE: Expose sae_write_commit() error cases to callers
Jouni Malinen [Sun, 8 Mar 2020 14:59:42 +0000 (16:59 +0200)] 
SAE: Expose sae_write_commit() error cases to callers

Check whether an error is reported from any of the functions that could
in theory fail and if so, do not proceed with the partially filled SAE
commit buffer.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoSAE: Check hmac_sha256() result in sae_token_hash()
Jouni Malinen [Sun, 8 Mar 2020 14:51:30 +0000 (16:51 +0200)] 
SAE: Check hmac_sha256() result in sae_token_hash()

In theory, hmac_sha256() might fail, so check for that possibility
instead of continuing with undetermined index value that could point to
an arbitrary token entry.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl80211: Fix error print for hapd_send_eapol()
Jouni Malinen [Sun, 8 Mar 2020 14:48:00 +0000 (16:48 +0200)] 
nl80211: Fix error print for hapd_send_eapol()

The return value from nl80211_send_monitor() is not suitable for use
with strerror(). Furthermore, nl80211_send_monitor() itself is printing
out a more detailed error reason.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoos_unix: Call srandom() only if os_get_random() succeeds
Jouni Malinen [Sun, 8 Mar 2020 14:43:09 +0000 (16:43 +0200)] 
os_unix: Call srandom() only if os_get_random() succeeds

Don't use uninitialized stack memory if /dev/urandom is not available.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl80211: Fix tx_control_port error print
Jouni Malinen [Sun, 8 Mar 2020 14:38:57 +0000 (16:38 +0200)] 
nl80211: Fix tx_control_port error print

send_and_recv_msgs() returns a negative number as the error code and
that needs to be negated for strerror().

Fixes: 8759e9116aa6 ("nl80211: Control port over nl80211 helpers")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoDPP: Remove unreachable return statement
Jouni Malinen [Sun, 8 Mar 2020 14:35:45 +0000 (16:35 +0200)] 
DPP: Remove unreachable return statement

This was forgotten from an earlier development version.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoSAE: Check sta pointer more consistently in testing code
Jouni Malinen [Sun, 8 Mar 2020 14:32:47 +0000 (16:32 +0200)] 
SAE: Check sta pointer more consistently in testing code

send_auth_reply() could be called with sta == NULL in certain error
conditions. While that is not applicable for this special test
functionality for SAE, the inconsistent checks for the sta pointer could
result in warnings from static analyzers. Address this by explicitly
checking the sta pointer here.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoClean up hostapd_get_he_twt_responder() processing
Jouni Malinen [Sun, 8 Mar 2020 14:28:03 +0000 (16:28 +0200)] 
Clean up hostapd_get_he_twt_responder() processing

mode->he_capab is an array and as such, there is no point in checking
whether it is NULL since that cannot be the case. Check for the
he_supported flag instead. In addition, convert the TWT responder
capability bit into a fixed value 1 to avoid any surprising to the
callers. In practice, neither of these changes results in different
behavior in the current implementation, but this is more robust.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoDPP: Fix connectorTemplate addition
Jouni Malinen [Sun, 8 Mar 2020 14:18:22 +0000 (16:18 +0200)] 
DPP: Fix connectorTemplate addition

There was a copy-paste error in this code that would be adding the
connectorTemplate once that becomes available. In practice, this was not
reachable code, but anyway, this should be ready for potential addition
of connectorTemplate in the future.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoReplace systemd install Alias with WantedBy
Joshua DeWeese [Mon, 4 Feb 2019 20:43:29 +0000 (15:43 -0500)] 
Replace systemd install Alias with WantedBy

According to the systemd documentation "WantedBy=foo.service in a
service bar.service is mostly equivalent to
Alias=foo.service.wants/bar.service in the same file." However,
this is not really the intended purpose of install Aliases.

Signed-off-by: Joshua DeWeese <jdeweese@hennypenny.com>
5 years agotests: Fix sigma_dut_sae_pw_id_pwe_loop to clear sae_pwe setting
Jouni Malinen [Sun, 8 Mar 2020 11:49:22 +0000 (13:49 +0200)] 
tests: Fix sigma_dut_sae_pw_id_pwe_loop to clear sae_pwe setting

Leaving out the special sae_pwe value was causing failures for following
test cases, e.g., in the following sequence:
sigma_dut_sae_pw_id_pwe_loop sae_password_id_only

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Opportunistic Wireless Encryption transition mode and RSNE mismatch
Jouni Malinen [Sun, 8 Mar 2020 11:21:11 +0000 (13:21 +0200)] 
tests: Opportunistic Wireless Encryption transition mode and RSNE mismatch

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoRSN: Stop 4-way handshake if scan results are not available
Jouni Malinen [Sun, 8 Mar 2020 11:11:50 +0000 (13:11 +0200)] 
RSN: Stop 4-way handshake if scan results are not available

While there may have initially been cases where the RSNE from
Beacon/Probe Response frames was not available from some drivers, it is
now more valuable to notice if such a case were to be hit with drivers
that are always expected to have such information available. As such,
make it a fatal error if the scan results for the current AP are not
available to check the RSNE/RSNXE in EAPOL-Key msg 3/4.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoOWE: Allow BSS entry with different SSID to be used in transition mode
Jouni Malinen [Sun, 8 Mar 2020 09:29:45 +0000 (11:29 +0200)] 
OWE: Allow BSS entry with different SSID to be used in transition mode

Similarly to the wpa_supplicant_select_config() case,
wpa_get_beacon_ie() needs to handle the special case for OWE transition
mode where the SSID in the network profile does not match the SSID of
the OWE BSS (that has a hidden, random SSID). Accept such a BSS in case
the current scan results needs to be fetched for verifying EAPOL-Key msg
3/4 IEs.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoOWE: Mark BSS for transition mode based on active OWE network profiles
Jouni Malinen [Sun, 8 Mar 2020 14:13:35 +0000 (16:13 +0200)] 
OWE: Mark BSS for transition mode based on active OWE network profiles

It is possible for the hidden OWE BSS to be found based on SSID-specific
scan (e.g., from the special OWE scan mechanism). In that sequence, the
previously used learning of OWE BSS was skipped since the SSID was
already present in the BSS entry. This could result in not being able to
find a matching BSS entry for the OWE BSS in transition mode.

Fix this by adding the BSS flag for transition mode based on SSID
matching against currently enabled OWE network profiles in addition to
the previous mechanism.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoOWE: Avoid incorrect profile update in transition mode
Jouni Malinen [Sat, 7 Mar 2020 16:03:32 +0000 (18:03 +0200)] 
OWE: Avoid incorrect profile update in transition mode

The "unexpected" change of SSID between the current network profile
(which uses the SSID from the open BSS in OWE transition mode) and the
association with the OWE BSS (which uses a random, hidden SSID) resulted
in wpa_supplicant incorrectly determining that this was a
driver-initiated BSS selection ("Driver-initiated BSS selection changed
the SSID to <the random SSID from OWE BSS>" in debug log).

This ended up with updating security parameters based on the network
profile inwpa_supplicant_set_suites() instead of using the already
discovered information from scan results. In particular, this cleared
the RSN supplicant state machine information of AP RSNE and resulted in
having to fetch the scan results for the current BSS when processing
EAPOL-Key msg 3/4.

Fix this by recognizing the special case for OWE transition mode where
the SSID for the associated AP does not actually match the SSID in the
network profile.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFT: Silence debug prints when FT is not actually used
Jouni Malinen [Sat, 7 Mar 2020 15:42:50 +0000 (17:42 +0200)] 
FT: Silence debug prints when FT is not actually used

Avoid printing confusing FT debug entries from wpa_sm_set_ft_params()
when FT is not actually used for the connection.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoRecognize OWE Transition Mode element in IE parser
Jouni Malinen [Sat, 7 Mar 2020 15:27:32 +0000 (17:27 +0200)] 
Recognize OWE Transition Mode element in IE parser

This silences the debug log entry on unknown WFA IE being ignored.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: RSNXE mismatch in EAPOL-Key msg 3/4
Jouni Malinen [Sat, 7 Mar 2020 15:06:12 +0000 (17:06 +0200)] 
tests: RSNXE mismatch in EAPOL-Key msg 3/4

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoReport RSNXE mismatch in EAPOL-Key msg 3/4 more consistently with RSNE
Jouni Malinen [Sat, 7 Mar 2020 15:05:01 +0000 (17:05 +0200)] 
Report RSNXE mismatch in EAPOL-Key msg 3/4 more consistently with RSNE

Use the same reason code to indicate that IE different in 4-way
handshake and also print a hexdump of RSNXE in both Beacon/ProbeResp and
EAPOL-Key msg 3/4 in the log.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: RSNE mismatch in EAPOL-Key msg 3/4
Jouni Malinen [Sat, 7 Mar 2020 14:57:08 +0000 (16:57 +0200)] 
tests: RSNE mismatch in EAPOL-Key msg 3/4

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoAllow RSNE in EAPOL-Key msg 3/4 to be replaced for testing purposes
Jouni Malinen [Sat, 7 Mar 2020 14:45:52 +0000 (16:45 +0200)] 
Allow RSNE in EAPOL-Key msg 3/4 to be replaced for testing purposes

The new hostapd configuration parameter rsne_override_eapol can now be
used similarly to the previously added rsnxe_override_eapol to override
(replace contents or remove) RSNE in EAPOL-Key msg 3/4. This can be used
for station protocol testing to verify sufficient checks for RSNE
modification between the Beacon/Probe Response frames and EAPOL-Key msg
3/4.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: RSNXE missing from EAPOL-Key msg 3/4
Jouni Malinen [Sat, 7 Mar 2020 14:42:47 +0000 (16:42 +0200)] 
tests: RSNXE missing from EAPOL-Key msg 3/4

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoExtend hostapd rsnxe_override_eapol to allow IE removal
Jouni Malinen [Sat, 7 Mar 2020 14:39:36 +0000 (16:39 +0200)] 
Extend hostapd rsnxe_override_eapol to allow IE removal

Previous implementation was determining whether the override value was
set based on its length being larger than zero. Replace this with an
explicit indication of whether the parameter is set to allow zero length
replacement, i.e., remove of RSNXE from EAPOL-Key msg 3/4.

In addition, move IE replacement into a more generic helper function to
allow this to be used with other IEs as well.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: WPA2-EAP AP with STA using 4addr mode
Jouni Malinen [Sat, 7 Mar 2020 11:59:17 +0000 (13:59 +0200)] 
tests: WPA2-EAP AP with STA using 4addr mode

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoDo not override WDS VLAN assignment for STA
Jouni Malinen [Sat, 7 Mar 2020 11:56:56 +0000 (13:56 +0200)] 
Do not override WDS VLAN assignment for STA

The 4-address frames WDS design in mac80211 uses VLAN interfaces
similarly to the way VLAN interfaces based on VLAN IDs are used. The EAP
authentication case ended up overriding the WDS specific assignment even
when the RADIUS server did not assign any specific VLAN for the STA.
This broke WDS traffic.

Fix this by skipping VLAN assignment to VLAN ID 0 for STAs that have
been detected to use 4-address frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoHS 2.0 server: Allow OCSP responder to continue running after errors
Jouni Malinen [Sat, 7 Mar 2020 11:26:56 +0000 (13:26 +0200)] 
HS 2.0 server: Allow OCSP responder to continue running after errors

By default, 'openssl ocsp' exits upon receiving a malformed request.
That's not really ideal for a server, so configure openssl to not do
that and instead, continue running to process other requests.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Fix http://localhost:12345/ redirect handling
Jouni Malinen [Sat, 7 Mar 2020 09:51:23 +0000 (11:51 +0200)] 
webkit2: Fix http://localhost:12345/ redirect handling

The resource-load-started cannot be used to replace the older
resource-request-starting signal and as such, the final redirect to the
special http://localhost:12345/ URL did not work. Use the decide-policy
signal for navigation action instead.

Also remove the attempt to modify the request URI from
resource-load-started since that is not going to work either. This is
not really critical for functionality, but could eventually be replaced
with a handler for the WebKitWebPage send-request signal.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: sigma_dut with OWE PTK workaround
Jouni Malinen [Fri, 6 Mar 2020 19:38:01 +0000 (21:38 +0200)] 
tests: sigma_dut with OWE PTK workaround

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoReplace WPA_ALG_PMK with KEY_FLAG_PMK
Alexander Wetzel [Thu, 5 Mar 2020 21:06:46 +0000 (22:06 +0100)] 
Replace WPA_ALG_PMK with KEY_FLAG_PMK

Drop the no longer needed internal alg WPA_ALG_PMK and use KEY_FLAG_PMK
as replacement.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Drop outdated TDLS set_key() hack
Alexander Wetzel [Thu, 5 Mar 2020 21:06:45 +0000 (22:06 +0100)] 
nl80211: Drop outdated TDLS set_key() hack

wpa_tdls_set_key() did set the key_id to -1 to avoid a useless
NL80211_CMD_SET_KEY call that the updated nl80211 driver no longer
carries out. Remove the no longer required workaround.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agowpa_cli: Add missing quote around interface name
Andrew Siplas [Thu, 5 Mar 2020 01:55:18 +0000 (20:55 -0500)] 
wpa_cli: Add missing quote around interface name

There was only an open quote present.

Signed-off-by: Andrew Siplas <andrew@asiplas.net>
5 years agoDFS: Add support for 80+80 MHz when going through channel switch
Pravas Kumar Panda [Fri, 6 Mar 2020 09:36:42 +0000 (15:06 +0530)] 
DFS: Add support for 80+80 MHz when going through channel switch

After a radar signal is detected, the AP should switch to another
channel, but in the case of 80+80 MHz, channel switch failed because
hostapd did not select the secondary channel in the process. Fix this by
selecting a secondary channel in the case of 80+80 MHz.

Signed-off-by: Xin Wang <xwangw@codeaurora.org>
Signed-off-by: Pravas Kumar Panda <kumarpan@codeaurora.org>
5 years agotests: Automatic channel selection with fallback to 20 MHz
Jouni Malinen [Fri, 6 Mar 2020 18:50:21 +0000 (20:50 +0200)] 
tests: Automatic channel selection with fallback to 20 MHz

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: HT with 20 MHz channel width doing CSA to 40 MHz
Jouni Malinen [Fri, 6 Mar 2020 18:21:27 +0000 (20:21 +0200)] 
tests: HT with 20 MHz channel width doing CSA to 40 MHz

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Make ap_ht_40mhz_intolerant_ap more robust
Jouni Malinen [Fri, 6 Mar 2020 15:27:40 +0000 (17:27 +0200)] 
tests: Make ap_ht_40mhz_intolerant_ap more robust

Some test case sequences seemed to prevent the station from completing
the first OBSS scan (that scan was aborted) and that resulted in failing
the test case because the AP had not received any report in time. Wait
for scan completion and allow additional scans before timing out to
avoid indicating incorrect AP behavior in cases where the report was not
even received.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoOWE: Fix PTK derivation workaround for interoperability
Hu Wang [Thu, 5 Mar 2020 11:20:38 +0000 (19:20 +0800)] 
OWE: Fix PTK derivation workaround for interoperability

The initial implementation of the PTK derivation workaround for
interoperability with older OWE implementations forced
WPA_KEY_MGMT_PSK_SHA256 to be used for all of PTK derivation. While that
is needed for selecting which hash algorithm to use, this was also
changing the length of the PTK components and by doing so, did not
actually address the backwards compatibility issue.

Fix this by forcing SHA256 as the hash algorithm in PTK derivation
without changing the PTK length calculation for OWE when
owe_ptk_workaround is enabled.

Fixes: 65a44e849af9 ("OWE: PTK derivation workaround in AP mode")
Fixes: 8b138d28264e ("OWE: PTK derivation workaround in STA mode")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: wpa_supplicant SAVE_CONFIG without config file
Jouni Malinen [Fri, 6 Mar 2020 09:24:28 +0000 (11:24 +0200)] 
tests: wpa_supplicant SAVE_CONFIG without config file

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoFix segmentation fault for NULL confname in SAVE_CONFIG
Zhaoyang Liu [Thu, 5 Mar 2020 03:25:00 +0000 (11:25 +0800)] 
Fix segmentation fault for NULL confname in SAVE_CONFIG

When wpa_supplicant interface is added without a configuration file, the
SAVE_CONFIG command causes a segmentation fault due to referencing a
NULL pointer if the update_config parameter is first explicitly enabled.

Fix the issue by checking the confname for NULL before saving
configuration.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Migrate from set_tx to key_flag API
Alexander Wetzel [Wed, 4 Mar 2020 17:16:56 +0000 (18:16 +0100)] 
nl80211: Migrate from set_tx to key_flag API

Migrate nl80211 driver to key_flag API and add additional sanity checks.

I'm still not sure why we install unicast WEP keys also as default
unicast keys. Based on how I understand how mac80211 handles that it
should be pointless. I just stuck to how we do things prior to the patch
for WEP keys to not break anything. After all other drivers may need it.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Don't ignore when SET_KEY returns ENOENT
Alexander Wetzel [Wed, 4 Mar 2020 17:16:55 +0000 (18:16 +0100)] 
nl80211: Don't ignore when SET_KEY returns ENOENT

Always report an error when NL80211_CMD_SET_KEY can't set a key to
default.

The old ioctl-based design used a single command to add, set, and delete
a key and had to ignore ENOENT for key deletions. It looks like that
special handling was also ported for NL80211_CMD_NEW_KEY and
NL80211_CMD_SET_KEY instead only for NL80211_CMD_DEL_KEY.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Remove not needed netlink key attribute
Alexander Wetzel [Wed, 4 Mar 2020 17:16:54 +0000 (18:16 +0100)] 
nl80211: Remove not needed netlink key attribute

Calling NL80211_CMD_NEW_KEY with NL80211_KEY_DEFAULT_TYPES attributes is
pointless. The information is not expected and therefore the kernel
never forwards it to the drivers. That attribute is used with
NL80211_CMD_SET_KEY.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Fix wrong return code in set_key error path
Alexander Wetzel [Wed, 4 Mar 2020 17:16:53 +0000 (18:16 +0100)] 
nl80211: Fix wrong return code in set_key error path

Allow to abort key installations with different error codes and fix one
misleading return code.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Ignore seq number for key deletion
Alexander Wetzel [Wed, 4 Mar 2020 17:16:52 +0000 (18:16 +0100)] 
nl80211: Ignore seq number for key deletion

Turns out we are sometime providing a seq when deleting the key. Since
that makes no sense on key deletion let's stop forwarding that to the
driver at least.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoValidity checking function for key_flag API
Alexander Wetzel [Wed, 4 Mar 2020 17:16:51 +0000 (18:16 +0100)] 
Validity checking function for key_flag API

Add masks for each key type to define which flags can be combined and
add a helper function to validate key_flag values.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Add a missing key_flag for WEP shared key authentication
Alexander Wetzel [Wed, 4 Mar 2020 17:16:51 +0000 (18:16 +0100)] 
nl80211: Add a missing key_flag for WEP shared key authentication

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoRemove the not yet needed KEY_FLAG_MODIFY
Alexander Wetzel [Wed, 4 Mar 2020 17:16:51 +0000 (18:16 +0100)] 
Remove the not yet needed KEY_FLAG_MODIFY

I decided to drop KEY_FLAG_MODIFY instead of allowing flag combinations not
yet used in the code and will simply recreate it with the Extended Key
ID patches once we get there. For that reason I also did not renumber
the flags.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoFix a wrong key_flag when deleting 802.1X WEP keys
Alexander Wetzel [Wed, 4 Mar 2020 17:16:51 +0000 (18:16 +0100)] 
Fix a wrong key_flag when deleting 802.1X WEP keys

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoAP: Don't try to set NULL WEP default key
Alexander Wetzel [Wed, 4 Mar 2020 17:16:50 +0000 (18:16 +0100)] 
AP: Don't try to set NULL WEP default key

hostapd_broadcast_wep_set() can be called without a WEP key set.
Don't try to install a default key in that case.

This patch is not critical for the new API. With key_flag we just would
report an (ignored) error and do nothing. With the patch we simply do
nothing.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoFix unicast argument for set_wep_key() from EAPOL supplicant
Alexander Wetzel [Wed, 4 Mar 2020 17:16:49 +0000 (18:16 +0100)] 
Fix unicast argument for set_wep_key() from EAPOL supplicant

The unicast parameter in set_wep_key() is only expected to be set to 0
or 1. Without this patch we set unicast to 0x80 instead of 1. Since
unicast is used as boolean that is working fine but violates the
documented API.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agotests: WPS PBC/PIN timeout on AP
Jouni Malinen [Wed, 4 Mar 2020 21:28:45 +0000 (23:28 +0200)] 
tests: WPS PBC/PIN timeout on AP

Verify that AuthorizedMACs advertisement is removed when a PBC session
or a PIN times out.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoWPS: Remove expired PINs on Selected Registrar timeout
Jouni Malinen [Wed, 4 Mar 2020 21:26:02 +0000 (23:26 +0200)] 
WPS: Remove expired PINs on Selected Registrar timeout

This clears the AuthorizedMACs advertisement immediately when the
Selected Registrar timeout is hit and no more active PINs are present.
Previously, the AuthorizedMACs advertisement could remain in place
indefinitely since expired PINs were removed only when actually trying
to find a PIN for a new WPS exchange.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: sigma_dut special case for SAE Password Identifier with PWE looping
Jouni Malinen [Wed, 4 Mar 2020 19:23:43 +0000 (21:23 +0200)] 
tests: sigma_dut special case for SAE Password Identifier with PWE looping

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoDFS: More debug prints on channel selection after radar detection
Jouni Malinen [Tue, 3 Mar 2020 16:45:42 +0000 (18:45 +0200)] 
DFS: More debug prints on channel selection after radar detection

This makes it easier to understand what is happening when a new channel
needs to be selected based on a radar detection event.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: DFS channel bandwidth downgrade from VHT80 to VHT40
Jouni Malinen [Tue, 3 Mar 2020 16:36:10 +0000 (18:36 +0200)] 
tests: DFS channel bandwidth downgrade from VHT80 to VHT40

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agohostapd: Fix to downgrade bandwidth in radar detection
Seevalamuthu Mariappan [Fri, 13 Dec 2019 10:16:41 +0000 (15:46 +0530)] 
hostapd: Fix to downgrade bandwidth in radar detection

Upon radar detection we used to search channels with the same bandwidth.
This way we might not find any other channels. If there are no channels
available with that bandwidth the AP service will be stopped. To avoid
this problem, also search a suitable channel by downgrading the
bandwidth. This scenario is applicable during CAC as well.

Signed-off-by: Seevalamuthu Mariappan <seevalam@codeaurora.org>
5 years agoDFS: Do not process radar event while disabling an interface
Seevalamuthu Mariappan [Fri, 13 Dec 2019 10:16:41 +0000 (15:46 +0530)] 
DFS: Do not process radar event while disabling an interface

In the normal case hostapd_disable_iface() and hostapd_enable_iface()
will be done while switching to another DFS channel upon radar
detection. In certain scenarios radar detected event can come while
hostapd_disable_iface() is in progress and iface->current_mode will be
NULL in that scenario. Previously, we did not check for this scenario
and proceeded with the radar detection logic which can trigger a
segmentation fault. To fix this, avoid proceeding the radar detection
event if iface->current_mode is NULL.

Signed-off-by: Seevalamuthu Mariappan <seevalam@codeaurora.org>
5 years agotests: Specific vs. wildcard SSID in Probe Request frame in BSSID-scan
Jouni Malinen [Mon, 2 Mar 2020 18:44:23 +0000 (20:44 +0200)] 
tests: Specific vs. wildcard SSID in Probe Request frame in BSSID-scan

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAllow wildcard SSID to be enforced for a specific BSSID scan
Veerendranath Jakkam [Sat, 29 Feb 2020 06:56:36 +0000 (12:26 +0530)] 
Allow wildcard SSID to be enforced for a specific BSSID scan

Specific BSSID scan was replacing wildcard SSID with the known SSID if
any BSS with the specified BSSID is available in the known BSSes list.

Add control interface support to force use of a wildcard SSID in a
specific BSSID scan by user with the new "wildcard_ssid=1" argument to
the SCAN command.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
5 years agotests: Verify that HE gets fully enabled for mesh
Jouni Malinen [Mon, 2 Mar 2020 17:56:27 +0000 (19:56 +0200)] 
tests: Verify that HE gets fully enabled for mesh

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agomesh: Fix HE enablement on 5 GHz with VHT
Pradeep Kumar Chitrapu [Thu, 5 Dec 2019 02:57:28 +0000 (02:57 +0000)] 
mesh: Fix HE enablement on 5 GHz with VHT

Incorrect he_enabled parameter was being passed to
hostapd_set_freq_params() in mesh which caused HE to be not fully
enabled on the 5 GHz band. Fix this by setting freq->he_enabled instead
of vht_freq.he_enabled so that the hostapd_set_freq_params() uses the
correct he_enabled value (and then ends up copying this to
vht_freq.he_enabled in the success case).

Fixes: 6e711e7ab32 ("mesh: Do not enable HE on 5 GHz without VHT")
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
5 years agotests: wpa_supplicant config file writing with SAE
Jouni Malinen [Mon, 2 Mar 2020 09:51:38 +0000 (11:51 +0200)] 
tests: wpa_supplicant config file writing with SAE

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Allow SAE-only network profile with sae_password to be written
Sachin Shelke [Sun, 1 Mar 2020 23:48:41 +0000 (05:18 +0530)] 
SAE: Allow SAE-only network profile with sae_password to be written

The commit a34ca59e (SAE: Allow SAE password to be configured separately
(STA)) added sae_password configuration option. We should also consider
sae_password in the wpa_config_write() function which stores the valid
network block details to an external database.

Fixes: a34ca59e4db0 ("SAE: Allow SAE password to be configured separately (STA)")
Signed-off-by: Sachin Shelke <sachin.shelke@nxp.com>
Signed-off-by: Cathy Luo <xiaohua.luo@nxp.com>
Signed-off-by: Ganapathi Bhat <ganapathi.bhat@nxp.com>
5 years agoprivsep: Mask out control port capability flag
Jouni Malinen [Sun, 1 Mar 2020 19:31:07 +0000 (21:31 +0200)] 
privsep: Mask out control port capability flag

There is no support for using the control port for sending out EAPOL
frames through privsep yet, so mask out this capability to fall back to
the l2_packet based design.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoprivsep: Add key_flag to set_key()
Alexander Wetzel [Thu, 9 Jan 2020 23:04:59 +0000 (00:04 +0100)] 
privsep: Add key_flag to set_key()

Pass through the new key_flag to wpa_priv.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoSilence a compiler warning in no-WEP and no-EAP builds
Jouni Malinen [Sun, 1 Mar 2020 18:57:14 +0000 (20:57 +0200)] 
Silence a compiler warning in no-WEP and no-EAP builds

wep_keys_set was not used in wpas_start_assoc_cb() without
IEEE8021X_EAPOL, so need to make this local variable conditional on
build options.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: SAE and PSK with multiple passwords/passphrases
Jouni Malinen [Sun, 1 Mar 2020 17:53:16 +0000 (19:53 +0200)] 
tests: SAE and PSK with multiple passwords/passphrases

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agocommon: Add support for element defragmentation
Ilan Peer [Mon, 24 Feb 2020 09:14:33 +0000 (11:14 +0200)] 
common: Add support for element defragmentation

Add support for element defragmentation as defined in IEEE
P802.11-REVmd/D3.0, 10.28.12 (Element defragmentation).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
5 years agoWPA: Rename FILS wrapped data
Ilan Peer [Mon, 24 Feb 2020 09:14:32 +0000 (11:14 +0200)] 
WPA: Rename FILS wrapped data

IEEE P802.11az/D2.0 renamed the FILS Wrapped Data element,
removing the FILS prefix. Change the code accordingly.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
5 years agocrypto: Add a function to get the ECDH prime length
Ilan Peer [Mon, 24 Feb 2020 09:14:31 +0000 (11:14 +0200)] 
crypto: Add a function to get the ECDH prime length

crypto_ecdh_prime_len() can now be used to fetch the length (in octets)
of the prime used in ECDH.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
5 years agonl80211: Allow TX status for Authentication frames
Ilan Peer [Mon, 24 Feb 2020 09:14:29 +0000 (11:14 +0200)] 
nl80211: Allow TX status for Authentication frames

To support PASN authentication flow, where Authentication frames are
sent by wpa_supplicant using the send_mlme() callback, modify the logic
to also send EVENT_TX_STATUS for Authentication frames.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
5 years agodriver: Extend send_mlme() with wait option
Ilan Peer [Mon, 24 Feb 2020 09:14:27 +0000 (11:14 +0200)] 
driver: Extend send_mlme() with wait option

PASN authentication can be performed while a station interface is
connected to an AP. To allow sending PASN frames while connected, extend
the send_mlme() driver callback to also allow a wait option. Update the
relevant drivers and wpa_supplicant accordingly.

hostapd calls for send_mlme() are left unchanged, since the wait option
is not required there.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
5 years agonl80211: Register for SAE Authentication frames more strictly
Andrei Otcheretianski [Mon, 24 Feb 2020 09:14:26 +0000 (11:14 +0200)] 
nl80211: Register for SAE Authentication frames more strictly

If the driver requires external SAE authentication, it would result in
registration for all Authentication frames, so even non-SAE
Authentication frames might be forwarded to user space instead of being
handled internally. Fix this by using a more strict match pattern,
limiting the registration to the SAE authentication algorithm only.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
5 years agoDBus: Add "sae" to interface key_mgmt capabilities
Brian Norris [Fri, 28 Feb 2020 23:50:47 +0000 (15:50 -0800)] 
DBus: Add "sae" to interface key_mgmt capabilities

This will be present when the driver supports SAE and it's included in
the wpa_supplicant build.

Signed-off-by: Brian Norris <briannorris@chromium.org>
5 years agoMake WEP functionality an optional build parameter
Jouni Malinen [Sat, 29 Feb 2020 14:52:39 +0000 (16:52 +0200)] 
Make WEP functionality an optional build parameter

WEP should not be used for anything anymore. As a step towards removing
it completely, move all WEP related functionality to be within
CONFIG_WEP blocks. This will be included in builds only if CONFIG_WEP=y
is explicitly set in build configuration.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoWPS: Remove static-WEP-only workaround
Jouni Malinen [Sat, 29 Feb 2020 14:56:01 +0000 (16:56 +0200)] 
WPS: Remove static-WEP-only workaround

WEP provisioning was removed from WPS v2, so this workaround
functionality has not been applicable. Remove it completely.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Automatic channel selection with hw_mode=any
Jouni Malinen [Fri, 28 Feb 2020 14:15:24 +0000 (16:15 +0200)] 
tests: Automatic channel selection with hw_mode=any

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoACS: Allow hw_mode=any to be used with internal ACS algorithm
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Allow hw_mode=any to be used with internal ACS algorithm

This was already supported in the offload ACS case and this commit
completes support for this with the internal ACS algorithm.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Determine mode when using hw_mode=any
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Determine mode when using hw_mode=any

Set iface->current_mode and iface->conf->hw_mode when completing ACS
based on the selected channel in the hw_mode=any case.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Extend acs_find_ideal_chan() to support multiple modes
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend acs_find_ideal_chan() to support multiple modes

This is preparation for being able to support hw_mode=any to select the
best channel from any supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Extend acs_request_scan() to support multiple modes
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend acs_request_scan() to support multiple modes

Add suitable channel frequencies from all modes into the scan parameters
when a single mode is not specified for ACS. This is preparation for
being able to support hw_mode=any to select the best channel from any
supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Extend interference factor calculation for all modes
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend interference factor calculation for all modes

This is preparation for being able to support hw_mode=any to select the
best channel from any supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Extend acs_find_chan() for all modes
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend acs_find_chan() for all modes

This is preparation for being able to support hw_mode=any to select the
best channel from any supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Extend acs_surveys_are_sufficient() for all modes
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend acs_surveys_are_sufficient() for all modes

This is preparation for being able to support hw_mode=any to select the
best channel from any supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Clear all modes in acs_cleanup()
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Clear all modes in acs_cleanup()

This is preparation for being able to support hw_mode=any to select the
best channel from any supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Extend hostapd_get_mode_channel() to find from any mode
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend hostapd_get_mode_channel() to find from any mode

This is preparation for being able to support hw_mode=any to select the
best channel from any supported mode.

Signed-off-by: Neo Jou <neojou@gmail.com>
5 years agoACS: Fix spelling of "interference"
Jouni Malinen [Fri, 28 Feb 2020 22:32:13 +0000 (00:32 +0200)] 
ACS: Fix spelling of "interference"

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Initialize wlantest with passphrase for ap_wpa2_ptk_rekey
Jouni Malinen [Fri, 28 Feb 2020 21:19:52 +0000 (23:19 +0200)] 
tests: Initialize wlantest with passphrase for ap_wpa2_ptk_rekey

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowlantest: Try to decrypt frame with zero TK
Jouni Malinen [Fri, 28 Feb 2020 21:18:59 +0000 (23:18 +0200)] 
wlantest: Try to decrypt frame with zero TK

If none of the known PTKs have a working TK, check whether an encrypted
frame is encrypted with all zeros TK.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoos_unix: Seed random() for os_random()
Jouni Malinen [Fri, 28 Feb 2020 20:54:36 +0000 (22:54 +0200)] 
os_unix: Seed random() for os_random()

While the users of os_random() do not really need strong pseudo random
numebrs, there is no significant harm in seeding random() with data from
os_get_random(), i.e., /dev/urandom, to get different sequence of not so
strong pseudo random values from os_random() for each time the process
is started.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: sigma_dut controlled AP with SAE H2E and anti-clogging token
Jouni Malinen [Fri, 28 Feb 2020 17:53:45 +0000 (19:53 +0200)] 
tests: sigma_dut controlled AP with SAE H2E and anti-clogging token

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: SAE and opportunistic key caching and PMK lifetime
Jouni Malinen [Fri, 28 Feb 2020 14:45:36 +0000 (16:45 +0200)] 
tests: SAE and opportunistic key caching and PMK lifetime

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Do not use PMKSA entry after its reauth threshold
Jouni Malinen [Fri, 28 Feb 2020 15:41:07 +0000 (17:41 +0200)] 
SAE: Do not use PMKSA entry after its reauth threshold

Since SAE PMK can be updated only by going through a new SAE
authentication instead of being able to update it during an association
like EAP authentication, do not allow PMKSA entries to be used for
caching after the reauthentication threshold has been reached. This
allows the PMK to be updated without having to force a disassociation
when the PMK expires if the station roams between the reauthentication
threshold and expiration timeout.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Do not clone PMKSA entry for OKC after its reauth threshold
Jouni Malinen [Fri, 28 Feb 2020 15:26:36 +0000 (17:26 +0200)] 
SAE: Do not clone PMKSA entry for OKC after its reauth threshold

Since SAE PMK can be updated only by going through a new SAE
authentication instead of being able to update it during an association
like EAP authentication, do not allow PMKSA entries to be used for OKC
after the reauthentication threshold has been reached. This allows the
PMK to be updated without having to force a disassociation when the PMK
expires if the station roams between the reauthentication threshold and
expiration timeout.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Fix PMKID derivation for OKC
Jouni Malinen [Fri, 28 Feb 2020 14:37:28 +0000 (16:37 +0200)] 
SAE: Fix PMKID derivation for OKC

SAE authentication derives PMKID differently from the EAP cases. The
value comes from information exchanged during SAE authentication and
does not bind in the MAC addresses of the STAs. As such, the same PMKID
is used with different BSSIDs. Fix both the hostapd and wpa_supplicant
to use the previous PMKID as is for OKC instead of deriving a new PMKID
using an incorrect derivation method when using an SAE AKM.

This fixes use of opportunistic key caching with SAE.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agocommon: Provide the BIT() macro locally
Andrej Shadura [Tue, 25 Feb 2020 16:08:32 +0000 (17:08 +0100)] 
common: Provide the BIT() macro locally

wpa_ctrl.h can be installed separately with libwpa_client, so
utils/common.h won't be available to its users.

Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
5 years agowlantest: Add more notes about decryption into pcapng
Jouni Malinen [Thu, 27 Feb 2020 23:30:00 +0000 (01:30 +0200)] 
wlantest: Add more notes about decryption into pcapng

Note the used TK/GTK and KeyID in frame notes when writing decrypted
frames to a PCAPNG file.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowlantest: Update BSS IEs based on EAPOL-Key msg 3/4
Jouni Malinen [Thu, 27 Feb 2020 22:51:07 +0000 (00:51 +0200)] 
wlantest: Update BSS IEs based on EAPOL-Key msg 3/4

If no Beacon or Probe Response frame has been seen in the capture, use
the IEs from EAPOL-Key msg 3/4 to set up BSS information.

Signed-off-by: Jouni Malinen <j@w1.fi>