]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
3 years agoDPP2: Do not try to remove Controller TCP connection twice on error
Jouni Malinen [Mon, 18 Oct 2021 21:23:09 +0000 (00:23 +0300)] 
DPP2: Do not try to remove Controller TCP connection twice on error

These code paths on the Controller were calling dpp_connection_remove()
twice for the same connection in the error cases. That would result in
double-freeing of the memory, so fix this by remove the
dpp_connection_remove() call from the called function and instead,
remove the connection in dpp_controller_rx() error handling.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agotests: DPP Controller management in hostapd over interface addition/removal
Jouni Malinen [Mon, 18 Oct 2021 21:15:21 +0000 (00:15 +0300)] 
tests: DPP Controller management in hostapd over interface addition/removal

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoDPP2: Clean up Controller on hostapd interface removal
Jouni Malinen [Mon, 18 Oct 2021 21:04:46 +0000 (00:04 +0300)] 
DPP2: Clean up Controller on hostapd interface removal

Stop the DPP Controller instance, if one is started, when the hostapd
interface that was used to start that Controller is removed. This is
needed to remove the control pointers that point to the soon-to-be-freed
hostapd structures. This fixes an issue where a Controller operation
with multiple interfaces could have resulted in references to freed
memory if an interface is removed without explicitly stopping the DPP
Controller.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agomacsec_qca: Support macsec secy id getting from driver
leiwei [Tue, 10 Aug 2021 07:18:14 +0000 (15:18 +0800)] 
macsec_qca: Support macsec secy id getting from driver

Use the new nss_macsec_secy_id_get() function, if available, instead of
the hardcoded ifname to secy_id mapping.

Signed-off-by: leiwei <leiwei@codeaurora.org>
3 years agoproxyarp: Fix compilation with Hotspot 2.0 disabled
David Bauer [Wed, 6 Oct 2021 00:21:05 +0000 (02:21 +0200)] 
proxyarp: Fix compilation with Hotspot 2.0 disabled

The disable_dgaf config field is only available in case hostapd is
compiled with Hotspot 2.0 support (CONFIG_HS20=y), however Proxy-ARP
(CONFIG_PROXYARP=y) does not depend on Hotspot 2.0.

Only add the code related to this config field when Hotspot 2.0 is
enabled to fix compilation with the aformentioned preconditions.

Signed-off-by: David Bauer <mail@david-bauer.net>
3 years agotests: Update sae_pmk_lifetime to match implementation
Jouni Malinen [Mon, 18 Oct 2021 18:21:07 +0000 (21:21 +0300)] 
tests: Update sae_pmk_lifetime to match implementation

The current PMKSA cache entry with SAE does not expire during the
association anymore.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoSAE: Do not expire the current PMKSA cache entry
Jouni Malinen [Mon, 18 Oct 2021 17:02:35 +0000 (20:02 +0300)] 
SAE: Do not expire the current PMKSA cache entry

There is no convenient mechanism for reauthenticating and generating a
new PMK during an association with SAE. As such, forced PMK update would
mean having to disassociate and reauthenticate which is not really
desired especially when the default PMKLifetime is only 12 hours.

Postpone PMKSA cache entry expiration of the currently used entry with
SAE until the association is lost. In addition, do not try to force the
EAPOL state machine to perform reauthentication for SAE since that won't
work.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agowpa_supplicant: Try all drivers by default
Kees Cook [Tue, 12 Oct 2021 18:28:31 +0000 (11:28 -0700)] 
wpa_supplicant: Try all drivers by default

Some distros carry patches to specify driver fallback, but only in
specific conditions (e.g. the systemd service definition[1]). This leaves
other wpa_supplicant instances needing to define fallback themselves,
which leads to places where wpa_supplicant thinks it can't find a
driver[2]. Instead, when -D is not specified, have wpa_supplicant try
all the drivers it was built with in an attempt to find a working one
instead of just giving up if the first doesn't work.

[1] https://salsa.debian.org/debian/wpa/-/blob/debian/unstable/debian/patches/networkd-driver-fallback.patch
[2] https://bugs.launchpad.net/netplan/+bug/1814012

Signed-off-by: Kees Cook <kees@ubuntu.com>
3 years agoAdd support to reconfigure or flush PMKSA cache on interface enable
Veerendranath Jakkam [Thu, 7 Oct 2021 14:16:04 +0000 (19:46 +0530)] 
Add support to reconfigure or flush PMKSA cache on interface enable

Update PMKSA cache when interface is disabled and then enabled based on
the new MAC address. If the new MAC address is same as the previous MAC
address, the PMKSA cache entries are valid and hence update the PMKSA
cache entries to the driver. If the new MAC address is not same as the
previous MAC address, the PMKSA cache entries will not be valid anymore
and hence delete the PMKSA cache entries.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoPMKSA: Make sure reauth time is not greater than expiration time
Veerendranath Jakkam [Thu, 14 Oct 2021 13:26:14 +0000 (18:56 +0530)] 
PMKSA: Make sure reauth time is not greater than expiration time

While creating a cloned PMKSA entry for OKC both expiration and
reauth_time values are set to maximum values, but later only the
expiration time is copied from the old PMKSA entry to the new PMKSA
entry. Due to this there is a possibility of reauth_time becoming
greater than expiration time in some cloned entries. To avoid this copy
reauth_time also to the cloned entry.

Also, add check to reject control interface commands with reauth time
greater than expiration time.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agotests: AP configuration attempt using wps_config when WPS is disabled
Jouni Malinen [Thu, 14 Oct 2021 13:35:16 +0000 (16:35 +0300)] 
tests: AP configuration attempt using wps_config when WPS is disabled

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoFix hostapd segfault on WPS_CONFIG control interface command to non-WPS AP
Masashi Honma [Tue, 12 Oct 2021 22:40:04 +0000 (07:40 +0900)] 
Fix hostapd segfault on WPS_CONFIG control interface command to non-WPS AP

Execution of "hostapd_cli wps_config" to non-WPS AP causes segmentation
fault in hostapd.

$ hostapd_cli wps_config test WPA2PSK CCMP 12341234

wlp11s0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlp11s0: interface state COUNTRY_UPDATE->ENABLED
wlp11s0: AP-ENABLED
WPA_TRACE: eloop SIGSEGV - START
[1]: ./git/hostap/hostapd/hostapd(+0x6c196) [0x55b270245196]
     eloop_sigsegv_handler() ../src/utils/eloop.c:123
[2]: /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f87574a7210]
[3]: ./git/hostap/hostapd/hostapd(hostapd_wps_config_ap+0x1a9) [0x55b2702ce349]
     hostapd_wps_config_ap() ../src/ap/wps_hostapd.c:1970
[4]: ./git/hostap/hostapd/hostapd(+0x90a9f) [0x55b270269a9f]
     hostapd_ctrl_iface_receive_process() ctrl_iface.c:3606
[5]: ./git/hostap/hostapd/hostapd(+0x94069) [0x55b27026d069]
     hostapd_ctrl_iface_receive() ctrl_iface.c:4093
[6]: ./git/hostap/hostapd/hostapd(+0x6c6d3) [0x55b2702456d3]
     eloop_sock_table_dispatch() ../src/utils/eloop.c:606
[7]: ./git/hostap/hostapd/hostapd(eloop_run+0x251) [0x55b2702461c1]
     eloop_sock_table_dispatch() ../src/utils/eloop.c:597
     eloop_run() ../src/utils/eloop.c:1229
[8]: ./git/hostap/hostapd/hostapd(main+0xd53) [0x55b270205773]
     hostapd_global_run() main.c:447
     main() main.c:892
[9]: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f87574880b3]
[10]: ./git/hostap/hostapd/hostapd(_start+0x2e) [0x55b2702058fe]
     _start() (null):0
WPA_TRACE: eloop SIGSEGV - END
Aborted

Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
3 years agowlantest: Fix PMK length and passphrase-based key derivation for FT
Jouni Malinen [Thu, 14 Oct 2021 13:28:02 +0000 (16:28 +0300)] 
wlantest: Fix PMK length and passphrase-based key derivation for FT

The change to support variable length PMK in wlantest missed couple of
places where the PMK length did not get used or set properly. In
particular, this ended up breaking FT key derivation for the case where
a passphrase was used to derive a potential per-BSS PMK. Fix this by
setting and using the PMK length properly.

Fixes: 6c29d95a9062 ("wlantest: Support variable length PMK")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd TWT attribute to configure TWT related parameters
Gaurav Sharma [Fri, 8 Oct 2021 15:27:32 +0000 (20:57 +0530)] 
Add TWT attribute to configure TWT related parameters

Add QCA_WLAN_TWT_SET_PARAM TWT attribute to configure TWT related
parameters.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoReplace "dummy" with "stub" in crypto/random
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in crypto/random

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in NDIS driver interface
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in NDIS driver interface

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in EAP-TEAP testing
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in EAP-TEAP testing

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in VLAN testing ifname
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in VLAN testing ifname

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in WPS testing
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in WPS testing

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in wlantest injection
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in wlantest injection

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in preauth_test
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in preauth_test

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in comments/documentation
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in comments/documentation

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in wps_testing_dummy_cred
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in wps_testing_dummy_cred

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in Authenticator group keys
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in Authenticator group keys

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "dummy" with "stub" in SAE
Arowa Suliman [Sun, 19 Sep 2021 06:24:29 +0000 (23:24 -0700)] 
Replace "dummy" with "stub" in SAE

Replace the word "dummy" with the inclusive word "stub".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agohostap: Remove unused driver enum values with "master" in them
Arowa Suliman [Sun, 19 Sep 2021 06:24:28 +0000 (23:24 -0700)] 
hostap: Remove unused driver enum values with "master" in them

Get rid of some more used of the word "master".

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoReplace "sanity" with "validity"
Arowa Suliman [Sun, 19 Sep 2021 06:24:27 +0000 (23:24 -0700)] 
Replace "sanity" with "validity"

Replaced the word "sanity" with the inclusive word "validity". The
comment in acs_survey_interference_factor() was referring a function
that does not exist, so remove it instead of trying rename the function.

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoP2P: Enforce SAE-H2E for P2P GO in 6 GHz
Sreeramya Soratkal [Thu, 12 Aug 2021 10:38:48 +0000 (16:08 +0530)] 
P2P: Enforce SAE-H2E for P2P GO in 6 GHz

Allow sae_pwe parameter to be configured per-network and enforce the
SAE hash-to-element mechanism for the P2P GO if it is started on
a 6 GHz channel.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agowpa_cli: Add support for SCS, MSCS, and DSCP commands
Veerendranath Jakkam [Tue, 28 Sep 2021 22:10:30 +0000 (03:40 +0530)] 
wpa_cli: Add support for SCS, MSCS, and DSCP commands

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoHE: Disable HE in hostapd_set_freq_params() if driver does not support
Hu Wang [Thu, 30 Sep 2021 06:37:24 +0000 (12:07 +0530)] 
HE: Disable HE in hostapd_set_freq_params() if driver does not support

Existing logic to disable HE in hostapd_set_freq_params() is to check
he_cap != NULL, but this is not correct as he_cap is defined as a stack
member of hostapd_hw_modes which can't be NULL. Add one more check
!he_cap->he_supported to make sure HE can be disabled if the driver not
support it.

This fixes a case where a driver does not support HE, but hostapd.conf
enables HE/HT40 on the 2.4 GHz band and hostapd failed to start with
error '40 MHz channel width is not supported in 2.4 GHz'.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd QCA vendor attributes to indicate 320 MHz spectral scan capabilities
Shiva Krishna Pittala [Thu, 7 Oct 2021 10:24:48 +0000 (15:54 +0530)] 
Add QCA vendor attributes to indicate 320 MHz spectral scan capabilities

Add a QCA vendor attribute to indicate agile spectral scan support for
320 MHz mode. Add another attribute to indicate the number of detectors
used for spectral scan in 320 MHz mode.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoUpdate ciphers to address GTK renewal failures while roaming
Vinay Gannevaram [Thu, 30 Sep 2021 07:18:26 +0000 (12:48 +0530)] 
Update ciphers to address GTK renewal failures while roaming

After roaming from WPA2-AP (group=CCMP) to WPA-AP (group=TKIP) using
driver-based SME and roaming trigger, GTK renewal failures are observed
for the currently associated WPA-AP because of group cipher mismatch,
resulting in deauthentication with the AP.

Update the group cipher and pairwise cipher values in wpa_sm from
association event received from the driver in case of SME offload to the
driver to address GTK renewal failures (and similar issues) that could
happen when the driver/firmware roams between APs with different
security profiles.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agotests: WPA2/WPA-PSK cfg80211 connect command to trigger roam
Jouni Malinen [Wed, 6 Oct 2021 17:55:58 +0000 (20:55 +0300)] 
tests: WPA2/WPA-PSK cfg80211 connect command to trigger roam

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoVendor command to configure/trigger the roam events
Sunil Dutt [Tue, 28 Sep 2021 08:29:21 +0000 (13:59 +0530)] 
Vendor command to configure/trigger the roam events

Introduce a new vendor command QCA_NL80211_VENDOR_SUBCMD_ROAM_EVENTS
that aims to configure/trigger the roam events from the driver.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd TWT vendor attribute to configure announce timeout value
Gaurav Sharma [Thu, 30 Sep 2021 11:08:01 +0000 (16:38 +0530)] 
Add TWT vendor attribute to configure announce timeout value

Add QCA_WLAN_VENDOR_ATTR_TWT_SETUP_ANNOUNCE_TIMEOUT attribute to
configure announce timeout value for announce TWT session.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoP2P: Make p2p_check_pref_chan_no_recv() easier for static analyzers
Jouni Malinen [Thu, 30 Sep 2021 15:27:37 +0000 (18:27 +0300)] 
P2P: Make p2p_check_pref_chan_no_recv() easier for static analyzers

Add an explicit check for msg->channel_list != NULL instead of depending
on msg->channel_list_len > 0 implying that. This is to silence invalid
static analyzer reports.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoMake get_mode() easier for static analyzers
Jouni Malinen [Thu, 30 Sep 2021 15:23:26 +0000 (18:23 +0300)] 
Make get_mode() easier for static analyzers

Add an explicit check for modes != NULL instead of depending on
num_modes > 0 implying that. This is to silence invalid static analyzer
reports.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agotests: wpa_supplicant AP mode and vendor elements
Jouni Malinen [Thu, 30 Sep 2021 15:20:49 +0000 (18:20 +0300)] 
tests: wpa_supplicant AP mode and vendor elements

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoSupport vendor element configuration for AP mode from wpa_supplicant
Chaoli Zhou [Wed, 28 Jul 2021 10:51:08 +0000 (18:51 +0800)] 
Support vendor element configuration for AP mode from wpa_supplicant

Support adding/deleting vendor elements dynamically for AP mode while it
is started by wpa_supplicant instead of hostapd which already supported
this. This adds ap_assocresp_elements global parameter and UPDATE_BEACON
control interface command to take the changed values into effect.

Usage in wpa_cli:
Add vendor IE for (Re)Association Response frames
> set ap_assocresp_elements=xxxx
Add vendor IE for Beacon/Probe Response frames
> set ap_vendor_elements=xxxx

Delete vendor IE from (Re)Association Response frames
> set ap_assocresp_elements
Delete vendor IE from Beacon/Probe Response frames
> set ap_vendor_elements

To make vendor IE changes take effect
> update_beacon

Signed-off-by: Chaoli Zhou <zchaoli@codeaurora.org>
3 years agotests: Extend DSCP testing coverage
Jouni Malinen [Thu, 30 Sep 2021 13:55:01 +0000 (16:55 +0300)] 
tests: Extend DSCP testing coverage

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agotests: DSCP policy
Shivani Baranwal [Sun, 12 Sep 2021 12:39:05 +0000 (18:09 +0530)] 
tests: DSCP policy

Signed-off-by: Shivani Baranwal <shivbara@codeaurora.org>
3 years agoDSCP: Add support to send DSCP Policy Query frame
Veerendranath Jakkam [Mon, 6 Sep 2021 09:26:51 +0000 (14:56 +0530)] 
DSCP: Add support to send DSCP Policy Query frame

Add support to send DSCP Policy Query frame using a new control
interface command DSCP_QUERY. This includes support for a wildcard DSCP
query and a DSCP query with a single Domain Name attribute.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoDSCP: Parse WFA Capabilities element in (Re)Association Response frame
Veerendranath Jakkam [Thu, 29 Jul 2021 14:32:22 +0000 (20:02 +0530)] 
DSCP: Parse WFA Capabilities element in (Re)Association Response frame

Add support to parse WFA Capabilities element from the (Re)Association
Response frame. Also register a timeout for the station to wait before
sending a new DSCP query if requested by AP.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoDSCP: Indicate DSCP Policy support in (Re)Association Request frame
Veerendranath Jakkam [Tue, 31 Aug 2021 04:07:09 +0000 (09:37 +0530)] 
DSCP: Indicate DSCP Policy support in (Re)Association Request frame

Indicate DSCP Policy capability by including a WFA Capabilities element
containing the relevant bit set to 1 in the (Re)Association Request
frames when enabled by user.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoDSCP: Allow DSCP Policy Response Action frame to be sent
Veerendranath Jakkam [Tue, 31 Aug 2021 03:45:24 +0000 (09:15 +0530)] 
DSCP: Allow DSCP Policy Response Action frame to be sent

Add support to prepare and send DSCP response action frame to the
connected AP in response to a new control interface command DSCP_RESP.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoDSCP: Parsing and processing of DSCP Policy Request frames
Veerendranath Jakkam [Wed, 10 Mar 2021 03:41:58 +0000 (19:41 -0800)] 
DSCP: Parsing and processing of DSCP Policy Request frames

Add support to parse received DSCP Policy Request frames and send the
request details as control interface events.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoDSCP: DSCP policy capability configuration
Veerendranath Jakkam [Tue, 31 Aug 2021 04:07:09 +0000 (09:37 +0530)] 
DSCP: DSCP policy capability configuration

The DSCP policy capability is disabled by default. The user frameworks
which have support for handling DSCP policy request messages need to
enable this capability explicitly to allow wpa_supplicant to advertise
the capability to the AP and allow the related frames to be processed.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
3 years agoMove pmf_in_use() into a more generic file
Jouni Malinen [Fri, 24 Sep 2021 18:02:19 +0000 (21:02 +0300)] 
Move pmf_in_use() into a more generic file

This function is not specific to GAS, so make it available throughout
wpa_supplicant without requiring CONFIG_GAS.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoHE: Use a random BSS Color if not defined in the config file
Hu Wang [Wed, 22 Sep 2021 03:24:38 +0000 (08:54 +0530)] 
HE: Use a random BSS Color if not defined in the config file

Commit 0cb39f4fd5 ("HE: Extend BSS color support") sets the BSS Color
default value to 1 as "Interoperability testing showed that stations
will require a BSS color to be set even if the feature is disabled."

A new interop issue was observed with hardcoded BSS color value of 1:
- REF device using one interface (e.g., wlan0) to connect to an HE
  AP, whose BSS color is enabled and value is 1.
- REF device using another interface (e.g., p2p0) to connect to a
  P2P GO using BSS color default settings.
  (i.e., BSS color disabled and value is 1).
- REF device checks both AP's and P2P GO's BSS Color values even though
  GO's BSS color is disabled. This causes collision of the BSS
  color somehow causing RX problems.

For DUT as a P2P GO, its firmware uses default BSS color value 1 from
wpa_supplicant, then triggers a timer (e.g., 120 s) to update its BSS
color values based on its neighboring BSSes. To reduce the likelihood of
BSS color collision with REF device before that, use a random BSS Color
if not defined in the config file.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoQCA vendor command to configure the parameters for monitor mode
Sunil Dutt [Tue, 14 Sep 2021 15:50:57 +0000 (21:20 +0530)] 
QCA vendor command to configure the parameters for monitor mode

This new vendor command aims to indicate the driver to enable the
monitor mode for an interface on which this command is issued. Once
enabled, the frames (both TX and RX) on this interface are sent to an
active coexisting monitor interface.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd attributes to support MBSSID multi groups notifications
Vikram Kandukuri [Thu, 2 Sep 2021 18:25:38 +0000 (23:55 +0530)] 
Add attributes to support MBSSID multi groups notifications

Add new attributes for supporting MBSSID multi groups notifications
to qca_wlan_vendor_attr_mbssid_tx_vdev_status
(QCA_NL80211_VENDOR_SUBCMD_MBSSID_TX_VDEV_STATUS).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoExtend the roam reason codes in QCA vendor attribute
Aleti Nageshwar Reddy [Sun, 5 Sep 2021 07:23:45 +0000 (12:53 +0530)] 
Extend the roam reason codes in QCA vendor attribute

Add new reason codes to the existing enum qca_roam_reason.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoCorrect the documentation in enum qca_roam_reason
Aleti Nageshwar Reddy [Mon, 6 Sep 2021 06:06:09 +0000 (11:36 +0530)] 
Correct the documentation in enum qca_roam_reason

QCA_ROAM_REASON_USER_TRIGGER was wrongly documented as
QCA_ROAM_REASON_EXPLICIT_REQUEST, so correct it.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoP2P: DFS offload for the autonomous GO
Hu Wang [Tue, 6 Jul 2021 07:30:25 +0000 (15:30 +0800)] 
P2P: DFS offload for the autonomous GO

Enhance the P2P_GROUP_ADD command to support DFS channel with 80 and 160
MHz bandwidth to be used for autonomous GO when using offloaded DFS.

For example, 'P2P_GROUP_ADD freq=5500 max_oper_chwidth=80 ht40 vht'

- Previous behavior: AP fallback to channel 100 using 20 MHz with
  "No VHT higher bandwidth support for the selected channel 100"
- Enhanced behavior: AP starts on channel 100 using 80 MHz with
  "VHT center channel 106 for 80 or 80+80 MHz bandwidth"

This functionality is on top of the driver's capability to offload DFS,
which is advertized through WPA_DRIVER_FLAGS_DFS_OFFLOAD.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoReserve QCA vendor sub command id 201
Vamsi Krishna [Thu, 2 Sep 2021 14:43:05 +0000 (20:13 +0530)] 
Reserve QCA vendor sub command id 201

This is reserved for QCA use.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd QCA vendor interface to configure background scan parameters
Aleti Nageshwar Reddy [Fri, 27 Aug 2021 10:25:13 +0000 (15:55 +0530)] 
Add QCA vendor interface to configure background scan parameters

Add QCA vendor interface support for configuring background scan related
parameters to the driver/firmware.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoEDMG: Validate pri channel lookup result before using it
Ben Wang [Wed, 19 Aug 2020 12:21:03 +0000 (20:21 +0800)] 
EDMG: Validate pri channel lookup result before using it

At least in theory, hw_get_channel_freq() could return NULL, so add
error handling for that.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd frequency to operating class determination for 5 GHz channel 144
Hu Wang [Wed, 25 Aug 2021 09:25:33 +0000 (17:25 +0800)] 
Add frequency to operating class determination for 5 GHz channel 144

Commit 45c3e729527a ("Add frequency to operating class determination
for 5 GHz 100..140") extends ieee80211_freq_to_channel_ext() with
knowledge of the operating classes for the 5 GHz channels 100..140.

Per "Table E-4 - Global operating classes" in IEEE Std 802.11-2020, 5
GHz channel 144 also maps to same operating classes, so update hostapd
code to reflect the change.

This issue is found when OCV enabled and 4-way-handshake failed due
to client OCI includes op_class 0 for channel 144. This showed
up in following manner in the debug log:

WPA: OCI KDE in EAPOL-Key - hexdump(len=9): dd 07 00 0f ac 0d 00 90 00
Error interpreting OCI: unrecognized opclass/channel pair (0/144)

Signed-off-by: Hu Wang <huw@codeaurora.org>
3 years agoP2P: Enable multiple channel widths for P2P in 6 GHz band
Sreeramya Soratkal [Thu, 22 Jul 2021 12:41:00 +0000 (18:11 +0530)] 
P2P: Enable multiple channel widths for P2P in 6 GHz band

Enable support for P2P connection in 6 GHz with the channel width of 40
MHz, 80 MHz, and 160 MHz. The flag max_oper_chwidth is used to configure
the maximum channel width for P2P connection in 6 GHz with the commands
P2P_CONNECT, P2P_INVITE, and P2P_GROUP_ADD.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agoP2P: Enhance determination of secondary offset to support 6 GHz channels
Sreeramya Soratkal [Thu, 22 Jul 2021 12:37:47 +0000 (18:07 +0530)] 
P2P: Enhance determination of secondary offset to support 6 GHz channels

Current definition of wpas_p2p_get_ht40_mode() determines secondary
offset in the 5 GHz band. Enhance the functionality of this function to
determine offset to support 6 GHz channels also.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agoP2P: Clone 6 GHz related parameters to new group interface config
Sreeramya Soratkal [Mon, 23 Aug 2021 06:01:19 +0000 (11:31 +0530)] 
P2P: Clone 6 GHz related parameters to new group interface config

Clone pmf and p2p_6ghz_disable configuration values when creating a new
P2P group interface. PMF is required in 6 GHz band operation.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agoAdd TWT attribute to send Responder PM Mode value to userspace
Nirav Shah [Wed, 18 Aug 2021 08:30:01 +0000 (14:00 +0530)] 
Add TWT attribute to send Responder PM Mode value to userspace

Add QCA_WLAN_VENDOR_ATTR_TWT_SETUP_RESPONDER_PM_MODE
TWT attribute to send Responder PM Mode value to userspace.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd time slice duty cycle attribute into QCA vendor command
Yu Ouyang [Fri, 27 Aug 2021 06:07:52 +0000 (14:07 +0800)] 
Add time slice duty cycle attribute into QCA vendor command

Add a new attribute into qca_wlan_vendor_attr_ll_stats_results to
support getting interface time slicing duty cycle info.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoUpdate QCA mDNS Offload vendor command
Aditya Kodukula [Fri, 20 Aug 2021 00:03:09 +0000 (17:03 -0700)] 
Update QCA mDNS Offload vendor command

Update kernel documentation of mDNS offload vendor command.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoACS: Fix channel 100 frequency
David Bauer [Wed, 26 May 2021 21:05:03 +0000 (23:05 +0200)] 
ACS: Fix channel 100 frequency

Channel 100 is a valid channel to choose for 80 MHz operation. However,
it was converted to 5500 MHz, not 5550 MHz, for the 80 MHz case while
the conversion to other bandwidths was done correctly. In fact, there is
no channel assigned to this frequency 5550 MHz.

Fix this obvious typo to allow ACS to select channel 100 for 80 MHz
operation again.

Fixes: bef5eee4f7b2 ("Convert channel to frequency based selection for AP mode ACS")
Signed-off-by: David Bauer <mail@david-bauer.net>
3 years agoP2P: Align p2p_buf_add_pref_channel_list() prototype with definition
Cedric Izoard [Tue, 4 May 2021 08:51:57 +0000 (10:51 +0200)] 
P2P: Align p2p_buf_add_pref_channel_list() prototype with definition

Align the p2p_buf_add_pref_channel_list() prototype and definition in
p2p_build.c and p2p_i.h. Use unsigned int over u32 as it is actully
called with an unsigned int parameter.

This removes compilation warning on platform where u32 != unsigned int.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agohostapd: Allow HT40 on 5 GHz channels 173 and 177
Cedric Izoard [Fri, 23 Apr 2021 15:31:18 +0000 (17:31 +0200)] 
hostapd: Allow HT40 on 5 GHz channels 173 and 177

IEEE Std 802.11ax-2021 added channel 177 into global operating class 125
and consequently channel 173 in global operating class 126 (HT40+) and
channel 177 in global operating class 127 (HT40-).

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agohostapd: Always allow HE AP with a 20 MHz channel width
Cedric Izoard [Fri, 30 Apr 2021 06:48:26 +0000 (08:48 +0200)] 
hostapd: Always allow HE AP with a 20 MHz channel width

Skip the test of HE PHY capability bit "Support for a 40 MHz and 80 MHz
channel width" when starting an AP with a 20 MHz channel on the 5 GHz
band.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoP2P: Consider p2p_no_go_freq for GO preferred frequency
Sreeramya Soratkal [Tue, 3 Aug 2021 05:28:44 +0000 (10:58 +0530)] 
P2P: Consider p2p_no_go_freq for GO preferred frequency

Currently while selecting a preferred frequency when no preference is
known, p2p_no_go_freq is not considered for 5 GHz and 60 GHz channels.
This results in starting GO on the channels that are configured not to
allow the local device as GO.

Use wpas_p2p_supported_freq_go api to check if the p2p_no_go_freq
configuration before selecting the preferred frequency for GO.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agoP2P: Avoid integer overflow in channel
Sreeramya Soratkal [Fri, 9 Jul 2021 10:50:12 +0000 (16:20 +0530)] 
P2P: Avoid integer overflow in channel

For some 6 GHz operating class like 134, there is a possibility where
the ch variable used for channel iterator overflows when it is
incremented. Fix this by updating the datatype of ch variable to
avoid integer overflow while incrementing.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agoAdd QCA vendor interface to configure allowed bands for roaming
Vinita S. Maloo [Mon, 9 Aug 2021 09:41:55 +0000 (15:11 +0530)] 
Add QCA vendor interface to configure allowed bands for roaming

Add a QCA vendor attribute to configure the driver/firmware the allowed
bands for roaming by userpace. This attribute is also used to get the
configured roam bands from the driver.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agodoc: Fix grammar in wpa_supplicant overview
Mathew Hodson [Tue, 25 May 2021 03:13:33 +0000 (23:13 -0400)] 
doc: Fix grammar in wpa_supplicant overview

Signed-off-by: Mathew Hodson <mathew.hodson@gmail.com>
3 years agotests: test_fst_config: Convert FstLauncher to context manager
Johannes Berg [Tue, 11 May 2021 19:35:47 +0000 (21:35 +0200)] 
tests: test_fst_config: Convert FstLauncher to context manager

Using __del__ for any kind of cleanup is not a good idea
as it's not guaranteed to be called at any particular time,
it's only called whenever the next garbage collect cycle
kicks in.

Use a context manager instead, which basically removes the
need for the try/finally and fixes the reliance on __del__.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agotests: fst_test_common: Remove dead code from HapdRegCtrl
Johannes Berg [Tue, 11 May 2021 19:35:40 +0000 (21:35 +0200)] 
tests: fst_test_common: Remove dead code from HapdRegCtrl

Since refcnt is never incremented, this is dead code, just remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agoutils: FreeBSD supports fdatasync(2)
Cy Schubert [Tue, 8 Jun 2021 03:33:20 +0000 (20:33 -0700)] 
utils: FreeBSD supports fdatasync(2)

FreeBSD supports fdatasync(2). Enable it in os_unix.c.

Signed-off-by: Cy Schubert <cy@FreeBSD.org>
3 years agonl80211: Fix send_mlme to use monitor interface only for AP interface
Ajay Singh [Tue, 13 Jul 2021 19:05:23 +0000 (19:05 +0000)] 
nl80211: Fix send_mlme to use monitor interface only for AP interface

Use monitor interface to send_mlme only when the interface is configured
in AP mode. In multiple interface setup, one interface can be configured
in AP mode using monitor interface and another interface in station
mode. The station interface may also require sending the management
frames without using monitor interface, e.g., support external SAE
authentication to send Authentication frames without monitor interface.
This change allows sending management frames to the driver for a station
interface where the AP interface uses monitor interface.

Additionally, the monitor interface is only valid for AP mode
(nl80211_create_monitor_interface() is called in nl80211_setup_ap) so
interface type check ensures to use monitor interface only when required
by the specific interface.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Peter Reen <peter.reen@microchip.com>
3 years agoHE: Option to disable HE ER SU in HE operation in AP mode
Shay Bar [Wed, 21 Jul 2021 05:46:26 +0000 (08:46 +0300)] 
HE: Option to disable HE ER SU in HE operation in AP mode

Add option to disable 242-tone HE ER SU PPDU reception by the AP
in HE operation IE.

Signed-off-by: Shay Bar <shay.bar@celeno.com>
3 years agoGeneralize the function name as it is not dealing with only TX & RX params
Gokul Sivakumar [Wed, 4 Aug 2021 18:42:11 +0000 (00:12 +0530)] 
Generalize the function name as it is not dealing with only TX & RX params

For the function hostapd_get_sta_tx_rx(), the name
hostapd_get_sta_info() is more appropriate as it is also responsible for
getting many other STA specific params like RSSI, inactive milliseconds
along with TX and RX bytes.

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agotests: connected_time for mesh peer
Jouni Malinen [Wed, 25 Aug 2021 09:26:30 +0000 (12:26 +0300)] 
tests: connected_time for mesh peer

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agomesh: Show peer connected time in the wpa_cli STA cmd output for Mesh mode
Gokul Sivakumar [Wed, 4 Aug 2021 18:42:10 +0000 (00:12 +0530)] 
mesh: Show peer connected time in the wpa_cli STA cmd output for Mesh mode

When a Mesh interface is managed by wpa_supplicant, include the peer
link connected time (secs) in the output of "sta <addr>", "all_sta"
wpa_cli cmds for each peer. This will be helpful to find when the peer
link connection got established. The NL80211_STA_INFO_CONNECTED_TIME
netlink attribute data is used for this purpose if available.

$ wpa_cli -i mesh0 all_sta
02:00:00:00:02:00
flags=[ASSOC][WMM][HT]
aid=1
capability=0x0
listen_interval=0
supported_rates=82 84 8b 96 8c 12 98 24 b0 48 60 6c
timeout_next=NULLFUNC POLL
rx_packets=77
tx_packets=3
rx_bytes=8510
tx_bytes=284
inactive_msec=104
signal=-30
rx_rate_info=65 mcs 0
tx_rate_info=65 mcs 0
ht_mcs_bitmask=ffff0000000000000000
connected_time=24
ht_caps_info=0x103c

The connected_time field in the output of "hostapd_cli -i ap0 all_sta"
cmd is not affected and it will continue to show the connected time
maintained by hostapd for each STA.

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agoFix some compiler warnings on 32 bit platform
Masashi Honma [Fri, 20 Aug 2021 09:39:04 +0000 (18:39 +0900)] 
Fix some compiler warnings on 32 bit platform

../src/ap/ieee802_11.c: In function ‘pasn_wd_handle_sae_commit’:
../src/ap/ieee802_11.c:2401:60: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
   wpa_printf(MSG_DEBUG, "PASN: SAE buffer too short. len=%lu",
                                                          ~~^
                                                          %u
       buf_len);
       ~~~~~~~
../src/ap/ieee802_11.c: In function ‘pasn_wd_handle_sae_confirm’:
../src/ap/ieee802_11.c:2477:60: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
   wpa_printf(MSG_DEBUG, "PASN: SAE buffer too short. len=%lu",
                                                          ~~^
                                                          %u
       buf_len);
       ~~~~~~~
../src/ap/ieee802_11.c: In function ‘pasn_wd_handle_fils’:
../src/ap/ieee802_11.c:2707:62: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
   wpa_printf(MSG_DEBUG, "PASN: FILS: Buffer too short. len=%lu",
                                                            ~~^
                                                            %u
       buf_len);
       ~~~~~~~

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
3 years agonl80211: Reduce the number of nlctrl name resolution calls
Masashi Honma [Fri, 20 Aug 2021 09:26:33 +0000 (18:26 +0900)] 
nl80211: Reduce the number of nlctrl name resolution calls

The number of nlctrl name resolution calls required to connect to a
WPA2-PSK AP is 12. And each nlctrl name resolution call spends 55 micro
seconds on a lower spec CPU like Intel Atom N270. Reduce the number of
nctrl name resolution calls from 12 to 1 by caching the results of nctrl
name resolution calls on int size memory to speed up the connection
process a little bit.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
3 years agotests: wpa_supplicant config blobs and PEM encoding
Jouni Malinen [Thu, 19 Aug 2021 14:41:13 +0000 (17:41 +0300)] 
tests: wpa_supplicant config blobs and PEM encoding

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoopenssl: Support private_key blob in PEM encoded PKCS#8 format
Wolfgang Steinwender [Wed, 7 Apr 2021 14:43:21 +0000 (16:43 +0200)] 
openssl: Support private_key blob in PEM encoded PKCS#8 format

Try to parse the private_key blob as private key in PEM format encoded
PKCS#8. PEM format is already supported for private_key file and is now
also supported for private_key blob.

Signed-off-by: Wolfgang Steinwender <wsteinwender@pcs.com>
3 years agoGenerate an event when a network is added or removed
Andrew Beltrano [Wed, 14 Apr 2021 23:25:05 +0000 (23:25 +0000)] 
Generate an event when a network is added or removed

Generate an event on the control socket interface when a network is
added or removed. The event name CTRL-EVENT-NETWORK-<ADDED|REMOVED>
is followed by the network entry identifier. The event matches the
corresponding Network<Added|Removed> signal on the d-bus interface.

Signed-off-by: Andrew Beltrano <anbeltra@microsoft.com>
3 years agoAdd a --conf option to eapol_test.py
Nick Porter [Fri, 26 Mar 2021 10:17:00 +0000 (10:17 +0000)] 
Add a --conf option to eapol_test.py

The --conf option specifies a file containing a list of options
to configure the network used for running the test which will be
used in place of the defaults built into the script.

Signed-off-by: Nick Porter <nick@portercomputing.co.uk>
3 years agoPASN: Fix ASAN error in ptksa_cache_add()
Michael Braun [Fri, 16 Apr 2021 06:13:12 +0000 (08:13 +0200)] 
PASN: Fix ASAN error in ptksa_cache_add()

==19798==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110000663f8 at pc 0x55a2c485a232 bp 0x7ffeb42dcaf0 sp 0x7ffeb42dcae0
READ of size 8 at 0x6110000663f8 thread T0
Connect STA wlan0 to AP
    #0 0x55a2c485a231 in ptksa_cache_add ../src/common/ptksa_cache.c:310
    #1 0x55a2c4398045 in hostapd_store_ptksa ../src/ap/wpa_auth_glue.c:943
    #2 0x55a2c4430980 in wpa_auth_store_ptksa ../src/ap/wpa_auth.c:232
    #3 0x55a2c44578e1 in sm_WPA_PTK_PTKINITDONE_Enter ../src/ap/wpa_auth.c:3650
    #4 0x55a2c44578e1 in sm_WPA_PTK_Step ../src/ap/wpa_auth.c:3798
    #5 0x55a2c44578e1 in wpa_sm_step ../src/ap/wpa_auth.c:4437
    #6 0x55a2c445d99d in wpa_receive ../src/ap/wpa_auth.c:1411
    #7 0x55a2c43e7747 in ieee802_1x_receive ../src/ap/ieee802_1x.c:1118
    #8 0x55a2c43bbf73 in hostapd_event_eapol_rx ../src/ap/drv_callbacks.c:1542
    #9 0x55a2c43bbf73 in wpa_supplicant_event ../src/ap/drv_callbacks.c:1932
    #10 0x55a2c466cb2d in drv_event_eapol_rx ../src/drivers/driver.h:6074
    #11 0x55a2c466cb2d in nl80211_control_port_frame ../src/drivers/driver_nl80211_event.c:2822
    #12 0x55a2c466cb2d in process_bss_event ../src/drivers/driver_nl80211_event.c:3194
    #13 0x7feed9e90b9b in nl_cb_call ./include/netlink-private/netlink.h:145
    #14 0x7feed9e90b9b in recvmsgs ./lib/nl.c:1006
    #15 0x7feed9e90b9b in nl_recvmsgs_report ./lib/nl.c:1057
    #16 0x7feed9e91058 in nl_recvmsgs ./lib/nl.c:1081
    #17 0x55a2c45f2e8c in wpa_driver_nl80211_event_receive ../src/drivers/driver_nl80211.c:1782
    #18 0x55a2c44b9afa in eloop_sock_table_dispatch ../src/utils/eloop.c:603
    #19 0x55a2c44be122 in eloop_run ../src/utils/eloop.c:1228
    #20 0x55a2c43360bf in hostapd_global_run /home/mbr/hostapd/hostapd/main.c:451
    #21 0x55a2c43360bf in main /home/mbr/hostapd/hostapd/main.c:898
    #22 0x7feed8ce20b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #23 0x55a2c432f3fd in _start (/home/mbr/hostapd/hostapd/hostapd+0x9f23fd)

0x6110000663f8 is located 184 bytes inside of 216-byte region [0x611000066340,0x611000066418)
freed by thread T0 here:
    #0 0x7feeda1477cf in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
    #1 0x55a2c44ce56b in os_free ../src/utils/os_unix.c:773
    #2 0x55a2c451a986 in radius_msg_free ../src/radius/radius.c:137
    #3 0x55a2c4527104 in radius_client_msg_free ../src/radius/radius_client.c:261
    #4 0x55a2c452f53c in radius_client_list_add ../src/radius/radius_client.c:715
    #5 0x55a2c452f53c in radius_client_send ../src/radius/radius_client.c:807
    #6 0x55a2c453b24c in accounting_sta_report ../src/ap/accounting.c:352
    #7 0x55a2c453d6e9 in accounting_sta_stop ../src/ap/accounting.c:384
    #8 0x55a2c44190fd in ap_free_sta ../src/ap/sta_info.c:194
    #9 0x55a2c4934530 in handle_deauth ../src/ap/ieee802_11.c:6035
    #10 0x55a2c4934530 in ieee802_11_mgmt ../src/ap/ieee802_11.c:6399
    #11 0x55a2c43bf114 in hostapd_mgmt_rx ../src/ap/drv_callbacks.c:1468
    #12 0x55a2c43bf114 in wpa_supplicant_event ../src/ap/drv_callbacks.c:1912
    #13 0x55a2c465faf7 in mlme_event_mgmt ../src/drivers/driver_nl80211_event.c:823
    #14 0x55a2c4661774 in mlme_event ../src/drivers/driver_nl80211_event.c:1135
    #15 0x55a2c466c43b in process_bss_event ../src/drivers/driver_nl80211_event.c:3177
    #16 0x7feed9e90b9b in nl_cb_call ./include/netlink-private/netlink.h:145
    #17 0x7feed9e90b9b in recvmsgs ./lib/nl.c:1006
    #18 0x7feed9e90b9b in nl_recvmsgs_report ./lib/nl.c:1057

previously allocated by thread T0 here:
    #0 0x7feeda147bc8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x55a2c44cd387 in os_malloc ../src/utils/os_unix.c:715
    #2 0x55a2c44ceb7f in os_zalloc ../src/utils/os_unix.c:779
    #3 0x55a2c451a9f2 in radius_msg_new ../src/radius/radius.c:109
    #4 0x55a2c4539a6e in accounting_msg ../src/ap/accounting.c:46
    #5 0x55a2c453be15 in accounting_report_state ../src/ap/accounting.c:439
    #6 0x55a2c453d91d in accounting_init ../src/ap/accounting.c:534
    #7 0x55a2c4378952 in hostapd_setup_bss ../src/ap/hostapd.c:1333
    #8 0x55a2c4382530 in hostapd_setup_interface_complete_sync ../src/ap/hostapd.c:2094
    #9 0x55a2c4382815 in hostapd_setup_interface_complete ../src/ap/hostapd.c:2229
    #10 0x55a2c4384100 in setup_interface2 ../src/ap/hostapd.c:1726
    #11 0x55a2c4386b58 in setup_interface ../src/ap/hostapd.c:1628
    #12 0x55a2c4386b58 in hostapd_setup_interface ../src/ap/hostapd.c:2318
    #13 0x55a2c4387a57 in hostapd_enable_iface ../src/ap/hostapd.c:2730
    #14 0x55a2c455d723 in hostapd_ctrl_iface_enable /home/mbr/hostapd/hostapd/ctrl_iface.c:1606
    #15 0x55a2c455d723 in hostapd_ctrl_iface_receive_process /home/mbr/hostapd/hostapd/ctrl_iface.c:3607
    #16 0x55a2c456821e in hostapd_ctrl_iface_receive /home/mbr/hostapd/hostapd/ctrl_iface.c:4018
    #17 0x55a2c44b9afa in eloop_sock_table_dispatch ../src/utils/eloop.c:603
    #18 0x55a2c44be122 in eloop_run ../src/utils/eloop.c:1228
    #19 0x55a2c43360bf in hostapd_global_run /home/mbr/hostapd/hostapd/main.c:451
    #20 0x55a2c43360bf in main /home/mbr/hostapd/hostapd/main.c:898
    #21 0x7feed8ce20b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: heap-use-after-free ../src/common/ptksa_cache.c:310 in ptksa_cache_add
Shadow bytes around the buggy address:
  0x0c2280004c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2280004c30: 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2280004c40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c2280004c50: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa
  0x0c2280004c60: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x0c2280004c70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]
  0x0c2280004c80: fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2280004c90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2280004ca0: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa
  0x0c2280004cb0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c2280004cc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==19798==ABORTING

Fixes: a4e36916168a ("WPA: Add PTKSA cache implementation")
Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
3 years agotests: Update RSA 3k certificates
Jouni Malinen [Thu, 19 Aug 2021 10:57:53 +0000 (13:57 +0300)] 
tests: Update RSA 3k certificates

The previous ones expired and caused test failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoopenssl: Disable padding after initializing the cipher suite
Davide Caratti [Tue, 17 Aug 2021 08:58:53 +0000 (10:58 +0200)] 
openssl: Disable padding after initializing the cipher suite

according to OpenSSL documentation [1], EVP_CIPHER_CTX_set_padding()
should be called after EVP_EncryptInit_ex(), EVP_DecryptInit_ex(), or
EVP_CipherInit_ex(). Not doing this causes EVP_CIPHER_CTX_set_padding()
to return false on OpenSSL-3.0.0, resulting in the impossibility to
connect in many scenarios. Fix this changing the order of function calls
where needed.

[1] https://www.openssl.org/docs/man1.1.1/man3/EVP_CIPHER_CTX_set_padding.html

Reported-by: Vladimir Benes <vbenes@redhat.com>
Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
3 years agoopenssl: Remove deprecated functions from des_encrypt()
Davide Caratti [Tue, 17 Aug 2021 08:58:54 +0000 (10:58 +0200)] 
openssl: Remove deprecated functions from des_encrypt()

NetworkManager-CI detected systematic failures on test scenarios using
MSCHAPv2 when wpa_supplicant uses OpenSSL-3.0.0.
The 'test_module_tests.py' script also fails, and the following log is
shown:

 1627404013.761569: generate_nt_response failed
 1627404013.761582: ms_funcs: 1 error

It seems that either DES_set_key() or DES_ecb_encrypt() changed their
semantic, but it doesn't make sense to fix them since their use has been
deprecated. Converting des_encrypt() to avoid use of deprecated
functions proved to fix the problem, and removed a couple of build
warnings at the same time.

Reported-by: Vladimir Benes <vbenes@redhat.com>
Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
3 years agowpa_supplicant: src: Replace Sane with Valid.
Arowa Suliman [Fri, 16 Jul 2021 05:32:05 +0000 (22:32 -0700)] 
wpa_supplicant: src: Replace Sane with Valid.

Replace the word Sane with Valid which is inclusive.

Signed-off-by: Arowa Suliman <arowa@chromium.org>
3 years agoRADIUS client: Fix void-pointer-to-enum-cast warning
Joshua Emele [Thu, 22 Apr 2021 22:59:40 +0000 (22:59 +0000)] 
RADIUS client: Fix void-pointer-to-enum-cast warning

Found using x86_64-cros-linux-gnu-clang (Chromium OS
12.0_pre416183_p20210305-r3 clang version 12.0.0):

radius_client.c:818:24: warning: cast to smaller integer ...
        RadiusType msg_type = (RadiusType) sock_ctx;

Signed-off-by: Joshua Emele <jemele@chromium.org>
3 years agotests: SCS
Jouni Malinen [Fri, 30 Jul 2021 14:14:46 +0000 (17:14 +0300)] 
tests: SCS

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAllow MSCS support to be disabled for testing purposes
Vinita S. Maloo [Mon, 12 Apr 2021 11:26:24 +0000 (16:56 +0530)] 
Allow MSCS support to be disabled for testing purposes

"SET disable_mscs_support 1" can be used to disable indication of MSCS
support in the Extended Capabilities element for testing purposes. This
is also disabling addition of the MSCS element even if valid
configuration parameters had been configured.

Signed-off-by: Vinita S. Maloo <vmaloo@codeaurora.org>
3 years agoSCS: Processing of SCS Response frames
Vinita S. Maloo [Tue, 19 Jan 2021 14:12:38 +0000 (19:42 +0530)] 
SCS: Processing of SCS Response frames

Add support to receive and process SCS Response frames from the AP and
indicate the status to upper layers.

Signed-off-by: Vinita S. Maloo <vmaloo@codeaurora.org>
3 years agoAllow SCS supported to be disabled for testing purposes
Vinita S. Maloo [Mon, 1 Feb 2021 11:51:02 +0000 (17:21 +0530)] 
Allow SCS supported to be disabled for testing purposes

"SET disable_scs_support 1" can be used to disable indication of SCS
support in the Extended Capabilities element for testing purposes.

Signed-off-by: Vinita S. Maloo <vmaloo@codeaurora.org>
3 years agoSCS: Sending of SCS Request frames
Vinita S. Maloo [Tue, 19 Jan 2021 13:47:01 +0000 (19:17 +0530)] 
SCS: Sending of SCS Request frames

Add support to parse SCS control interface command and form the SCS
Request frame to be sent to SCS enabled AP.

Signed-off-by: Vinita S. Maloo <vmaloo@codeaurora.org>
3 years agoP2P: Do not stop Listen state if it is moving to correct channel
Hu Wang [Wed, 11 Aug 2021 07:56:36 +0000 (15:56 +0800)] 
P2P: Do not stop Listen state if it is moving to correct channel

Commit 0b8889d8e5de ("P2P: Do not stop Listen state if it is on
correct channel") added a optimization to use Listen state's
remain-on-channel to send out GO Negotiation response frame quickly.

But in Listen state, if GO Negotiation request frame is received before
the remain-on-channel started event from the driver, the above
optimization is not triggered. This showed up in following manner in the
debug log:

p2p0: Starting radio work 'p2p-listen'@0xb4000070ae22d420 after 0.000114 second wait
nl80211: Remain-on-channel cookie 0x100 for freq=2412 MHz duration=204
P2P: Received GO Negotiation Request from 6e:fa:a7:86:e5:e5(freq=2412)
P2P: GO Negotiation with 6e:fa:a7:86:e5:e5
P2P: Stopping find
P2P: Clear timeout (state=WAIT_PEER_CONNECT)
P2P: State WAIT_PEER_CONNECT -> IDLE
nl80211: Cancel remain-on-channel with cookie 0x100
p2p0: Radio work 'p2p-listen'@0xb4000070ae22d420 done in 0.074348 seconds
p2p0: radio_work_free('p2p-listen'@0xb4000070ae22d420): num_active_works --> 0
P2P: State IDLE -> GO_NEG
P2P: Sending GO Negotiation Response
Off-channel: Send action frame: freq=2412 dst=6e:fa:a7:86:e5:e5 src=da:3c:83:7d:70:2b bssid=da:3c:83:7d:70:2b len=196
nl80211: Remain-on-channel event (cancel=0 freq=2412 channel_type=0 duration=400 cookie=0x100 (match))
nl80211: Remain-on-channel event (cancel=1 freq=2412 channel_type=0 duration=0 cookie=0x100 (match))
P2P: GO Negotiation Response (failure) TX callback: success=0

Fix this by adding p2p->pending_listen_freq == freq condition for the
optimization so that the case where the remain-on-channel command has
already been issued to the driver, but the start event has not yet been
received, is covered as well.

Fixes: 0b8889d8e5de ("P2P: Do not stop Listen state if it is on correct channel")
Signed-off-by: Hu Wang <huw@codeaurora.org>
3 years agoAdd QCA vendor attribute for TWT termination due to power save exit
Aleti Nageshwar Reddy [Wed, 4 Aug 2021 11:07:21 +0000 (16:37 +0530)] 
Add QCA vendor attribute for TWT termination due to power save exit

Add QCA new status vendor attribute
QCA_WLAN_VENDOR_TWT_STATUS_POWER_SAVE_EXIT_TERMINATE
to indicate the TWT session termination due to power save
exit request from userspace.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd QCA vendor attribute indicating the spectral scan bandwidth
Shiva Krishna Pittala [Wed, 11 Aug 2021 11:19:30 +0000 (16:49 +0530)] 
Add QCA vendor attribute indicating the spectral scan bandwidth

Add the following vendor attribute to indicate the bandwidth to be used
for spectral scan operation:
- QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_BANDWIDTH

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>