]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
4 years agowlantest: Check for zero TK even when the real PTK is not known
Jouni Malinen [Mon, 23 Mar 2020 15:58:43 +0000 (17:58 +0200)] 
wlantest: Check for zero TK even when the real PTK is not known

This makes it easier to analyze certain encryption issues. Also print
out an error at the default INFO debug verbosity with the frame number.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoExtend vendor attributes to support enhanced CFR capture
Wu Gao [Sun, 28 Aug 2016 02:56:33 +0000 (10:56 +0800)] 
Extend vendor attributes to support enhanced CFR capture

Enhanced channel frequency response supports capturing of channel status
information based on RX. Define previous CFR as version 1 and enhanced
CFR as version 2. If target supports both versions, two versions can't
be enabled at same time. Extend attributes for enhanced CFR capture in
enum qca_wlan_vendor_peer_cfr_capture_attr.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoAdd QCA vendor attributes for ACS over EDMG (IEEE 802.11ay)
Noam Shaked [Sun, 22 Mar 2020 22:44:05 +0000 (15:44 -0700)] 
Add QCA vendor attributes for ACS over EDMG (IEEE 802.11ay)

QCA_WLAN_VENDOR_ATTR_ACS_EDMG_ENABLED, conduct ACS for EDMG.
QCA_WLAN_VENDOR_ATTR_ACS_EDMG_CHANNEL, return the EDMG channel.

Signed-off-by: Noam Shaked <nshaked@codeaurora.org>
4 years agotests: Extended Key ID
Jouni Malinen [Sun, 22 Mar 2020 22:32:15 +0000 (00:32 +0200)] 
tests: Extended Key ID

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAllow last configured Key ID for TK to be fetched from wpa_supplicant
Jouni Malinen [Mon, 23 Mar 2020 09:22:26 +0000 (11:22 +0200)] 
Allow last configured Key ID for TK to be fetched from wpa_supplicant

"GET last_tk_key_idx" can now be used in testing build to determine
which was the last configured Key ID for the pairwise key.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoUse a shared helper function for RSN supplicant capabilities
Jouni Malinen [Sun, 22 Mar 2020 22:08:38 +0000 (00:08 +0200)] 
Use a shared helper function for RSN supplicant capabilities

Avoid practically copy-pasted code for determining local RSN
capabilities.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoSTA: Support Extended Key ID
Alexander Wetzel [Fri, 20 Mar 2020 19:04:32 +0000 (20:04 +0100)] 
STA: Support Extended Key ID

Support Extended Key ID in wpa_supplicant according to
IEEE Std 802.11-2016 for infrastructure (AP) associations.

Extended Key ID allows to rekey pairwise keys without the otherwise
unavoidable MPDU losses on a busy link. The standard is fully backward
compatible, allowing STAs to also connect to APs not supporting it.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agoAP: Support Extended Key ID
Alexander Wetzel [Fri, 20 Mar 2020 19:04:31 +0000 (20:04 +0100)] 
AP: Support Extended Key ID

Support Extended Key ID in hostapd according to IEEE Std 802.11-2016.

Extended Key ID allows to rekey pairwise keys without the otherwise
unavoidable MPDU losses on a busy link. The standard is fully backward
compatible, allowing an AP to serve STAs with and without Extended Key
ID support in the same BSS.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agotests: Fix bgscan_learn_beacon_loss with REPORTS_TX_ACK_STATUS
Jouni Malinen [Sun, 22 Mar 2020 17:52:38 +0000 (19:52 +0200)] 
tests: Fix bgscan_learn_beacon_loss with REPORTS_TX_ACK_STATUS

Stopping the AP from beaconing will also stop it from acknowledging
frames and that resulted in bgscan_learn_beacon_loss failing when
mac80211_hwsim is registering REPORTS_TX_ACK_STATUS. Work around this by
moving to using PMF so that the station ignores the unprotected
deauthentiation frames from the AP and also disabling SA Query. This
allows the AP to be stopped and restarted with large enough Beacon
interval to allow the station to detect beacon loss.

This is identical to the earlier design change for
bgscan_simple_beacon_loss (somehow this bgscan_learn_beacon_loss test
case managed to pass at that time).

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoLimit scan frequency list to 100 entries
Jouni Malinen [Sun, 22 Mar 2020 16:51:41 +0000 (18:51 +0200)] 
Limit scan frequency list to 100 entries

There is no real use case for the scan to be requested on more than 100
channels individually. To avoid excessively long lists with invalid
configuration, use 100 entry limit for the list before dropping to the
fallback scan-all-channels option.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoConvert int_array to use size_t instead of int as the length
Jouni Malinen [Sun, 22 Mar 2020 16:49:04 +0000 (18:49 +0200)] 
Convert int_array to use size_t instead of int as the length

This extends this to allow longer lists with LP32 data model to avoid
limit of 16-bit int.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoLimit freq_range_list_parse() result to UINT_MAX entries
Jouni Malinen [Sun, 22 Mar 2020 16:37:40 +0000 (18:37 +0200)] 
Limit freq_range_list_parse() result to UINT_MAX entries

This addresses a theoretical integer overflow with configuration
parameters with 16-bit int.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoloop: Use size_t for eloop.count
Jouni Malinen [Sun, 22 Mar 2020 16:35:45 +0000 (18:35 +0200)] 
loop: Use size_t for eloop.count

This is more consistent with the other eloop registrations and avoids a
theoretical integer overflow with 16-bit int should more than 32767
sockets/signals/events be registered.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoeloop: Use size_t for socket table->count
Jouni Malinen [Sun, 22 Mar 2020 16:26:10 +0000 (18:26 +0200)] 
eloop: Use size_t for socket table->count

This is more consistent with the other eloop registrations and avoids a
theoretical integer overflow with 16-bit int should more than 32767
sockets be registered (which is not really going to happen in practice).

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agohs20-osu-client: Use size_t for certificate components
Jouni Malinen [Sun, 22 Mar 2020 16:22:27 +0000 (18:22 +0200)] 
hs20-osu-client: Use size_t for certificate components

This avoids a theoretical integer overflow with 16-bit unsigned int
should a certificate be encoded with more that 65535 friendly names or
icons.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoeloop: Use size_t for signal_count
Jouni Malinen [Sun, 22 Mar 2020 16:15:43 +0000 (18:15 +0200)] 
eloop: Use size_t for signal_count

This is more consistent with the other eloop registrations and avoids a
theoretical integer overflow with 16-bit int (not that there would ever
be more that 32767 signal handlers getting registered).

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoLimit maximum number of pending SA Queries
Jouni Malinen [Sun, 22 Mar 2020 16:07:06 +0000 (18:07 +0200)] 
Limit maximum number of pending SA Queries

There is no point in starting a huge number of pending SA Queries, so
limit the number of pending queries to 1000 to have an explicit limit
for how large sa_query_count can grow.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoRADIUS: Use size_t instead of int for message attributes
Jouni Malinen [Sun, 22 Mar 2020 16:00:28 +0000 (18:00 +0200)] 
RADIUS: Use size_t instead of int for message attributes

While RADIUS messages are limited to 4 kB, use size_t to avoid even a
theoretical overflow issue with 16-bit int.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoD-Bus: Use size_t for values theoretically larger than 16-bit int
Jouni Malinen [Sun, 22 Mar 2020 15:24:21 +0000 (17:24 +0200)] 
D-Bus: Use size_t for values theoretically larger than 16-bit int

These are theoretical cases with 32-bit integers, but cases that could
potentially hit an integer overflow with 16-bit int.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoUse size_t instead of int or unsigned int for configuration items
Jouni Malinen [Sun, 22 Mar 2020 15:46:45 +0000 (17:46 +0200)] 
Use size_t instead of int or unsigned int for configuration items

While int and unsigned int are not going overflow in practice as 32-bit
values, these could at least in theory hit an integer overflow with
16-bit int. Use size_t to avoid such potential issue cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoUse size_t instead of unsigned_int for last_scan_res
Jouni Malinen [Sun, 22 Mar 2020 15:30:23 +0000 (17:30 +0200)] 
Use size_t instead of unsigned_int for last_scan_res

This avoids a theoretical unsigned integer overflow case with 32-bit
integers, but something that could potentially be hit with 16-bit int
(though, even that part looks pretty theoretical in this particular case
of number of BSSs in scan results).

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Wait longer for connection in radius_macacl_unreachable
Jouni Malinen [Sat, 21 Mar 2020 21:56:19 +0000 (23:56 +0200)] 
tests: Wait longer for connection in radius_macacl_unreachable

It looks ike the authentication timeouts may continue a bit longer after
some kernel changes and that could result in temporarily disabling the
network profile. Give this test case more time to complete the
connection to avoid reporting failures unnecessarily.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Update prefer_vht40 throughput estimation
Jouni Malinen [Sat, 21 Mar 2020 17:33:38 +0000 (19:33 +0200)] 
tests: Update prefer_vht40 throughput estimation

Match the updated max_ht40_rate() estimation with VHT.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoInterpolate rate calculation functions
Matthew Wang [Mon, 16 Mar 2020 21:11:06 +0000 (14:11 -0700)] 
Interpolate rate calculation functions

Make max_*_rate() functions and rate calculation at the beginning of
wpas_get_est_tpt() more continuous. In wpa_supplicant_need_to_roam(), we
compare these values to make a roaming decision. However, at certain
SNRs, we see unrealistically large jumps in estimated throughput
according to these functions, leading us to make incorrect roaming
decisions. Perform linear interpolation where applicable to more
accurately reflect actual throughput.

Example:
wlan0: Current BSS: 88:3d:24:b4:95:d2 freq=2412 level=-69 snr=20 est_throughput=54000
wlan0: Selected BSS: 88:3d:24:b4:89:9e freq=2417 level=-67 snr=22 est_throughput=63500
wlan0: Using signal poll values for the current BSS: level=-69 snr=20 est_throughput=54000
wlan0: Allow reassociation - selected BSS has better estimated throughput

2 dB increase in RSSI likely isn't responsible for a 17% increase in
throughput.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
4 years agoAdjust max bitrate SNR floors
Matthew Wang [Mon, 16 Mar 2020 21:11:05 +0000 (14:11 -0700)] 
Adjust max bitrate SNR floors

These values were defined in commit a1b790eb9d75 ("Select AP based on
estimated maximum throughput") with no justification. Other sources
[0,1,2] give a different (consistent) set of SNR floors per MCS index.
Adjust the values accordingly.

[0] http://www.revolutionwifi.net/revolutionwifi/2014/09/wi-fi-snr-to-mcs-data-rate-mapping.html
[1] https://higher-frequency.blogspot.com/2016/10/80211n-80211ac-data-rates-and-snr.html
[2] https://www.wlanpros.com/resources/mcs-index-802-11ac-vht-chart/

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
4 years agotests: Fix bgscan_simple_beacon_loss with REPORTS_TX_ACK_STATUS
Jouni Malinen [Sat, 21 Mar 2020 16:13:28 +0000 (18:13 +0200)] 
tests: Fix bgscan_simple_beacon_loss with REPORTS_TX_ACK_STATUS

Stopping the AP from beaconing will also stop it from acknowledging
frames and that resulted in bgscan_simple_beacon_loss failing when
mac80211_hwsim is registering REPORTS_TX_ACK_STATUS. Work around this by
moving to using PMF so that the station ignores the unprotected
deauthentiation frames from the AP and also disabling SA Query. This
allows the AP to be stopped and restarted with large enough Beacon
interval to allow the station to detect beacon loss.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAllow SA Query to be disabled for testing purposes
Jouni Malinen [Sat, 21 Mar 2020 16:12:02 +0000 (18:12 +0200)] 
Allow SA Query to be disabled for testing purposes

The new wpa_supplicant control interface SET parameter disable_sa_query
can now be used to disable SA Query on receiving unprotected
disconnection event.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Fix RTM NEW/DELLINK IFLA_IFNAME copy for maximum ifname length
Ouden [Wed, 18 Mar 2020 09:58:37 +0000 (17:58 +0800)] 
nl80211: Fix RTM NEW/DELLINK IFLA_IFNAME copy for maximum ifname length

If the kernel rtm_newlink or rtm_dellink send the maximum length of
ifname (IFNAMSIZ), the event handlers in
wpa_driver_nl80211_event_rtm_addlink() and
wpa_driver_nl80211_event_rtm_dellink() did not copy the IFLA_IFNAME
value. Because the RTA_PAYLOAD (IFLA_IFNAME) length already includes the
NULL termination, that equals the IFNAMSIZ.

Fix the condition when IFNAME reach maximum size.

Signed-off-by: Ouden <Ouden.Biz@gmail.com>
4 years agoMore details to the vendor specific driver internal failure reporting
Sourav Mohapatra [Thu, 19 Mar 2020 13:51:34 +0000 (19:21 +0530)] 
More details to the vendor specific driver internal failure reporting

Add more hang reason codes for the hang reason in the
QCA_NL80211_VENDOR_SUBCMD_HANG events. This also introduces the
attribute QCA_WLAN_VENDOR_ATTR_HANG_REASON_DATA to carry the required
data for the respective hang reason. This data is expected to contain
the required dump to analyze the reason for the hang.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoIgnore duplicated SSID element when parsing
Jouni Malinen [Sat, 21 Mar 2020 13:57:37 +0000 (15:57 +0200)] 
Ignore duplicated SSID element when parsing

Some APs have managed to add two SSID elements into Beacon frames and
that used to result in picking the last one which had incorrect data in
the known examples of this misbehavior. Pick the first one to get the
correct SSID.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoSet beacon protection config irrespective of macro CONFIG_FILS
Veerendranath Jakkam [Sat, 21 Mar 2020 00:39:30 +0000 (06:09 +0530)] 
Set beacon protection config irrespective of macro CONFIG_FILS

This was not supposed to be conditional on CONFIG_FILS.

Fixes: ecbf59e6931f ("wpa_supplicant configuration for Beacon protection")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoCheck against integer overflow in int_array functions
Jouni Malinen [Sat, 21 Mar 2020 10:57:37 +0000 (12:57 +0200)] 
Check against integer overflow in int_array functions

int_array_concat() and int_array_add_unique() could potentially end up
overflowing the int type variable used to calculate their length. While
this is mostly theoretical for platforms that use 32-bit int, there
might be cases where a 16-bit int overflow could be hit. This could
result in accessing memory outside buffer bounds and potentially a
double free when realloc() ends up freeing the buffer.

All current uses of int_array_add_unique() and most uses of
int_array_concat() are currently limited by the buffer limits for the
local configuration parameter or frame length and as such, cannot hit
this overflow cases. The only case where a long enough int_array could
be generated is the combination of scan_freq values for a scan. The
memory and CPU resource needs for generating an int_array with 2^31
entries would not be realistic to hit in practice, but a device using
LP32 data model with 16-bit int could hit this case.

It is better to have more robust checks even if this could not be
reached in practice, so handle cases where more than INT_MAX entries
would be added to an int_array as memory allocation failures instead of
allowing the overflow case to proceed.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Additional FT-SAE with RSNXE testing
Jouni Malinen [Fri, 20 Mar 2020 22:06:26 +0000 (00:06 +0200)] 
tests: Additional FT-SAE with RSNXE testing

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoAllow RSNXE to be removed from Beacon frames for testing purposes
Jouni Malinen [Fri, 20 Mar 2020 22:23:01 +0000 (00:23 +0200)] 
Allow RSNXE to be removed from Beacon frames for testing purposes

The new hostapd configuration parameter no_beacon_rsnxe=1 can be used to
remove RSNXE from Beacon frames. This can be used to test protection
mechanisms for downgrade attacks.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFT: Omit RSNXE from FT protocol Reassociation Response when needed
Jouni Malinen [Fri, 20 Mar 2020 19:56:44 +0000 (21:56 +0200)] 
FT: Omit RSNXE from FT protocol Reassociation Response when needed

The previous design for adding RSNXE into FT was not backwards
compatible. Move to a new design based on 20/332r3 to avoid that issue
by not include RSNXE in the FT protocol Reassociation Response frame so
that a STA not supporting RSNXE can still validate the FTE MIC
correctly.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFT: Omit RSNXE from FT protocol Reassociation Request when needed
Jouni Malinen [Fri, 20 Mar 2020 19:45:22 +0000 (21:45 +0200)] 
FT: Omit RSNXE from FT protocol Reassociation Request when needed

The previous design for adding RSNXE into FT was not backwards
compatible. Move to a new design based on 20/332r3 to avoid that issue
by not include RSNXE in the FT protocol Reassociation Request frame so
that an AP not supporting RSNXE can still validate the FTE MIC
correctly.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFT: Verify that RSNXE is used consistently in Reassociation Response
Jouni Malinen [Fri, 20 Mar 2020 19:38:22 +0000 (21:38 +0200)] 
FT: Verify that RSNXE is used consistently in Reassociation Response

Verify that the AP included RSNXE in Beacon/Probe Response frames if it
indicated in FTE that RSNXE is used. This is needed to protect against
downgrade attacks based on the design proposed in 20/332r3.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFT: Verify that RSNXE is used consistently in Reassociation Request
Jouni Malinen [Fri, 20 Mar 2020 19:33:02 +0000 (21:33 +0200)] 
FT: Verify that RSNXE is used consistently in Reassociation Request

Verify that the STA includes RSNXE if it indicated in FTE that RSNXE is
used and the AP is also using RSNXE. This is needed to protect against
downgrade attacks based on the design proposed in 20/332r3.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFT: Set the new RSNXE Used subfield in FT reassociation
Jouni Malinen [Fri, 20 Mar 2020 19:23:48 +0000 (21:23 +0200)] 
FT: Set the new RSNXE Used subfield in FT reassociation

This is a workaround needed to keep FT protocol backwards compatible for
the cases where either the AP or the STA uses RSNXE, but the other one
does not. This commit adds setting of the new field to 1 in
Reassociation Request/Response frame during FT protocol when the STA/AP
uses RSNXE in other frames. This mechanism is described in 20/332r3.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: sigma_dut AP configuration for different channels
Jouni Malinen [Mon, 16 Mar 2020 14:22:32 +0000 (16:22 +0200)] 
tests: sigma_dut AP configuration for different channels

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Use hostapd_logdir in sigma_dut_ap_psk_sha256
Jouni Malinen [Mon, 16 Mar 2020 13:38:27 +0000 (15:38 +0200)] 
tests: Use hostapd_logdir in sigma_dut_ap_psk_sha256

logdir was prepared for this test case, but it was not actually used.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agowlantest: Basic Extended Key ID support
Alexander Wetzel [Sun, 15 Mar 2020 19:04:25 +0000 (20:04 +0100)] 
wlantest: Basic Extended Key ID support

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agonl80211: Debug print set_key() command names
Jouni Malinen [Sun, 15 Mar 2020 21:42:21 +0000 (23:42 +0200)] 
nl80211: Debug print set_key() command names

This makes it easier to understand the debug log for various set_key()
operations.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Extended Key ID support
Alexander Wetzel [Sun, 15 Mar 2020 19:04:24 +0000 (20:04 +0100)] 
nl80211: Extended Key ID support

Add key configuration parameters needed to support Extended Key ID with
pairwise keys. Add a driver capability flag to indicate support forusing
this.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agoRemove unnecessary and confusing length check from the PMKID KDE case
Jouni Malinen [Sun, 15 Mar 2020 21:24:18 +0000 (23:24 +0200)] 
Remove unnecessary and confusing length check from the PMKID KDE case

wpa_parse_kde_ies(), i.e., the only caller to wpa_parse_generic(),
verifies that there is room for KDE Length field and pos[1] (that
length) octets of payload in the Key Data buffer. The PMKID KDE case
within wpa_parse_generic() was doing an unnecessary separate check for
there being room for the Length, OUI, and Data Type fields. This is
covered by the check in the calling function with the combination of
verifying that pos[1] is large enough to contain RSN_SELECTOR_LEN +
PMKID_LEN octets of payload.

This is confusing since no other KDE case was checking remaining full
buffer room within wpa_parse_generic(). Clean this up by removing the
unnecessary check from the PMKID KDE case so that all KDEs are handled
consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAdd parsing of Key ID KDE for Extended Key ID
Alexander Wetzel [Sun, 15 Mar 2020 19:04:20 +0000 (20:04 +0100)] 
Add parsing of Key ID KDE for Extended Key ID

wpa_parse_generic() can now recognize the Key ID KDE that will be needed
to deliver the Key ID of the pairwise key when Extended Key ID is used.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agoAdd KEY_FLAG_MODIFY for Extended Key ID support
Alexander Wetzel [Sun, 15 Mar 2020 19:04:19 +0000 (20:04 +0100)] 
Add KEY_FLAG_MODIFY for Extended Key ID support

KEY_FLAG_MODIFY was initial added for the planned Extended Key ID
support with commit a919a260352a ("Introduce and add key_flag") and then
removed with commit 82eaa3e6882f ("Remove the not yet needed
KEY_FLAG_MODIFY") to simplify commit e9e69221c1d1 ("Validity checking
function for key_flag API").

Add it again and update check_key_flag() accordingly.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agotests: Scanning in AP mode
Jouni Malinen [Sun, 15 Mar 2020 19:22:18 +0000 (21:22 +0200)] 
tests: Scanning in AP mode

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Allow scanning in wpa_supplicant AP mode
Jouni Malinen [Sun, 15 Mar 2020 19:21:35 +0000 (21:21 +0200)] 
nl80211: Allow scanning in wpa_supplicant AP mode

If the driver supports this, request cfg80211 to allow the explicitly
requested scan to go through in AP mode.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoIndicate scan completion in active AP mode even when ignoring results
Jouni Malinen [Sun, 15 Mar 2020 19:18:16 +0000 (21:18 +0200)] 
Indicate scan completion in active AP mode even when ignoring results

This is needed to avoid leaving external components (through control
interface or D-Bus) timing out while waiting for the scan completion
events. This was already taken care of for the scan-only case
("TYPE=only"), but the scan-and-allow-roaming case did not report the
scan completion event when operating in AP mode.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Remove extraneous space from send_mlme debug print
Jouni Malinen [Sun, 15 Mar 2020 15:09:27 +0000 (17:09 +0200)] 
nl80211: Remove extraneous space from send_mlme debug print

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Check more details in pmksa_cache_ap_expiration
Jouni Malinen [Sun, 15 Mar 2020 15:07:52 +0000 (17:07 +0200)] 
tests: Check more details in pmksa_cache_ap_expiration

It looks like this test case can fail if the STA goes to power save mode
and the Deauthentication frame from the AP after session timeout is not
actually sent at all. Check more details to make it clear that this is
indeed the reason behind the failure.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Add more TX status details in debug log in AP mode
Jouni Malinen [Sun, 15 Mar 2020 15:06:35 +0000 (17:06 +0200)] 
nl80211: Add more TX status details in debug log in AP mode

The actual TX status (whether ACK frame was received) was not included
in the debug log in AP mode. Add that for all cases. In addition, add
some more details in the debug log to make the log more helpful in
debugging issues related to frame delivery.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: SAE and RSNE mismatch in EAPOL-Key msg 2/4
Jouni Malinen [Sun, 15 Mar 2020 09:16:22 +0000 (11:16 +0200)] 
tests: SAE and RSNE mismatch in EAPOL-Key msg 2/4

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAllow RSNE in EAPOL-Key msg 2/4 to be overridden for testing purposes
Jouni Malinen [Sun, 15 Mar 2020 09:11:38 +0000 (11:11 +0200)] 
Allow RSNE in EAPOL-Key msg 2/4 to be overridden for testing purposes

The new wpa_supplicant control interface parameter rsne_override_eapol
can be used similarly to the earlier rsnxe_override_eapol to override
the RSNE value added into EAPOL-Key msg 2/4.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: FT protocol RSNE/RSNXE mismatch in Reassociation Response frame
Jouni Malinen [Sat, 14 Mar 2020 21:31:13 +0000 (23:31 +0200)] 
tests: FT protocol RSNE/RSNXE mismatch in Reassociation Response frame

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAllow RSNE/RSNXE to be replaced in FT protocol Reassocation Response frame
Jouni Malinen [Sat, 14 Mar 2020 21:30:27 +0000 (23:30 +0200)] 
Allow RSNE/RSNXE to be replaced in FT protocol Reassocation Response frame

This can be used to test station side behavior for FT protocol
validation steps.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoFT: Check RSNE/RSNXE match in FT protocol Reassociation Response frame
Jouni Malinen [Sat, 14 Mar 2020 21:57:39 +0000 (23:57 +0200)] 
FT: Check RSNE/RSNXE match in FT protocol Reassociation Response frame

While 13.7.1 (FT reassociation in an RSN) in P802.11-REVmd/D3.0 did not
explicitly require this to be done, this is implied when describing the
contents of the fourth message in the FT authentication sequence (see
13.8.5). Furthermore, 20/332r2 is proposing an explicit validation step
to be added into 13.7.1.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agowlantest: Do not report PMF failure without BSS supporting PMF
Jouni Malinen [Sat, 14 Mar 2020 16:20:31 +0000 (18:20 +0200)] 
wlantest: Do not report PMF failure without BSS supporting PMF

Previously, missing CCMP protection on Robust Management frames was
reported based on the STA having indicated MFPC=1. That is not accurate
since the AP/BSS may have MFPC=0. Report this failure only if both the
AP and STA have indicated MFPC=1, i.e., when PMF has been negotiated for
the association.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agowlantest: Detect and report plaintext payload in protected frames
Jouni Malinen [Sat, 14 Mar 2020 15:31:57 +0000 (17:31 +0200)] 
wlantest: Detect and report plaintext payload in protected frames

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Debug print driver capabilities
Jouni Malinen [Fri, 13 Mar 2020 18:03:14 +0000 (20:03 +0200)] 
nl80211: Debug print driver capabilities

This can be helpful in understanding driver behavior.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoMove the "WPA: AP key_mgmt" debug print to be after final changes
Jouni Malinen [Fri, 13 Mar 2020 18:01:53 +0000 (20:01 +0200)] 
Move the "WPA: AP key_mgmt" debug print to be after final changes

Driver capabilities may end up masking out some WPA_KEY_MGMT_* bits, so
debug print the outcome only after having performed all these steps.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoMulti-AP: Set 4-address mode after network selection
Gurumoorthi Gnanasambandhan [Wed, 11 Mar 2020 10:41:54 +0000 (16:11 +0530)] 
Multi-AP: Set 4-address mode after network selection

Split multi_ap_process_assoc_resp() to set 4-address mode after network
selection. Previously, wpa_s->current_ssid might have been NULL in some
cases and that would have resulted in 4-address mode not getting enabled
properly.

Signed-off-by: Gurumoorthi Gnanasambandhan <gguru@codeaurora.org>
4 years agoHS 2.0 server: Add a note on OCSP server hostname
Ben Greear [Fri, 6 Mar 2020 22:58:11 +0000 (14:58 -0800)] 
HS 2.0 server: Add a note on OCSP server hostname

Signed-off-by: Ben Greear <greearb@candelatech.com>
4 years agohs20-osu-client: Use more specific debug message on OSU connection
Ben Greear [Fri, 6 Mar 2020 22:58:11 +0000 (14:58 -0800)] 
hs20-osu-client: Use more specific debug message on OSU connection

Signed-off-by: Ben Greear <greearb@candelatech.com>
4 years agotests: Current Operating Class value from STA
Jouni Malinen [Wed, 11 Mar 2020 16:30:51 +0000 (18:30 +0200)] 
tests: Current Operating Class value from STA

Verify Supported Operating Classes element contents from STA in various
HT and VHT cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFill the current opclass in (Re)AssocRequest depending on HT/VHT IEs
Ananya Barat [Tue, 10 Mar 2020 06:37:33 +0000 (12:07 +0530)] 
Fill the current opclass in (Re)AssocRequest depending on HT/VHT IEs

The previous implementation was assuming a fixed 20 MHz channel
bandwidth when determining which operating class value to indicate as
the Current Operating Class in the Supported Operating Classes element.
This is not accurate for many HT/VHT cases.

Fix this by determining the current operating class (i.e., the operating
class used for the requested association) based on the HT/VHT operation
elements from scan results.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoAP: Fix regression in frequency check for a usable EDMG channel
Hrishikesh Vidwans [Fri, 6 Mar 2020 18:57:58 +0000 (10:57 -0800)] 
AP: Fix regression in frequency check for a usable EDMG channel

Commit 5f9b4afd ("Use frequency in HT/VHT validation steps done before
starting AP") modified hostapd_is_usable_edmg() to use freq instead of
channel numbers. Unfortunately, it did not convert the frequency
calculation correctly and this broke EDMG functionality.

Fix the frequency calculation so that EDMG channel 9 works again.

Fixes: 5f9b4afdfaf5 ("Use frequency in HT/VHT validation steps done before starting AP")
Signed-off-by: Hrishikesh Vidwans <hvidwans@codeaurora.org>
4 years agomesh: Fix CONFIG_HT_OVERRIDES build without CONFIG_VHT_OVERRIDES
Arturo Buzarra [Mon, 9 Mar 2020 17:18:16 +0000 (18:18 +0100)] 
mesh: Fix CONFIG_HT_OVERRIDES build without CONFIG_VHT_OVERRIDES

Commit e5a9b1e8a3 ("mesh: Implement use of VHT20 config in mesh mode")
introduced the possibility to check the disable_vht param. However, this
entry is only available when CONFIG_VHT_OVERRIDES is enabled and as
such, this broke the build for some cases.

Fix this by encapsulating VHT property with the proper CONFIG entry.

Fixes: e5a9b1e8a3a5 ("mesh: Implement use of VHT20 config in mesh mode")
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
4 years agoWPS: Do not set auth_alg=OPEN for PSK+SAE case
Jouni Malinen [Tue, 10 Mar 2020 18:48:15 +0000 (20:48 +0200)] 
WPS: Do not set auth_alg=OPEN for PSK+SAE case

When wps_cred_add_sae=1 is used, WPS_AUTH_WPA2PSK credential gets
converted to enabling both PSK and SAE AKMs. However, this case was
still hardcoded auth_alg=OPEN which is not really correct for SAE. While
the SME-in-wpa_supplicant case can handle that, the SME-in-driver case
might not. Remove the unnecessary auth_alg=OPEN configuration to get the
normal PSK+SAE configuration enabled for the network profile.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Set device_name for WPS test cases
Janusz Dziedzic [Sun, 8 Mar 2020 13:27:04 +0000 (14:27 +0100)] 
tests: Set device_name for WPS test cases

Set device_name in the test cases instead of relying on the
wpa_supplicant configuration file. This fixes problems when we run WPS
test cases in remote test environment.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>