]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
5 years agoACS: Extend acs_find_chan() for all modes
Neo Jou [Mon, 13 Jan 2020 08:31:28 +0000 (16:31 +0800)] 
ACS: Extend acs_find_chan() for all modes

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This fixes use of opportunistic key caching with SAE.

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

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

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

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

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

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

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowlantest: Get STA IEs based on EAPOL-Key msg 2/4 before PTK derivation
Jouni Malinen [Thu, 27 Feb 2020 22:31:33 +0000 (00:31 +0200)] 
wlantest: Get STA IEs based on EAPOL-Key msg 2/4 before PTK derivation

The previous implementation tried to update STA IE information based on
EAPOL-Key msg 2/4 to be able to handle captures that do not include the
(Re)Association Request frame. This was not sufficient (OSEN was not
included) and was done too late (the parsed information is needed for
PMK-to-PTK derivation).

Move the IE update step to happen before trying to derive the PTK if no
(Re)Association Request frame has been seen.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoAdd attribute for dwell time in QCA vendor scan
Krishna Rao [Fri, 14 Feb 2020 12:25:40 +0000 (17:55 +0530)] 
Add attribute for dwell time in QCA vendor scan

Add an attribute QCA_WLAN_VENDOR_ATTR_SCAN_DWELL_TIME for specifying
dwell time in the QCA vendor scan command. This is a common value which
applies across all frequencies requested in the scan.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests/fuzzing: Update WPA set_key() handler prototype
Jouni Malinen [Tue, 25 Feb 2020 11:13:06 +0000 (13:13 +0200)] 
tests/fuzzing: Update WPA set_key() handler prototype

Update the fizzing test tools to use the new set_key() prototype, i.e.,
add the new key_flag argument, to get rid of compiler warnings.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests/fuzzing: Fix build after CONFIG_IEEE80211N=y removal
Jouni Malinen [Tue, 25 Feb 2020 11:08:00 +0000 (13:08 +0200)] 
tests/fuzzing: Fix build after CONFIG_IEEE80211N=y removal

Commit f3bcd6960346 ("Remove CONFIG_IEEE80211N build option") broke
couple of fuzzing test tools due to missing wpa_scan_results_free(). Fix
that by pulling in driver_common.o.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoIntroduce QCA_WLAN_VENDOR_ATTR_CONFIG_ROAM_REASON
Sunil Dutt [Thu, 20 Feb 2020 09:39:38 +0000 (15:09 +0530)] 
Introduce QCA_WLAN_VENDOR_ATTR_CONFIG_ROAM_REASON

This attribute enables/disables the host driver to send roam reason
information in the Reassociation Request frame to the AP in the same
ESS.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoFix enum qca_wlan_vendor_attr_config value prefix
Sunil Dutt [Thu, 20 Feb 2020 09:39:38 +0000 (15:09 +0530)] 
Fix enum qca_wlan_vendor_attr_config value prefix

Couple of the attributes were defined with inconsistent prefix in the
name (missing "CONFIG_"). Fix these to use the common prefix for all
enum qca_wlan_vendor_attr_config values. Add defined values for the
incorrect names to avoid issues with existing users.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: WPS PBC session overlap detection with single BSSID selected
Jouni Malinen [Mon, 24 Feb 2020 18:04:21 +0000 (20:04 +0200)] 
tests: WPS PBC session overlap detection with single BSSID selected

Update grpform_pbc_overlap not to require PBC session overlap to be
detected since in this sequence a single BSSID is specified and other
APs can be ignored while checking for session overlap. Add other test
cases to explicitly check for the PBC session overlap detection in
non-P2P and P2P cases when the BSSID is specified.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoWPS: Ignore other APs if PBC is used with a specific BSSID
Jouni Malinen [Mon, 24 Feb 2020 17:53:49 +0000 (19:53 +0200)] 
WPS: Ignore other APs if PBC is used with a specific BSSID

While the WSC specification requires the Enrollee to stop PBC
provisioning if the scan sees multiple APs in active PBC mode, this is
problematic due to some deployed devices continuing to advertise PBC
mode for extended duration (or even permanently). Such an environment
will still need to prevent wildcard AP selection with PBC since an
incorrect device could be selected. However, if the Enrollee device has
been explicitly requested to connect to a specific AP based on its
BSSID, the other APs in scan results can be ignored without affecting
which AP would be selected (only the one matching the specified BSSID is
acceptable).

Start filtering scan results for PBC session overlap check based on the
locally specified constraint on the BSSID, if one is set. This allows
PBC to be used with "WPS_PBC <BSSID>" command in environment where
another AP device is claiming to be in active PBC mode while "WPS_PBC"
command will still continue to reject provisioning since the correct AP
cannot be selected.

This will also cover the P2P cases where P2P_CONNECT is used to start or
authorize GO Negotiation and joining-a-GO with a specific P2P GO
Interface Address (BSSID).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Beacon protection capability flag and default key type
Jouni Malinen [Fri, 21 Feb 2020 16:19:04 +0000 (18:19 +0200)] 
nl80211: Beacon protection capability flag and default key type

Add a new capability flag based on the nl80211 feature advertisement and
start using the new default key type for Beacon protection. This enables
AP mode functionality to allow Beacon protection to be enabled. This is
also enabling the previously added ap_pmf_beacon_protection_* hwsim test
cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSync with mac80211-next.git include/uapi/linux/nl80211.h
Jouni Malinen [Mon, 24 Feb 2020 10:20:05 +0000 (12:20 +0200)] 
Sync with mac80211-next.git include/uapi/linux/nl80211.h

This brings in nl80211 definitions as of 2020-02-24.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix a type in wpa_supplicant defconfig
Jouni Malinen [Sun, 23 Feb 2020 22:05:20 +0000 (00:05 +0200)] 
Fix a type in wpa_supplicant defconfig

ap_mode=1 explanation in CONFIG_NO_SCAN_PROCESSING=y was really supposed
to be talking about ap_scan=1.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoSimplify wpa_deny_ptk0_rekey documentation
Alexander Wetzel [Sun, 23 Feb 2020 21:15:52 +0000 (22:15 +0100)] 
Simplify wpa_deny_ptk0_rekey documentation

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoAdd wpa_deny_ptk0_rekey to AP get_config() output
Alexander Wetzel [Sun, 23 Feb 2020 21:15:52 +0000 (22:15 +0100)] 
Add wpa_deny_ptk0_rekey to AP get_config() output

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agocommon: Add missing driver flag strings
Alexander Wetzel [Sun, 23 Feb 2020 21:15:53 +0000 (22:15 +0100)] 
common: Add missing driver flag strings

Add SAFE_PTK0_REKEYS and some other missing strings.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agotests: Use proper temp files for dynamically created config
Jouni Malinen [Sun, 23 Feb 2020 15:38:23 +0000 (17:38 +0200)] 
tests: Use proper temp files for dynamically created config

Replace the hardcoded /tmp filenames for generated ACL and BSS
configuration files with proper temporary files from tempfile.mkstemp()
to avoid conflicts with existing files or with parallel uses. Remove ACL
files from the local directory at the end of each test case. BSS files
are currently left behind, but can be cleaned up separately if needed
for non-VM testing (VM testing has those on ramdrive so they get dropped
automatically at the end) and for remote devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Remove unused BSS configuration files
Jouni Malinen [Sun, 23 Feb 2020 15:00:25 +0000 (17:00 +0200)] 
tests: Remove unused BSS configuration files

These are now generated dynamically.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Generate BSS config files in ap_bss_add_remove_during_ht_scan
Jouni Malinen [Sun, 23 Feb 2020 15:13:04 +0000 (17:13 +0200)] 
tests: Generate BSS config files in ap_bss_add_remove_during_ht_scan

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Generate BSS configuration files in ap_bss_add_out_of_memory
Jouni Malinen [Sun, 23 Feb 2020 15:05:43 +0000 (17:05 +0200)] 
tests: Generate BSS configuration files in ap_bss_add_out_of_memory

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Generate BSS configuration files in ap_bss_config_file
Jouni Malinen [Sun, 23 Feb 2020 14:58:43 +0000 (16:58 +0200)] 
tests: Generate BSS configuration files in ap_bss_config_file

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: remove: Fix a typo in a comment
Jouni Malinen [Sun, 23 Feb 2020 13:19:59 +0000 (15:19 +0200)] 
tests: remove: Fix a typo in a comment

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Extend wpas_ctrl_bssid_filter for remote testing
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:26 +0000 (23:02 +0100)] 
tests: Extend wpas_ctrl_bssid_filter for remote testing

When this test case is ran in remote test environment, there could be
additional APs in scan results after bssid_filter has been disabled.
That breaks the check on SCAN_RESULTS output. Extend this to cover the
remote testing case by using bssid_filter with both known APs listed
instead of full wildcard.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: Fix multi_check() for remote testing
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:25 +0000 (23:02 +0100)] 
tests: Fix multi_check() for remote testing

Don't use hardcoded BSSID; instead use the real BSSID from the device.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Generate and send BSS configuration files
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:24 +0000 (23:02 +0100)] 
tests: remote: Generate and send BSS configuration files

Instead of hardcoded bss-[1-6]*.conf files, generate them using the
correct BSSID for each AP device and send/install them on the remote
client as well if needed.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agohostapd: Replace UDP ctrl_iface global cookies with per-instance ones
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:23 +0000 (23:02 +0100)] 
hostapd: Replace UDP ctrl_iface global cookies with per-instance ones

The cookie values for UDP control interface commands was defined as a
static global array. This did not allow multi-BSS test cases to be
executed with UDP control interface. For example, after
    hapd1 = hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
    hapd2 = hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')

hapd1->ping() did not work.

Move those cookie values to per-instance location in struct
hapd_interfaces and struct hostapd_data to fix this.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: Generate ACL files
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:22 +0000 (23:02 +0100)] 
tests: Generate ACL files

Generate ACL files instead of using files with hardcoded values for the
STA MAC addresses. Send the generated files also to the remote client if
required.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remotehost: Add send_file()
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:21 +0000 (23:02 +0100)] 
tests: remotehost: Add send_file()

Some hostapd test cases use configuration files, e.g., ACLs in BSS
configuration. When executing remote tests (udp), we have to first send
these configuration files to the appropriate remote device. The new
send_file() helper can be used for that.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agoUse IFNAME= prefix for global UDP control interface events
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:20 +0000 (23:02 +0100)] 
Use IFNAME= prefix for global UDP control interface events

There does not seem to be a good reason for using the different IFACE=
prefix on the UDP control interface. This got added when the UDP
interface in wpa_supplicant was extended in commit f0e5d3b5c6c7
("wpa_supplicant: Share attach/detach/send UDP ctrl_iface functions")
and that was then extended to hostapd in commit e9208056856c ("hostapd:
Extend global control interface notifications").

Replace the IFACE= prefix in UDP case with IFNAME= to be consistent with
the UNIX domain socket based control interface.

This fixes a problem when at least one test case fail (hapd_ctrl_sta)
when remote/udp used. This also fixes test_connectivity().

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Handle different ifconfig output formats
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:19 +0000 (23:02 +0100)] 
tests: remote: Handle different ifconfig output formats

We could have different ifconfig output formats on the remote devices,
so make the parser more flexible to handle such cases.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Allow hwsim test cases with more than two arguments
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:18 +0000 (23:02 +0100)] 
tests: remote: Allow hwsim test cases with more than two arguments

This allows more test cases to be run in remote setup. Previously, we
used to block all test cases that required more than two arguments
(i.e., that needed the params argument).

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Show dev/apdev for hwsim
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:17 +0000 (23:02 +0100)] 
tests: remote: Show dev/apdev for hwsim

In case the hwsim wrapper is used in remote tests, show also which
device will be used as
apdev - hostapd
dev - wpa_supplicant

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Kill correct hostapd/wpa_supplicant process
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:16 +0000 (23:02 +0100)] 
tests: remote: Kill correct hostapd/wpa_supplicant process

Kill hostapd and wpa_supplicant based on the configuration parameters.
Previously, we could have killed wrong processes.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agotests: remote: Switch to python3
Janusz Dziedzic [Sun, 12 Jan 2020 22:02:15 +0000 (23:02 +0100)] 
tests: remote: Switch to python3

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
5 years agoIBSS RSN: Coding style cleanup
Alexander Wetzel [Fri, 10 Jan 2020 22:19:10 +0000 (23:19 +0100)] 
IBSS RSN: Coding style cleanup

Use consistent style for pointers.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agotests: Allow PTK0 rekey for tests
Alexander Wetzel [Fri, 10 Jan 2020 22:19:10 +0000 (23:19 +0100)] 
tests: Allow PTK0 rekey for tests

Verify PTK0 rekey blocking is working as intended.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoSTA: Allow PTK rekeying without Ext KeyID to be disabled as a workaround
Alexander Wetzel [Fri, 10 Jan 2020 22:19:09 +0000 (23:19 +0100)] 
STA: Allow PTK rekeying without Ext KeyID to be disabled as a workaround

Rekeying a pairwise key using only keyid 0 (PTK0 rekey) has many broken
implementations and should be avoided when using or interacting with
one. The effects can be triggered by either end of the connection and
range from hardly noticeable disconnects over long connection freezes up
to leaking clear text MPDUs.

To allow affected users to mitigate the issues, add a new configuration
option "wpa_deny_ptk0_rekey" to replace all PTK0 rekeys with fast
reconnects.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoAP: Allow PTK rekeying without Ext KeyID to be disabled as a workaround
Alexander Wetzel [Fri, 10 Jan 2020 22:19:08 +0000 (23:19 +0100)] 
AP: Allow PTK rekeying without Ext KeyID to be disabled as a workaround

Rekeying a pairwise key using only keyid 0 (PTK0 rekey) has many broken
implementations and should be avoided when using or interacting with
one. The effects can be triggered by either end of the connection and
range from hardly noticeable disconnects over long connection freezes up
to leaking clear text MPDUs.

To allow affected users to mitigate the issues, add a new hostapd
configuration option "wpa_deny_ptk0_rekey" to replace all PTK0 rekeys
with disconnection. This requires the station to reassociate to get
connected again and as such, can result in connectivity issues as well.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agonl80211: Add driver capability flag for CAN_REPLACE_PTK0
Alexander Wetzel [Sat, 4 Jan 2020 22:10:00 +0000 (23:10 +0100)] 
nl80211: Add driver capability flag for CAN_REPLACE_PTK0

The CAN_REPLACE_PTK0 flag provided by nl80211 can be used to detect if
the card/driver is explicitly indicating capability to rekey STA PTK
keys using only keyid 0 correctly.

Check if the card/driver supports it and make the status available as a
driver flag.

Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
5 years agoDo not skip MBO PMF check with the WPS special case WPA check exception
Jouni Malinen [Sat, 22 Feb 2020 17:07:11 +0000 (19:07 +0200)] 
Do not skip MBO PMF check with the WPS special case WPA check exception

The MBO PMF check for AP SME in the driver case was added into a
location that is skipped for WPS processing. That was not really the
correct place for this since the skip_wpa_check label was supposed to
remain immediately following the WPA checks. While this does not really
have much of a practical impact, move the check around so that the
skip_wpa_check label remains where it is supposed to be.

Fixes: 4c572281edaa ("MBO: Mandate use of PMF for WPA2+MBO association (AP)")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoSave RM enabled capability of station with AP SME
Ouden [Fri, 21 Feb 2020 01:39:46 +0000 (09:39 +0800)] 
Save RM enabled capability of station with AP SME

Save RM enabled capability element of an associating station when
hostapd use the device AP SME similarly to how this information is saved
with SME-on-hostapd cases. This allows radio measurement operations
(e.g., REQ_BEACON) to be used.

Signed-off-by: Ouden <Ouden.Biz@gmail.com>
5 years agoMake INTERWORKING_CONNECT more reliable in testing environment
Jouni Malinen [Sat, 22 Feb 2020 16:49:01 +0000 (18:49 +0200)] 
Make INTERWORKING_CONNECT more reliable in testing environment

Pick the most recently added BSS entry based on BSSID matching to avoid
issues in testing environment where the SSID of the AP may have changed
and both the old and new BSS is still present in the scan results.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix a typo in a comment
Jouni Malinen [Sat, 22 Feb 2020 15:08:19 +0000 (17:08 +0200)] 
Fix a typo in a comment

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoRemove Secondary Channel Offset element from Beacon/Probe Response frames
Jouni Malinen [Sat, 22 Feb 2020 15:05:20 +0000 (17:05 +0200)] 
Remove Secondary Channel Offset element from Beacon/Probe Response frames

This element is not used in Beacon or Probe Response frames (which is
the reason why the standard does not indicate where exactly it would be
in those frames..); HT Operation element has this information and so
does Extended CSA element.

In practice, this reverts the functionality added in commit 76aab0305c1f
("Add secondary channel IE for CSA").

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix HE element order in Beacon and Probe Response frames
Jouni Malinen [Sat, 22 Feb 2020 14:50:10 +0000 (16:50 +0200)] 
Fix HE element order in Beacon and Probe Response frames

Spatial Reuse Parameter Set element is before MU EDCA Parameter Set
element.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoRemove CONFIG_IEEE80211N build option
Jouni Malinen [Sat, 22 Feb 2020 14:22:18 +0000 (16:22 +0200)] 
Remove CONFIG_IEEE80211N build option

Hardcoded CONFIG_IEEE80211N to be included to clean up implementation.
More or less all new devices support IEEE 802.11n (HT) and there is not
much need for being able to remove that functionality from the build.
Included this unconditionally to get rid of one more build options and
to keep things simpler.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix location of MDE and RSNXE in Beacon and Probe Response frames
Jouni Malinen [Sat, 22 Feb 2020 14:07:17 +0000 (16:07 +0200)] 
Fix location of MDE and RSNXE in Beacon and Probe Response frames

Split the IEs from WPA authenticator state machine into separately added
IEs so that the exact location between these and other elements can be
controlled. This fixes the location of MDE and RSNXE in Beacon and Probe
Response frames. In addition, this swaps the order of BSS Load and RM
Enabled Capabilities elements in Beacon frames to get them into the
correct order (which was already used for Probe Response frames).
Furthermore, this fixes the buffer end checks for couple of elements to
make the implementation more consistent (though, in practice, there is
no impact from this since the old size limit was smaller than needed,
but still sufficiently large to have room for these).

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Beacon protection
Jouni Malinen [Mon, 17 Feb 2020 21:45:18 +0000 (23:45 +0200)] 
tests: Beacon protection

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agowlantest: BIGTK fetching and Beacon protection validation
Jouni Malinen [Fri, 21 Feb 2020 17:40:32 +0000 (19:40 +0200)] 
wlantest: BIGTK fetching and Beacon protection validation

Fetch the BIGTK from EAPOL-Key msg 3/4 and use it to validate MME in
Beacon frames when the AP uses Beacon protection.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoConfigure received BIGTK on station/supplicant side
Jouni Malinen [Mon, 17 Feb 2020 22:06:26 +0000 (00:06 +0200)] 
Configure received BIGTK on station/supplicant side

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agowpa_supplicant configuration for Beacon protection
Jouni Malinen [Mon, 17 Feb 2020 22:16:55 +0000 (00:16 +0200)] 
wpa_supplicant configuration for Beacon protection

Add a new wpa_supplicant network profile configuration parameter
beacon_prot=<0/1> to allow Beacon protection to be enabled.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAdd BIGTK KDE and subelement similarly to IGTK
Jouni Malinen [Mon, 17 Feb 2020 21:08:05 +0000 (23:08 +0200)] 
Add BIGTK KDE and subelement similarly to IGTK

This provides the BIGTK updates to associated stations similarly to
IGTK.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoGenerate BIGTK and rekey it with IGTK
Jouni Malinen [Mon, 17 Feb 2020 21:08:05 +0000 (23:08 +0200)] 
Generate BIGTK and rekey it with IGTK

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoParsing of BIGTK KDE in EAPOL-Key frames
Jouni Malinen [Mon, 17 Feb 2020 21:03:40 +0000 (23:03 +0200)] 
Parsing of BIGTK KDE in EAPOL-Key frames

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoParsing of BIGTK subelement in FTE
Jouni Malinen [Mon, 17 Feb 2020 21:01:59 +0000 (23:01 +0200)] 
Parsing of BIGTK subelement in FTE

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agodriver: Document use of set_key() for BIGTK
Jouni Malinen [Mon, 17 Feb 2020 20:58:52 +0000 (22:58 +0200)] 
driver: Document use of set_key() for BIGTK

Also update the comment to match the current IGTK KeyID range.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAP mode indication of Beacon protection being enabled
Jouni Malinen [Mon, 17 Feb 2020 20:55:12 +0000 (22:55 +0200)] 
AP mode indication of Beacon protection being enabled

Add the new Extended Capability bit for indicating Beacon protection.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agohostapd configuration for Beacon protection
Jouni Malinen [Mon, 17 Feb 2020 20:54:23 +0000 (22:54 +0200)] 
hostapd configuration for Beacon protection

Add a new hostapd configuration parameter beacon_prot=<0/1> to allow
Beacon protection to be enabled.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Remove an extra closing parenthesis from a debug message
Jouni Malinen [Mon, 17 Feb 2020 21:44:26 +0000 (23:44 +0200)] 
nl80211: Remove an extra closing parenthesis from a debug message

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Check nla_nest_start() result for NL80211_ATTR_HE_OBSS_PD
Jouni Malinen [Mon, 17 Feb 2020 17:30:47 +0000 (19:30 +0200)] 
nl80211: Check nla_nest_start() result for NL80211_ATTR_HE_OBSS_PD

nla_nest_start() might fail, so need to check its return value similarly
to all the other callers.

Fixes: a84bf443887d ("HE: Send the AP's OBSS PD settings to the kernel")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoHE: Propagate BSS color settings to nl80211
John Crispin [Tue, 4 Feb 2020 08:04:55 +0000 (09:04 +0100)] 
HE: Propagate BSS color settings to nl80211

Add the code required to send the BSS color settings to the kernel.

Signed-off-by: John Crispin <john@phrozen.org>
5 years agoFix VERSION_STR printf() calls in case the postfix strings include %
Didier Raboud [Sun, 16 Feb 2020 15:14:54 +0000 (16:14 +0100)] 
Fix VERSION_STR printf() calls in case the postfix strings include %

Do not use VERSION_STR directly as the format string to printf() since
it is possible for that string to contain '%'.

Signed-off-by: Didier Raboud <odyx@debian.org>
5 years agonl80211: Handle AKM suite selectors for AP configuration
Jouni Malinen [Mon, 17 Feb 2020 15:43:11 +0000 (17:43 +0200)] 
nl80211: Handle AKM suite selectors for AP configuration

Previously only couple of AKM suite selectors were converted into
NL80211_ATTR_AKM_SUITES. Add rest of the AKM suites here. However, since
the current kernel interface has a very small limit
(NL80211_MAX_NR_AKM_SUITES = 2), add the attribute only when no more
than that limit entries are included. cfg80211 would reject the command
with any more entries listed.

This needs to be extended in cfg80211/nl80211 in a backwards compatible
manner, so this seems to be the best that can be done for now in user
space. Many drivers do not use this attribute, so must not reject the
configuration completely when larger number of AKM suites is configured.
Such cases may not work properly with drivers that depend on
NL80211_ATTR_AKM_SUITES value.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoRemove duplicated wpa_akm_to_suite() entry
Jouni Malinen [Mon, 17 Feb 2020 15:41:51 +0000 (17:41 +0200)] 
Remove duplicated wpa_akm_to_suite() entry

This was unreachable code due to the previous WPA_KEY_MGTM_OWE case
returning from the function.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Add NLA_F_NESTED to nla_nest_start() with older libnl versions
Jouni Malinen [Mon, 17 Feb 2020 15:25:05 +0000 (17:25 +0200)] 
nl80211: Add NLA_F_NESTED to nla_nest_start() with older libnl versions

This is needed to work around a missing attribute that would cause
cfg80211 to reject some nl80211 commands (e.g.,
NL80211_ATTR_VENDOR_DATA) with new kernel versions that enforce netlink
attribute policy validation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agowebkit: Clean up USE_WEBKIT2 blocks
Jouni Malinen [Sun, 16 Feb 2020 16:45:12 +0000 (18:45 +0200)] 
webkit: Clean up USE_WEBKIT2 blocks

Use a single block each for webkit and webkit2 signal handlers. This
cleans up browser.c to have clear sections for each webkit API version.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Split decide-policy into a separate function
Jouni Malinen [Sun, 16 Feb 2020 16:40:42 +0000 (18:40 +0200)] 
webkit2: Split decide-policy into a separate function

This cleans up the #ifdef/#else/#endif mess in the function for webkit
vs. webkit2 API.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Split resource-load-started handler into a separate function
Jouni Malinen [Sun, 16 Feb 2020 16:37:02 +0000 (18:37 +0200)] 
webkit2: Split resource-load-started handler into a separate function

This cleans up the #ifdef/#else/#endif mess in the function for webkit
vs. webkit2 API.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit: Track gtk_main()/gtk_main_quit() calls
Jouni Malinen [Sun, 16 Feb 2020 16:31:31 +0000 (18:31 +0200)] 
webkit: Track gtk_main()/gtk_main_quit() calls

Avoid unnecessary warnings from webkit on calling gtk_main_quit() more
than once for a single gtk_main() call. This is also fixing an issue for
a corner case where the very first URL has special purpose (osu:// or
http://localhost:12345).

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Remove TODO not for download-started
Jouni Malinen [Sun, 16 Feb 2020 16:18:07 +0000 (18:18 +0200)] 
webkit2: Remove TODO not for download-started

It does not look like this signal handler would be needed.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Do not register notify::load-status handler
Jouni Malinen [Sun, 16 Feb 2020 16:16:13 +0000 (18:16 +0200)] 
webkit2: Do not register notify::load-status handler

This did not seem to do anything with webkit2, so do not bother
registering the handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Replace notfy::progress with notify::estimated-load-progress
Jouni Malinen [Sun, 16 Feb 2020 16:11:42 +0000 (18:11 +0200)] 
webkit2: Replace notfy::progress with notify::estimated-load-progress

The older signal handler for notify::progress did not really work with
webkit2.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Implement notify::title handler
Jouni Malinen [Sun, 16 Feb 2020 16:06:20 +0000 (18:06 +0200)] 
webkit2: Implement notify::title handler

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowebkit2: Use mouse-target-changed to replace hovering-over-link
Jouni Malinen [Sun, 16 Feb 2020 16:00:49 +0000 (18:00 +0200)] 
webkit2: Use mouse-target-changed to replace hovering-over-link

The previous implementation of hovering-over-link signal handler did not
really work with webkit2, so replace this with mouse-target-changed
handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agohs20-osu-client: Validate HTTPS server certificate by default (browser)
Jouni Malinen [Sun, 16 Feb 2020 15:33:58 +0000 (17:33 +0200)] 
hs20-osu-client: Validate HTTPS server certificate by default (browser)

This changes "hs20-osu-client browser <URL>" behavior to validate the
HTTPS server certificate against the system trust roots. The new command
line argument -T can be used to disable this validation.

This does not change behavior for SPP/OMA-DM triggered OSU operation,
i.e., they continue to not mandate server certificate validation for now
to avoid breaking existing test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agohs20_web_browser() to allow TLS server validation to be enabled
Jouni Malinen [Sun, 16 Feb 2020 15:28:58 +0000 (17:28 +0200)] 
hs20_web_browser() to allow TLS server validation to be enabled

hs20_web_browser() was previously hardcoded to not perform strict TLS
server validation. Add an argument to this function to allow that
behavior to be configured. The hs20-osu-client users are still using the
old behavior, i.e., not validating server certificates, to be usable for
testing purposes.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agohs20-osu-client: Ignore TLS errors with webkit2
Ben Greear [Fri, 7 Feb 2020 09:10:16 +0000 (01:10 -0800)] 
hs20-osu-client: Ignore TLS errors with webkit2

Hopefully this helps with self-signed certificates. This matches the
older behavior with webkit.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agohs20-osu-client: Enable webkit2 support
Ben Greear [Fri, 7 Feb 2020 09:10:13 +0000 (01:10 -0800)] 
hs20-osu-client: Enable webkit2 support

This is my mostly-ignorant attempt to port hs20-osu-client to webkit2
API.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agoHT: Remove SMPS in AP mode
Jouni Malinen [Sun, 16 Feb 2020 11:58:54 +0000 (13:58 +0200)] 
HT: Remove SMPS in AP mode

SM Power Save was described in somewhat unclear manner in IEEE Std
802.11n-2009 as far the use of it locally in an AP to save power. That
was clarified in IEEE Std 802.11-2016 to allow only a non-AP STA to use
SMPS while the AP is required to support an associated STA doing so. The
AP itself cannot use SMPS locally and the HT Capability advertisement
for this is not appropriate.

Remove the parts of SMPS support that involve the AP using it locally.
In practice, this reverts the following commits:
04ee647d58a2 ("HT: Let the driver advertise its supported SMPS modes for AP mode")
8f461b50cfe4 ("HT: Pass the smps_mode in AP parameters")
da1080d7215f ("nl80211: Advertise and configure SMPS modes")

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Remove ap_ht_smps
Jouni Malinen [Sun, 16 Feb 2020 11:48:39 +0000 (13:48 +0200)] 
tests: Remove ap_ht_smps

AP using SMPS mode locally is about to be removed from hostapd, so
remove the test case that was using it.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoHE: Add TWT responder extended capabilities field
Mikhail Karpenko [Tue, 4 Feb 2020 08:05:41 +0000 (09:05 +0100)] 
HE: Add TWT responder extended capabilities field

Set the proper bits inside the extended capabilities field to indicate
support for TWT responder.

Tested-by: John Crispin <john@phrozen.org>
Signed-off-by: Mikhail Karpenko <karpenko@fastmail.com>
5 years agoHE: Dynamically turn on TWT responder support
John Crispin [Tue, 4 Feb 2020 08:05:40 +0000 (09:05 +0100)] 
HE: Dynamically turn on TWT responder support

This allows us to dynamically turn on TWT responder support using an
nl80211 attribute.

Signed-off-by: John Crispin <john@phrozen.org>
5 years agoHE: Extend BSS color support
John Crispin [Tue, 4 Feb 2020 08:04:54 +0000 (09:04 +0100)] 
HE: Extend BSS color support

The HE Operation field for BSS color consists of a disabled, a partial,
and 6 color bits. The original commit adding support for BSS color
considered this to be a u8. This commit changes this to the actual
bits/values.

This adds an explicit config parameter for the partial bit. The disabled
is set to 0 implicitly if a bss_color is defined.

Interoperability testing showed that stations will require a BSS color
to be set even if the feature is disabled. Hence the default color is 1
when none is defined inside the config file.

Signed-off-by: John Crispin <john@phrozen.org>
5 years agoSync with mac80211-next.git include/uapi/linux/nl80211.h
Jouni Malinen [Sun, 16 Feb 2020 10:05:43 +0000 (12:05 +0200)] 
Sync with mac80211-next.git include/uapi/linux/nl80211.h

This brings in nl80211 definitions as of 2020-02-07.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoWPS: Mark added PSK entry with wps=1 tag for per-Enrollee PSK case
Jouni Malinen [Sun, 16 Feb 2020 09:54:36 +0000 (11:54 +0200)] 
WPS: Mark added PSK entry with wps=1 tag for per-Enrollee PSK case

Commit 2bab073dfe02 ("WPS: Add new PSK entries with wps=1 tag") added
this when writing the new entry into a file, but the in-memory update
did not get the tag. Add it there as well.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: WPS PIN provisioning with per-station PSK preset
Jouni Malinen [Sun, 16 Feb 2020 09:54:30 +0000 (11:54 +0200)] 
tests: WPS PIN provisioning with per-station PSK preset

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