]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
4 years agoOWE: PTK derivation workaround in AP mode
Jouni Malinen [Thu, 23 Jan 2020 18:56:51 +0000 (20:56 +0200)] 
OWE: PTK derivation workaround in AP mode

Initial OWE implementation used SHA256 when deriving the PTK for all OWE
groups. This was supposed to change to SHA384 for group 20 and SHA512
for group 21. The new owe_ptk_workaround parameter can be used to enable
workaround for interoperability with stations that use SHA256 with
groups 20 and 21. By default, only the appropriate hash function is
accepted. When workaround is enabled (owe_ptk_workaround=1), the
appropriate hash function is tried first and if that fails, SHA256-based
PTK derivation is attempted. This workaround can result in reduced
security for groups 20 and 21, but is required for interoperability with
older implementations. There is no impact to group 19 behavior.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoOWE: Select KDF hash algorithm based on the length of the prime
Jouni Malinen [Thu, 23 Jan 2020 18:04:40 +0000 (20:04 +0200)] 
OWE: Select KDF hash algorithm based on the length of the prime

Previous implementation was hardcoding use of SHA256 PMK-to-PTK
derivation for all groups. Replace that with hash algorithm selection
based on the length of the prime similarly to the way this was done for
other derivation steps in OWE.

This breaks backwards compatibility when using group 20 or 21; group 19
behavior remains same.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFix a typo in an example configuration file comment
Jouni Malinen [Thu, 23 Jan 2020 21:06:27 +0000 (23:06 +0200)] 
Fix a typo in an example configuration file comment

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFix a typo in a comment
Jouni Malinen [Thu, 23 Jan 2020 21:05:24 +0000 (23:05 +0200)] 
Fix a typo in a comment

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFix coloc_intf_reporting config param in hostapd in non-OWE builds
Jouni Malinen [Thu, 23 Jan 2020 18:48:46 +0000 (20:48 +0200)] 
Fix coloc_intf_reporting config param in hostapd in non-OWE builds

This has nothing to do with OWE and parsing of this value was not
supposed to be within an ifdef CONFIG_OWE block.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Make ap_hs20_connect_no_full_match more robust
Jouni Malinen [Thu, 23 Jan 2020 14:54:45 +0000 (16:54 +0200)] 
tests: Make ap_hs20_connect_no_full_match more robust

Explicitly clear cfg80211 scan cache to avoid issues with old BSS
entries from previous test cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoDo not enable HT/VHT for 6 GHz band 20 MHz width channels also
Vamsi Krishna [Mon, 13 Jan 2020 09:29:06 +0000 (14:59 +0530)] 
Do not enable HT/VHT for 6 GHz band 20 MHz width channels also

The previous commit had a rebasing issue that ended up covering only the
center_segment0 != 0 case. These were supposed to apply for all 6 GHz
band cases.

Fixes: 0bfc04b8d0f8 ("Do not enable HT/VHT when operating in 6 GHz band")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoEnhance get_mode() to return correct hw_mode with 6 GHz support
Vamsi Krishna [Mon, 30 Dec 2019 09:42:12 +0000 (15:12 +0530)] 
Enhance get_mode() to return correct hw_mode with 6 GHz support

The 5 GHz channels are stored in one hw_features set with mode
HOSTAPD_MODE_IEEE80211A while the 6 GHz channels will need to be stored
in a separate hw_features set (but with same mode
HOSTAPD_MODE_IEEE80211A) due to possibility of different HT/VHT/HE
capabilities being available between the 5 GHz and 6 GHz bands.

Iterate through all hw_features sets and check and match the band of
channel supported by the hw_features set while getting the hw_features
set in get_mode(). This allows both the 5 GHz and 6 GHz channels to be
found and correct capabilities to be used in cases where the driver
reports different capability values between 5 and 6 GHz channels.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoRemove deprecated text for ap_scan=0
Chaitanya Tata [Mon, 20 Jan 2020 18:36:44 +0000 (00:06 +0530)] 
Remove deprecated text for ap_scan=0

Users might be tempted to try ap_scan=0 for offloading scan,
ap_selection and, WPA to driver. Update the text to reflect that this is
deprecated.

Jouni confirmed deprecation in
https://www.spinics.net/lists/hostap/msg06482.html

Signed-off-by: Chaitanya Tata <chaitanya.tata@bluwireless.com>
4 years agotests: Allow more time for sigma_dut sta_associate commands
Jouni Malinen [Tue, 21 Jan 2020 11:22:57 +0000 (13:22 +0200)] 
tests: Allow more time for sigma_dut sta_associate commands

The previously used timeout of two seconds did not allow more than a
single scan attempt and that could fail every now and then. Make these
more robust by increasing the timeout to 10 seconds which allows another
scan attempt to be completed similarly to the most non-sigma_dut test
cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSAE: Use Anti-Clogging Token Container element with H2E
Jouni Malinen [Mon, 20 Jan 2020 18:27:06 +0000 (20:27 +0200)] 
SAE: Use Anti-Clogging Token Container element with H2E

IEEE P802.11-REVmd was modified to use a container IE for anti-clogging
token whenver H2E is used so that parsing of the SAE Authentication
frames can be simplified.

See this document for more details of the approved changes:
https://mentor.ieee.org/802.11/dcn/19/11-19-2154-02-000m-sae-anti-clogging-token.docx

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSAE: Use H2E whenever Password Identifier is used
Jouni Malinen [Mon, 20 Jan 2020 19:15:04 +0000 (21:15 +0200)] 
SAE: Use H2E whenever Password Identifier is used

IEEE P802.11-REVmd was modified to require H2E to be used whenever
Password Identifier is used with SAE.

See this document for more details of the approved changes:
https://mentor.ieee.org/802.11/dcn/19/11-19-2154-02-000m-sae-anti-clogging-token.docx

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Remove mesh SAE Password Identifier test cases for now
Jouni Malinen [Tue, 21 Jan 2020 10:57:07 +0000 (12:57 +0200)] 
tests: Remove mesh SAE Password Identifier test cases for now

IEEE P802.11-REVmd was modified to require H2E to be used whenever
Password Identifier is used with SAE. Since wpa_supplicant and mac80211
do not yet support SAE H2E in mesh, Password Identifier cannot be used
in mesh cases. Remove the test cases that verified this behavior for now
to allow H2E to be required per updated REVmd definition. These test
cases will be restored once H2E is fully functionality in mesh cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSAE: Mark sae_derive_pt_ecc() static
Jouni Malinen [Mon, 20 Jan 2020 22:34:53 +0000 (00:34 +0200)] 
SAE: Mark sae_derive_pt_ecc() static

This function is not used outside sae.c.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: SAE anti clogging (forced, H2E)
Jouni Malinen [Mon, 20 Jan 2020 18:25:29 +0000 (20:25 +0200)] 
tests: SAE anti clogging (forced, H2E)

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSAE H2E: Check H2E-only BSS membership selector only if SAE is enabled
Jouni Malinen [Mon, 20 Jan 2020 18:23:48 +0000 (20:23 +0200)] 
SAE H2E: Check H2E-only BSS membership selector only if SAE is enabled

This BSS membership selector has impact only for SAE functionality, so
ignore it when configured not to use SAE. This allows WPA-PSK connection
to and AP that advertises WPA-PSK and SAE while requiring H2E for SAE.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: parallel-vm: allow running without curses
Johannes Berg [Wed, 15 Jan 2020 11:48:43 +0000 (12:48 +0100)] 
tests: parallel-vm: allow running without curses

Allow running without curses, in which case the log is simply written to
stdout instead of a file. This is useful for automated (but parallel)
testing. Note that in most cases, you'd want to specify --debug, and so
I added a .rstrip() there on the lines to clean that up a bit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agotrace: Handle binutils bfd.h breakage
Johannes Berg [Wed, 15 Jan 2020 09:10:03 +0000 (10:10 +0100)] 
trace: Handle binutils bfd.h breakage

Some things in bfd.h that we use were renamed, and in the case of
bfd_get_section_vma() a parameter was dropped. Work around this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 years agohostapd: Fix a typo in sample configuration
Daniel Golle [Thu, 16 Jan 2020 08:22:29 +0000 (10:22 +0200)] 
hostapd: Fix a typo in sample configuration

'assocition' -> 'association'

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agotests: Flush scan results in more Hotspot 2.0 test cases
Jouni Malinen [Fri, 10 Jan 2020 20:55:44 +0000 (22:55 +0200)] 
tests: Flush scan results in more Hotspot 2.0 test cases

This makes testing of INTERWORKING_CONNECT more robust.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Opportunistic Wireless Encryption transition mode disabled on STA
Jouni Malinen [Fri, 10 Jan 2020 18:37:41 +0000 (20:37 +0200)] 
tests: Opportunistic Wireless Encryption transition mode disabled on STA

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoEAP-SIM/AKA peer: Add support for EAP Method prefix
Hai Shalom [Fri, 27 Dec 2019 17:44:49 +0000 (09:44 -0800)] 
EAP-SIM/AKA peer: Add support for EAP Method prefix

Add support for EAP method prefix in the anonymous identity
used during EAP-SIM/AKA/AKA' authentication when encrypted IMSI
is used. The prefix is a single character that indicates which
EAP method is required by the client.

Signed-off-by: Hai Shalom <haishalom@google.com>
4 years agotests: Call stop_sigma_dut() in more failure cases
Jouni Malinen [Thu, 9 Jan 2020 22:19:27 +0000 (00:19 +0200)] 
tests: Call stop_sigma_dut() in more failure cases

Some of the sigma_dut test cases were not yet using try/finally to
ensure stop_sigma_dut() gets called. That could result in not logging
all failure reasons in the log and getting stuck with being unable to
start new sigma_dut processes after failed test cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Enable sigma_dut debug log for all test cases
Jouni Malinen [Thu, 9 Jan 2020 22:08:52 +0000 (00:08 +0200)] 
tests: Enable sigma_dut debug log for all test cases

There is no point in having to enable this separately for each test case
since the debug details are always useful if something fails.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Verify that sigma_dut is functional after startup
Jouni Malinen [Thu, 9 Jan 2020 22:04:43 +0000 (00:04 +0200)] 
tests: Verify that sigma_dut is functional after startup

There is no point in continuing the test ase if sigma_dut is not in
functional state.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Log sigma_dut stdout/stderr separately for each command
Jouni Malinen [Thu, 9 Jan 2020 21:31:29 +0000 (23:31 +0200)] 
tests: Log sigma_dut stdout/stderr separately for each command

This makes logs easier to understand and this may also help in running
over buffer space and getting stuck with sigma_dut termination.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoACS: Populate channel config from external ACS per documented behavior
Vamsi Krishna [Tue, 24 Dec 2019 12:01:39 +0000 (17:31 +0530)] 
ACS: Populate channel config from external ACS per documented behavior

Based on the now documented seg0/seg1 values from offloaded ACS, there
is a mismatch between the driver interface and internal hostapd use.

The value of segment0 field in ACS results is the index of the channel
center frequency for 20 MHz, 40 MHz, and 80M Hz channels. The value is
the center frequency index of the primary 80 MHz segment for 160 MHz and
80+80 MHz channels.

The value of segment1 field in ACS results is zero for 20 MHz, 40 MHz,
and 80 MHz channels. The value is the index of the channel center
frequency for 160 MHz channels and the center frequency index of the
secondary 80 MHz segment for 80+80 MHz channels.

However, in struct hostapd_config, for 160 MHz channels, the value of
the segment0 field is the index of the channel center frequency of 160
MHz channel and the value of the segment1 field is zero. Map the values
from ACS event into hostapd_config fields accordingly.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoACS: Update documentation of external ACS results event parameters
Vamsi Krishna [Tue, 24 Dec 2019 12:46:37 +0000 (18:16 +0530)] 
ACS: Update documentation of external ACS results event parameters

Update the documentation with values to be sent for seg0 and seg1 fields
in external ACS result event for 20 MHz, 40 MHz, 80 MHz, 160 MHz, and
80+80 MHz channels. These values match the changes done to definitions
of seg0 and seg1 fields in the IEEE 802.11 standard.

This vendor command had not previously been documented in this level of
detail and had not actually been used for the only case that could have
two different interpretation (160 MHz) based on which version of IEEE
802.11 standard is used.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years ago6 GHz: Fix Channel Width value for 80+80 in 6 GHZ Operation Info field
Vamsi Krishna [Tue, 24 Dec 2019 12:02:29 +0000 (17:32 +0530)] 
6 GHz: Fix Channel Width value for 80+80 in 6 GHZ Operation Info field

The Channel Width field value is 0 for 20 MHz, 1 for 40 MHz, 2 for 80
MHz, and 3 for both 160 MHz and 80+80 MHz channels. The 80+80 MHz case
was not addressed previously correctly since it cannot be derived from
seg0 only.

The Channel Center Frequency Segment 0 field value is the index of
channel center frequency for 20 MHz, 40 MHz, and 80 MHz channels. The
value is the center frequency index of the primary 80 MHz segment for
160 MHz and 80+80 MHz channels.

The Channel Center Frequency Segment 1 field value is zero for 20 MHz,
40 MHz, and 80 MHz channels. The value is the index of the channel
center frequency for 160 MHz channel and the center frequency index of
the secondary 80 MHz segment for 80+80 MHz channels.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSilence compiler warning in no-NEED_AP_MLME builds
Jouni Malinen [Thu, 9 Jan 2020 10:44:08 +0000 (12:44 +0200)] 
Silence compiler warning in no-NEED_AP_MLME builds

Make the dummy hostapd_hw_mode_txt() wrapper return "UNKNOWN" instead of
NULL to avoid a warning from a debug printf using %s with NULL.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSilence compiler warning with CONFIG_NO_ROAMING=y
Jouni Malinen [Thu, 9 Jan 2020 10:40:17 +0000 (12:40 +0200)] 
Silence compiler warning with CONFIG_NO_ROAMING=y

Comment out unused static functions if CONFIG_NO_ROAMING is defined.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Set key_flag when using SET_KEY
Alexander Wetzel [Sat, 4 Jan 2020 22:10:04 +0000 (23:10 +0100)] 
tests: Set key_flag when using SET_KEY

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agoIntroduce and add key_flag
Alexander Wetzel [Sat, 4 Jan 2020 22:10:04 +0000 (23:10 +0100)] 
Introduce and add key_flag

Add the new set_key() parameter "key_flag" to provide more specific
description of what type of a key is being configured. This is needed to
be able to add support for "Extended Key ID for Individually Addressed
Frames" from IEEE Std 802.11-2016. In addition, this may be used to
replace the set_tx boolean eventually once all the driver wrappers have
moved to using the new key_flag.

The following flag are defined:

  KEY_FLAG_MODIFY
    Set when an already installed key must be updated.
    So far the only use-case is changing RX/TX status of installed
    keys. Must not be set when deleting a key.

  KEY_FLAG_DEFAULT
    Set when the key is also a default key. Must not be set when
    deleting a key. (This is the replacement for set_tx.)

  KEY_FLAG_RX
    The key is valid for RX. Must not be set when deleting a key.

  KEY_FLAG_TX
    The key is valid for TX. Must not be set when deleting a key.

  KEY_FLAG_GROUP
    The key is a broadcast or group key.

  KEY_FLAG_PAIRWISE
    The key is a pairwise key.

  KEY_FLAG_PMK
    The key is a Pairwise Master Key (PMK).

Predefined and needed flag combinations so far are:

  KEY_FLAG_GROUP_RX_TX
    WEP key not used as default key (yet).

  KEY_FLAG_GROUP_RX_TX_DEFAULT
    Default WEP or WPA-NONE key.

  KEY_FLAG_GROUP_RX
    GTK key valid for RX only.

  KEY_FLAG_GROUP_TX_DEFAULT
    GTK key valid for TX only, immediately taking over TX.

  KEY_FLAG_PAIRWISE_RX_TX
    Pairwise key immediately becoming the active pairwise key.

  KEY_FLAG_PAIRWISE_RX
    Pairwise key not yet valid for TX. (Only usable with Extended Key ID
    support.)

  KEY_FLAG_PAIRWISE_RX_TX_MODIFY
    Enable TX for a pairwise key installed with KEY_FLAG_PAIRWISE_RX.

  KEY_FLAG_RX_TX
    Not a valid standalone key type and can only used in combination
    with other flags to mark a key for RX/TX.

This commit is not changing any functionality. It just adds the new
key_flag to all hostapd/wpa_supplicant set_key() functions without using
it, yet.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
4 years agotests: Fix Python sleep function
Markus Theil [Wed, 8 Jan 2020 23:03:02 +0000 (00:03 +0100)] 
tests: Fix Python sleep function

Current Python versions have no os.sleep(), use time.sleep() instead.

module 'os' has no attribute 'sleep'
Traceback (most recent call last):
  File "./run-tests.py", line 521, in main
    t(dev, apdev)
  File "/home/mtheil/hostap/tests/hwsim/test_pmksa_cache.py", line 356, in test_pmksa_cache_expiration
    hapd.wait_ptkinitdone(dev[0].own_addr())
  File "/home/mtheil/hostap/tests/hwsim/hostapd.py", line 282, in wait_ptkinitdone
    os.sleep(0.1)

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agonl80211: Pass set_key() parameter struct to wpa_driver_nl80211_set_key()
Jouni Malinen [Wed, 8 Jan 2020 22:47:03 +0000 (00:47 +0200)] 
nl80211: Pass set_key() parameter struct to wpa_driver_nl80211_set_key()

This is the function that actually uses the parameters, so pass the full
parameter struct to it instead of hiding the struct from it in the
simple wrapper.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agohostapd: Support VLAN offload to the driver
Gurumoorthi Gnanasambandhan [Thu, 5 Dec 2019 10:38:47 +0000 (12:38 +0200)] 
hostapd: Support VLAN offload to the driver

If the driver supports VLAN offload mechanism with a single netdev, use
that instead of separate per-VLAN netdevs.

Signed-off-by: Gurumoorthi Gnanasambandhan <gguru@codeaurora.org>
4 years agonl80211: VLAN offload support
Gurumoorthi Gnanasambandhan [Thu, 5 Dec 2019 10:38:47 +0000 (12:38 +0200)] 
nl80211: VLAN offload support

Add indication for driver VLAN offload capability and configuration of
the VLAN ID to the driver.

Signed-off-by: Gurumoorthi Gnanasambandhan <gguru@codeaurora.org>
4 years agoAdd vlan_id to driver set_key() operation
Gurumoorthi Gnanasambandhan [Thu, 5 Dec 2019 10:38:47 +0000 (12:38 +0200)] 
Add vlan_id to driver set_key() operation

This is in preparation for adding support to use a single WLAN netdev
with VLAN operations offloaded to the driver. No functional changes are
included in this commit.

Signed-off-by: Gurumoorthi Gnanasambandhan <gguru@codeaurora.org>
4 years agodriver: Move set_key() parameters into a struct
Jouni Malinen [Wed, 8 Jan 2020 20:15:18 +0000 (22:15 +0200)] 
driver: Move set_key() parameters into a struct

This makes it more convenient to add, remove, and modify the parameters
without always having to update every single driver_*.c implementation
of this callback function.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: SAE and AP sending Confirm message without waiting STA (2)
Jouni Malinen [Wed, 8 Jan 2020 18:57:26 +0000 (20:57 +0200)] 
tests: SAE and AP sending Confirm message without waiting STA (2)

This goes through sae_confirm_immediate=2 behavior.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoSAE: A bit optimized sae_confirm_immediate=2 for testing purposes
Jouni Malinen [Wed, 8 Jan 2020 18:52:26 +0000 (20:52 +0200)] 
SAE: A bit optimized sae_confirm_immediate=2 for testing purposes

sae_confirm_immediate=2 can now be used in CONFIG_TESTING_OPTIONS=y
builds to minimize the latency between SAE Commit and SAE Confirm by
postponing transmission of SAE Commit until the SAE Confirm frame is
generated. This does not have significant impact, but can get the frames
tiny bit closer to each other over the air to increase testing coverage.
The only difference between sae_confirm_immediate 1 and 2 is in the
former deriving KCK, PMK, PMKID, and CN between transmission of the
frames (i.e., a small number of hash operations).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoDo not select APs found on disabled channels for connection
Vamsi Krishna [Wed, 11 Dec 2019 12:57:47 +0000 (18:27 +0530)] 
Do not select APs found on disabled channels for connection

If a channel list changed event is received after a scan and before
selecting a BSS for connection, a BSS found on a now disabled channel
may get selected for connection. The connect request issued with the BSS
found on a disabled channel is rejected by cfg80211. Filter out the BSSs
found on disabled channels and select from the other BSSs found on
enabled channels to avoid unnecessary connection attempts that are bound
to fail.

The channel list information will be updated by the driver in cases like
country code update, disabling/enabling specific bands, etc. which can
occur between the scan and connection attempt.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoFix QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG1_CENTER_CHANNEL NULL check
Vamsi Krishna [Fri, 6 Dec 2019 10:52:18 +0000 (16:22 +0530)] 
Fix QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG1_CENTER_CHANNEL NULL check

Correct the check for presence of
QCA_WLAN_VENDOR_ATTR_ACS_VHT_SEG1_CENTER_CHANNEL attribute before using it
while processing acs_result event.

Fixes: 857d94225a94 ("Extend offloaded ACS QCA vendor command to support VHT")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Add digestmod for Python 3.8
Markus Theil [Wed, 8 Jan 2020 10:04:53 +0000 (11:04 +0100)] 
tests: Add digestmod for Python 3.8

The digestmod argument also exists in earlier Python versions,
version 3.8 does not set a default argument anymore.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agotests: Fix undefined behavior in module tests
Markus Theil [Wed, 8 Jan 2020 10:04:52 +0000 (11:04 +0100)] 
tests: Fix undefined behavior in module tests

Test: wpa_supplicant module tests
../src/utils/utils_module_tests.c:933:7: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agoOpenSSL: Fix memory leak in TOD policy validation
Jouni Malinen [Tue, 7 Jan 2020 18:40:12 +0000 (20:40 +0200)] 
OpenSSL: Fix memory leak in TOD policy validation

Returned policies from X509_get_ext_d2i() need to be freed.

Fixes: 21f1a1e66c39 ("Report TOD policy")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoRSN IBSS: Fix EAPOL TX using control port
Markus Theil [Mon, 6 Jan 2020 15:21:07 +0000 (16:21 +0100)] 
RSN IBSS: Fix EAPOL TX using control port

This was previously done only in supplicant role, but a similar change
is needed for the authenticator role.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agotests: PSK/EAP without nl80211 control port
Jouni Malinen [Sun, 5 Jan 2020 19:20:00 +0000 (21:20 +0200)] 
tests: PSK/EAP without nl80211 control port

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Allow control port to be disabled with a driver param
Jouni Malinen [Sun, 5 Jan 2020 19:18:18 +0000 (21:18 +0200)] 
nl80211: Allow control port to be disabled with a driver param

This is mainly for testing purposes to allow wpa_supplicant and hostapd
functionality to be tested both with and without using the nl80211
control port which is by default used whenever supported by the driver.
control_port=0 driver parameter will prevent that from happening.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Use control port TX for AP mode
Markus Theil [Fri, 3 Jan 2020 15:17:42 +0000 (16:17 +0100)] 
nl80211: Use control port TX for AP mode

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agonl80211: Report control port RX events
Markus Theil [Fri, 3 Jan 2020 15:17:42 +0000 (16:17 +0100)] 
nl80211: Report control port RX events

This allows EAPOL frames to be received over the separate controlled
port once rest of the driver interface is ready for this. By itself,
this commit does not actually change behavior since cfg80211 will not be
delivering these events without them being explicitly requested.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agoAdd no_encrypt flag for control port TX
Markus Theil [Fri, 3 Jan 2020 15:17:42 +0000 (16:17 +0100)] 
Add no_encrypt flag for control port TX

In order to correctly encrypt rekeying frames, wpa_supplicant now checks
if a PTK is currently installed and sets the corresponding encrypt
option for tx_control_port().

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
4 years agowpa_supplicant: Send EAPOL frames over nl80211 where available
Brendan Jackman [Fri, 3 Jan 2020 15:17:41 +0000 (16:17 +0100)] 
wpa_supplicant: Send EAPOL frames over nl80211 where available

Linux kernel v4.17 added the ability to request sending control port
frames via nl80211 instead of a normal network socket. Doing this
provides the device driver with ordering information between the
control port frames and the installation of keys. This empowers it to
avoid race conditions between, for example, PTK replacement and the
sending of frame 4 of the 4-way rekeying handshake in an RSNA. The
key difference between a TX_CONTROL_PORT and normal socket send is
that the device driver will certainly get any EAPOL frames comprising
a 4-way handshake before it gets the key installation call
for the derived key. By flushing its TX buffers it can then ensure
that no pending EAPOL frames are inadvertently encrypted with a key
that the peer will not yet have installed.

Update the RSN supplicant system to use this new operation for sending
EAPOL-Key frames when the driver reports that this capability is
available; otherwise, fall back to a normal Ethernet TX.

I have tested this on DMG (11ad/ay) devices with an out-of-tree Linux
driver that does not use mac80211. Without this patch I consistently see
PTK rekeying fail if message 4/4 shares a stream with other in-flight
traffic. With this patch, and the driver updated to flush the relevant TX
queue before overwriting a PTK (knowing, now, that if there was a message
4/4 related to the key installation, it has already entered the driver
queue), rekeying is reliable.

There is still data loss surrounding key installation - this problem is
alluded to in IEEE Std 802.11-2016, 12.6.21, where extended Key ID
support is described as the eventual solution. This patch aims to at
least prevent rekeying from totally breaking the association, in a way
that works on kernels as far back as 4.17 (as per Alexander Wetzel
extended Key ID support should be possible on 5.2).

See http://lists.infradead.org/pipermail/hostap/2019-May/040089.html for
a little more context.

Signed-off-by: Brendan Jackman <brendan.jackman@bluwireless.co.uk>
4 years agonl80211: Control port over nl80211 helpers
Brendan Jackman [Fri, 3 Jan 2020 15:17:41 +0000 (16:17 +0100)] 
nl80211: Control port over nl80211 helpers

Linux kernel v4.17 added the ability to request sending controlled port
frames (e.g., IEEE 802.1X controlled port EAPOL frames) via nl80211
instead of a normal network socket. Doing this provides the device
driver with ordering information between the control port frames and the
installation of keys. This empowers it to avoid race conditions between,
for example, PTK replacement and the sending of frame 4 of the 4-way
rekeying handshake in an RSNA. The key difference between the specific
control port and normal socket send is that the device driver will
certainly get any EAPOL frames comprising a 4-way handshake before it
gets the key installation call for the derived key. By flushing its TX
buffers it can then ensure that no pending EAPOL frames are
inadvertently encrypted with a key that the peer will not yet have
installed.

Add a CONTROL_PORT flag to the hostap driver API to report driver
capability for using a separate control port for EAPOL frames. This
operation is exactly like an Ethernet send except for the extra ordering
information it provides for device drivers. The nl80211 driver is
updated to support this operation when the device reports support for
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211. Also add a driver op
tx_control_port() for request a frame to be sent over the controlled
port.

Signed-off-by: Brendan Jackman <brendan.jackman@bluwireless.co.uk>
4 years agodriver: Remove unused send_ether() driver op
Jouni Malinen [Sun, 5 Jan 2020 16:32:10 +0000 (18:32 +0200)] 
driver: Remove unused send_ether() driver op

This was used only for FT RRB sending with driver_test.c and
driver_test.c was removed more than five years ago, so there is no point
in continuing to maintain this driver op.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: WPS Application Extension attribute
Jouni Malinen [Sat, 4 Jan 2020 21:39:40 +0000 (23:39 +0200)] 
tests: WPS Application Extension attribute

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoWPS: Add application extension data to WPS IE
Bilal Hatipoglu [Fri, 3 Jan 2020 08:58:26 +0000 (11:58 +0300)] 
WPS: Add application extension data to WPS IE

Application Extension attribute is defined in WSC tech spec v2.07 page
104. Allow hostapd to be configured to add this extension into WPS IE in
Beacon and Probe Response frames. The implementation is very similar to
vendor extension.

A new optional entry called "wps_application_ext" is added to hostapd
config file to configure this. It enodes the payload of the Application
Extension attribute in hexdump format.

Signed-off-by: Veli Demirel <veli.demirel@airties.com>
Signed-off-by: Bilal Hatipoglu <bilal.hatipoglu@airties.com>
4 years agoP2P: Move p2p_long_listen into struct wpa_global
Jouni Malinen [Sat, 4 Jan 2020 21:11:28 +0000 (23:11 +0200)] 
P2P: Move p2p_long_listen into struct wpa_global

This variable is not specific to any P2P group interface and since it
was already used through global->p2p_init_wpa_s, it is cleaner to simply
move this to the global structure so that there is a single variable
instead of per-interface variables and need to pick the correct
interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Test p2p_long_listen longer than remain-on-channel
Benjamin Berg [Fri, 3 Jan 2020 21:18:52 +0000 (22:18 +0100)] 
tests: Test p2p_long_listen longer than remain-on-channel

This tests an error, where the p2p_long_listen information from the
wrong device was used internally in wpa_supplicant when using the
separate P2P Device interface.

Signed-off-by: Benjamin Berg <bberg@redhat.com>
4 years agoP2P: Always use global p2p_long_listen
Benjamin Berg [Fri, 3 Jan 2020 21:18:51 +0000 (22:18 +0100)] 
P2P: Always use global p2p_long_listen

The p2p_long_listen value was set on the control wpa_s struct while in a
lot of cases it operated on the p2p struct. Explicitly use the global
p2p_init_wpa_s struct in cases where we might not be operating on it
already.

Without this, simply starting a p2p_listen operation (e.g., using
wpa_cli) will not work properly. As the p2p_long_listen is set on the
controlling interface and wpas_p2p_cancel_remain_on_channel_cb() uses
p2p_init_wpa_s, it would not actually work. This results in
wpa_supplicant stopping listening after the maximum remain-on-channel
time passes when using a separate P2P Device interface.

Signed-off-by: Benjamin Berg <bberg@redhat.com>
4 years agotests: PMF tests with not-protected disconnection using hostapd
Jouni Malinen [Sat, 4 Jan 2020 18:41:52 +0000 (20:41 +0200)] 
tests: PMF tests with not-protected disconnection using hostapd

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Use monitor interface for sending no-encrypt test frames
Jouni Malinen [Sat, 4 Jan 2020 18:23:05 +0000 (20:23 +0200)] 
nl80211: Use monitor interface for sending no-encrypt test frames

Since NL80211_CMD_FRAME does not allow encryption to be disabled for the
frame, add a monitor interface temporarily for cases where this type of
no-encrypt frames are to be sent. The temporary monitor interface is
removed immediately after sending the frame.

This is testing functionality (only in CONFIG_TESTING_OPTIONS=y builds)
that is used for PMF testing where the AP can use this to inject an
unprotected Robust Management frame (mainly, Deauthentication or
Disassociation frame) even in cases where PMF has been negotiated for
the association.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Detect tshark regression in wpas_mesh_gate_forwarding
Jouni Malinen [Sat, 4 Jan 2020 16:08:03 +0000 (18:08 +0200)] 
tests: Detect tshark regression in wpas_mesh_gate_forwarding

Skip this test case if the used tshark version has regression in mesh
control field parsing:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=15521

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Initial GTK/IGTK RSC setting
Jouni Malinen [Sat, 4 Jan 2020 11:07:47 +0000 (13:07 +0200)] 
tests: Initial GTK/IGTK RSC setting

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAllow testing override for GTK/IGTK RSC from AP to STA
Jouni Malinen [Sat, 4 Jan 2020 11:05:26 +0000 (13:05 +0200)] 
Allow testing override for GTK/IGTK RSC from AP to STA

The new hostapd gtk_rsc_override and igtk_rsc_override configuration
parameters can be used to set an override value for the RSC that the AP
advertises for STAs for GTK/IGTK. The contents of those parameters is a
hexdump of the RSC in little endian byte order.

This functionality is available only in CONFIG_TESTING_OPTIONS=y builds.
This can be used to verify that stations implement initial RSC
configuration correctly for GTK/ and IGTK.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: ROAM command failure cases
Jouni Malinen [Fri, 3 Jan 2020 16:09:57 +0000 (18:09 +0200)] 
tests: ROAM command failure cases

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoSME: Postpone current BSSID clearing until IEs are prepared
Jouni Malinen [Fri, 3 Jan 2020 16:06:01 +0000 (18:06 +0200)] 
SME: Postpone current BSSID clearing until IEs are prepared

sme_send_authentication() could fail before actually requesting the
driver to authenticate with a new AP. This could happen after
wpa_s->bssid got cleared even though in such a case, the old association
is maintained and still valid. This can result in unexpected behavior
since wpa_s->bssid would not match the current BSSID anymore.

Fix this by postponing clearing of wpa_s->bssid until the IE preparation
has been completed successfully.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DFS with RRM
Jouni Malinen [Fri, 3 Jan 2020 13:53:03 +0000 (15:53 +0200)] 
tests: DFS with RRM

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Don't set offchan-OK flag if doing on-channel frame in AP mode
Ben Greear [Tue, 19 Mar 2019 21:34:24 +0000 (14:34 -0700)] 
nl80211: Don't set offchan-OK flag if doing on-channel frame in AP mode

I saw a case where the kernel's cfg80211 rejected hostapd's attempt to
send a neighbor report response because nl80211 flagged the frame as
offchannel-OK, but kernel rejects because channel was 100 (DFS) and so
kernel failed thinking it was constrained by DFS/CAC requirements that
do not allow the operating channel to be left (at least in FCC).

Don't set the packet as off-channel OK if we are transmitting on the
current operating channel of an AP to avoid such issues with
transmission of Action frames.

Signed-off-by: Ben Greear <greearb@candelatech.com>
4 years agotests: Remove allow_failure from DFS test cases
Jouni Malinen [Fri, 3 Jan 2020 13:41:54 +0000 (15:41 +0200)] 
tests: Remove allow_failure from DFS test cases

This functionality has been available in mac80211_hwsim for years, so
there is no need to maintain this old workaround.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Use current command for NL80211_CMD_REGISTER_ACTION
Jouni Malinen [Fri, 3 Jan 2020 13:26:31 +0000 (15:26 +0200)] 
nl80211: Use current command for NL80211_CMD_REGISTER_ACTION

This was renamed to NL80211_CMD_REGISTER_FRAME long time ago.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Rename send_action_cookie to send_frame_cookie
Jouni Malinen [Fri, 3 Jan 2020 13:23:49 +0000 (15:23 +0200)] 
nl80211: Rename send_action_cookie to send_frame_cookie

This is to match the NL80211_CMD_ACTION renaming to NL80211_CMD_FRAME
that happened long time ago. This command can be used with any IEEE
802.11 frame and it should not be implied to be limited to Action
frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Clean up nl80211_send_frame_cmd() callers
Jouni Malinen [Fri, 3 Jan 2020 13:18:46 +0000 (15:18 +0200)] 
nl80211: Clean up nl80211_send_frame_cmd() callers

Replace a separate cookie_out pointer argument with save_cookie boolean
since drv->send_action_cookie is the only longer term storage place for
the cookies. Merge all nl80211_send_frame_cmd() callers within
wpa_driver_nl80211_send_mlme() to use a single shared call to simplify
the function.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Get rid of separate wpa_driver_nl80211_send_frame()
Jouni Malinen [Fri, 3 Jan 2020 12:53:37 +0000 (14:53 +0200)] 
nl80211: Get rid of separate wpa_driver_nl80211_send_frame()

Merge this function into wpa_driver_nl80211_send_mlme() that is now the
only caller for the previously shared helper function. This is a step
towards cleaning up the overly complex code path for sending Management
frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agodriver: Remove unused send_frame() driver op
Jouni Malinen [Fri, 3 Jan 2020 11:56:12 +0000 (13:56 +0200)] 
driver: Remove unused send_frame() driver op

All the previous users have now been converted to using send_mlme() so
this unused send_frame() callback can be removed.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoConvert the only remaining send_frame() users to send_mlme()
Jouni Malinen [Fri, 3 Jan 2020 11:50:35 +0000 (13:50 +0200)] 
Convert the only remaining send_frame() users to send_mlme()

Since send_mlme() now has support for the no_encrypt argument it is
possible to get rid of the remaining send_frame() uses.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Support no_encrypt=1 with send_mlme()
Jouni Malinen [Fri, 3 Jan 2020 11:49:10 +0000 (13:49 +0200)] 
nl80211: Support no_encrypt=1 with send_mlme()

This allows send_mlme() to be used to replace send_frame() for the test
cases where unencrypted Deauthentication/Disassociation frames need to
be sent out even when using PMF for the association. This is currently
supported only when monitor interface is used for AP mode management
frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agodriver: Add no_encrypt argument to send_mlme()
Jouni Malinen [Fri, 3 Jan 2020 11:48:33 +0000 (13:48 +0200)] 
driver: Add no_encrypt argument to send_mlme()

This is in preparation of being able to remove the separate send_frame()
callback.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoMake hostapd_drv_send_mlme() more generic
Jouni Malinen [Fri, 3 Jan 2020 11:34:37 +0000 (13:34 +0200)] 
Make hostapd_drv_send_mlme() more generic

Merge hostapd_drv_send_mlme_csa() functionality into
hostapd_drv_send_mlme() to get a single driver ops handler function for
hostapd. In addition, add a new no_encrypt parameter in preparation for
functionality that is needed to get rid of the separate send_frame()
driver op.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoP2P Manager: Use send_mlme() instead of send_frame() for Deauthentication
Jouni Malinen [Fri, 3 Jan 2020 11:22:32 +0000 (13:22 +0200)] 
P2P Manager: Use send_mlme() instead of send_frame() for Deauthentication

send_frame() is documented to be used for "testing use only" and as
such, it should not have used here for a normal production
functionality. Replace this with use of send_mlme() which is already
used for sending Deauthentication frames in other cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoIBSS RSN: Use send_mlme() instead of send_frame() for Authentication frames
Jouni Malinen [Fri, 3 Jan 2020 10:21:36 +0000 (12:21 +0200)] 
IBSS RSN: Use send_mlme() instead of send_frame() for Authentication frames

send_frame() is documented to be used for "testing use only" and as
such, it should not have used here for a normal production
functionality. Replace this with use of send_mlme() which is already
used for sending Authentication frames in number of other cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Simplify hapd_send_eapol() with monitor interface
Jouni Malinen [Fri, 3 Jan 2020 10:08:58 +0000 (12:08 +0200)] 
nl80211: Simplify hapd_send_eapol() with monitor interface

Call nl80211_send_monitor() directly instead of going through
wpa_driver_nl80211_send_frame() for the case where monitor interface is
used for AP mode management purposes. drv->use_monitor has to be 1 in
this code path, so wpa_driver_nl80211_send_frame() was calling
nl80211_send_monitor() unconditionally for this code path and that extra
function call can be removed here to simplify the implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Don't accept interrupted dump responses
Jouni Malinen [Thu, 2 Jan 2020 21:16:22 +0000 (23:16 +0200)] 
nl80211: Don't accept interrupted dump responses

Netlink dump message may be interrupted if an internal inconsistency is
detected in the kernel code. This can happen, e.g., if a Beacon frame
from the current AP is received while NL80211_CMD_GET_SCAN is used to
fetch scan results. Previously, such cases would end up not reporting an
error and that could result in processing partial data.

Modify this by detecting this special interruption case and converting
it to an error. For the NL80211_CMD_GET_SCAN, try again up to 10 times
to get the full response. For other commands (which are not yet known to
fail in similar manner frequently), report an error to the caller.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Make ap_hs20_roaming_consortiums_match more robust
Jouni Malinen [Thu, 2 Jan 2020 20:54:29 +0000 (22:54 +0200)] 
tests: Make ap_hs20_roaming_consortiums_match more robust

Explicitly clear cfg80211 scan cache to avoid issues with old BSS
entries from previous test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Roam between two APs based on driver signal level override
Jouni Malinen [Thu, 2 Jan 2020 18:31:30 +0000 (20:31 +0200)] 
tests: Roam between two APs based on driver signal level override

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoTest functionality to override driver reported signal levels
Jouni Malinen [Thu, 2 Jan 2020 18:29:24 +0000 (20:29 +0200)] 
Test functionality to override driver reported signal levels

"SET driver_signal_override <BSSID> [<si_signal< <si_avg_signal>
<si_avg_beacon_signal> <si_noise> <scan_level>]" command can now be used
to request wpa_supplicant to override driver reported signal levels for
signal_poll and scan results. This can be used to test roaming behavior.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoFix signal_poll based roaming skip
Jouni Malinen [Thu, 2 Jan 2020 18:33:01 +0000 (20:33 +0200)] 
Fix signal_poll based roaming skip

Fix a rebasing issue in the signal difference calculation. The older
patch was not updated to use the new cur_level local variable to get the
possibly updated signal level for the current BSS.

Fixes: a2c1bebd4301 ("Improve roaming logic")
Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoBSD: Use struct ip rather than struct iphdr
Roy Marples [Thu, 2 Jan 2020 17:12:33 +0000 (19:12 +0200)] 
BSD: Use struct ip rather than struct iphdr

As we define __FAVOR_BSD use the BSD IP header.
Compile tested on NetBSD, DragonFlyBSD, and Linux.

Signed-off-by: Roy Marples <roy@marples.name>
4 years agonl80211: Fix libnl error string fetching
Jouni Malinen [Thu, 2 Jan 2020 14:50:50 +0000 (16:50 +0200)] 
nl80211: Fix libnl error string fetching

libnl functions return a library specific error value in libnl 2.0 and
newer. errno is not necessarily valid in all error cases and strerror()
for the returned value is not valid either.

Use nl_geterror() to get the correct error string from the returned
error code.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agomac80211_linux: Fix libnl error string fetching
Jouni Malinen [Thu, 2 Jan 2020 14:50:50 +0000 (16:50 +0200)] 
mac80211_linux: Fix libnl error string fetching

libnl functions return a library specific error value. errno is not
necessarily valid in all error cases and strerror() for the returned
value is not valid either.

Use nl_geterror() to get the correct error string from the returned
error code.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDrop support for libnl 1.1
Jouni Malinen [Thu, 2 Jan 2020 15:27:02 +0000 (17:27 +0200)] 
Drop support for libnl 1.1

This simplifies code by not having to maintain and come up with new
backwards compatibility wrappers for a library release from 12 years
ago.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDrop debug print level for informative debug messages
Jouni Malinen [Thu, 2 Jan 2020 13:52:01 +0000 (15:52 +0200)] 
Drop debug print level for informative debug messages

These are certainly not error conditions, but normal cases for starting
up. Drop the message from ERROR to DEBUG.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Make scan_bss_limit more robust
Jouni Malinen [Thu, 2 Jan 2020 11:02:56 +0000 (13:02 +0200)] 
tests: Make scan_bss_limit more robust

Explicitly clear cfg80211 scan cache to avoid issues with old BSS
entries from previous test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: External MAC address change for connection
Jouni Malinen [Thu, 2 Jan 2020 10:09:33 +0000 (12:09 +0200)] 
tests: External MAC address change for connection

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoMaintain BSS entries for 5 seconds after interface is disabled
Jouni Malinen [Thu, 2 Jan 2020 09:51:04 +0000 (11:51 +0200)] 
Maintain BSS entries for 5 seconds after interface is disabled

This is targeting the case of MAC address change for an association
which may require the interface to be set down for a short moment.
Previously, this ended up flushing the BSS table that wpa_supplicant
maintained and that resulted in having to scan again if the MAC address
was changed between the previous scan and the connection attempt. This
is unnecessary extra latency, so maintain the BSS entries for 5 seconds
(i.e., the same time that the old scan results are consider valid for a
new connection attempt) after an interface goes down.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoIndicated if the selected BSS is the current BSS
Jouni Malinen [Wed, 1 Jan 2020 15:55:00 +0000 (17:55 +0200)] 
Indicated if the selected BSS is the current BSS

This makes scan result processing a bit more readable in debug log.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoMake min_diff determination from cur_level more readable
Jouni Malinen [Wed, 1 Jan 2020 15:46:03 +0000 (17:46 +0200)] 
Make min_diff determination from cur_level more readable

This handles both the dBm and unspecified unit cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoUse sel_est consistently with cur_sel in wpa_supplicant_need_to_roam()
Jouni Malinen [Wed, 1 Jan 2020 15:37:58 +0000 (17:37 +0200)] 
Use sel_est consistently with cur_sel in wpa_supplicant_need_to_roam()

This makes the code a bit easier to read.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoImprove roaming logic
Matthew Wang [Tue, 17 Jul 2018 17:56:21 +0000 (10:56 -0700)] 
Improve roaming logic

Currently, wpa_supplicant may roam too aggressively; the need_to_roam()
function will return early with a roaming decision if the difference in
signal level or throughput between the current and selected APs is
"sufficiently large." In particular, if the selected AP's estimated
throughput is more than 5k greater than the current AP's estimated
throughput, wpa_supplicant will decide to roam. Otherwise, if the
selected AP's signal level is less than the current AP's signal level,
or the selected AP's estimated throughput is at least 5k less than the
current AP's estimated throughput, wpa_supplicant will skip the roam.
These decisions are based only on one factor and can lead to poor
roaming choices (e.g., a roam should not happen if the selected AP's
estimated throughput meets the threshold but the current signal and
throughput are already good, whereas a roam should happen if the signal
is slightly worse but the estimated throughput is significantly better).

This change standardizes the roaming heuristic for signal strength
difference requirements and will hopefully improve user experience. The
change can be summarized as follows: based on the current signal level,
a certain roaming difficulty is assigned. Based on the selected AP's
estimated throughput relative to the current AP's estimated throughput,
the difficulty is adjusted up or down. If the difference in signal level
meets the threshold, a roam happens.

The hard-coded values were selected purely based on the previous version
of this function. They may eventually need to be fine-tuned for optimal
performance.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
4 years agoAllow roam to lower signal level if throughput benefit is significant
Jouni Malinen [Wed, 1 Jan 2020 15:09:18 +0000 (17:09 +0200)] 
Allow roam to lower signal level if throughput benefit is significant

Do not prevent roam to a different BSS based only on the signal level
with the current BSS being higher than with the selected BSS. If the
estimated throughput is significantly higher (> 20%), allow roaming if
the following conditions are met.

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