]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
12 months agoRSNO: Include all RSNE/RSNXE variants in EAPOL-Key message 3/4
Jouni Malinen [Mon, 29 Jul 2024 14:20:22 +0000 (17:20 +0300)] 
RSNO: Include all RSNE/RSNXE variants in EAPOL-Key message 3/4

This allows all variants to be verified based on a protected frame to
achieve robust downgrade protection.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNO: Use SNonce cookie to indicate support for RSN overriding
Jouni Malinen [Mon, 29 Jul 2024 13:43:50 +0000 (16:43 +0300)] 
RSNO: Use SNonce cookie to indicate support for RSN overriding

This provides an implicitly protected (SNonce is used as an input to PTK
derivation) mechanism for a STA to indicate support for RSN overriding
in a manner that does not cause interopability issues with deployed APs.

In addition, update sm->SNonce on the Authenticator only based on
message 2/4 since that is the only EAPOL-Key message that is defined to
provide the actual SNonce value. While clearing of this internal buffer
on message 4/4 might not cause issues, it is better to keep the actual
SNonce value here since the SNonce cookie can be used at a later point
in the sequence.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNO: Use the RSN Selection element to indicate which variant was used
Jouni Malinen [Mon, 29 Jul 2024 12:41:59 +0000 (15:41 +0300)] 
RSNO: Use the RSN Selection element to indicate which variant was used

This replaces the use of the RSNE Override and RSNE Override 2 elements
with empty payload to indicate which RSNE variant was used.

In addition, this adds stricter validation of the RSNE in
(Re)Association Request frame to allow only the pairwise cipher suites
and AKMs listed in the indicated RSNE variant to be used.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNO: Remove unused override element generation
Jouni Malinen [Tue, 30 Jul 2024 09:15:02 +0000 (12:15 +0300)] 
RSNO: Remove unused override element generation

The separate RSNOE/RSNO2E/RSNXOE buffers were not actually used on the
Authenticator, so remove them.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoFILS: Check for potential NULL return
Chenming Huang [Tue, 16 Jul 2024 07:27:19 +0000 (15:27 +0800)] 
FILS: Check for potential NULL return

hostapd_eid_assoc_fils_session() might return NULL if memory allocation
fails. This NULL value then will be used for invalid calculation and
cause unspecified behavior or be dereferenced unexpectedly. Avoid this
with an explicit check of the returned pointer.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
12 months agoRSNO: Protect wpa_ie_buf3 from reuse explicitly
Adil Saeed Musthafa [Thu, 25 Jul 2024 19:51:07 +0000 (12:51 -0700)] 
RSNO: Protect wpa_ie_buf3 from reuse explicitly

Use else-if check for better clarity regarding usage of wpa_ie_buf3 to
make it explicit that memory is allocated for this pointer only once.

Signed-off-by: Adil Saeed Musthafa <quic_adilm@quicinc.com>
12 months agoRSNO: Remove override elements from EAPOL-Key msg 3/4
Jouni Malinen [Thu, 25 Jul 2024 19:22:00 +0000 (19:22 +0000)] 
RSNO: Remove override elements from EAPOL-Key msg 3/4

This was not done in case the STA did not use RSN overriding.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agowlantest: Remove unused QoS handling from GCMP nonce generation
Jouni Malinen [Thu, 25 Jul 2024 00:39:30 +0000 (00:39 +0000)] 
wlantest: Remove unused QoS handling from GCMP nonce generation

This was copied from CCMP, but is not needed (and can trigger compiler
warnings) with GCMP.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agotests: Long extra KDE in EAPOL-Key msg 3/4
Jouni Malinen [Wed, 24 Jul 2024 20:35:11 +0000 (20:35 +0000)] 
tests: Long extra KDE in EAPOL-Key msg 3/4

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoTesting functionality to allow EAPOL-Key Reserved field to be set
Jouni Malinen [Wed, 24 Jul 2024 17:22:42 +0000 (17:22 +0000)] 
Testing functionality to allow EAPOL-Key Reserved field to be set

The new hostapd configuration parameter eapol_key_reserved_random=1 can
be used for testing STA/Supplicant functionality to accept a random
value in the Reserved field within EAPOL-Key frames.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoAllow RSNE/RSNXE/RSNOE/RSNO2E/RSNXOE to be replace for testing
Jouni Malinen [Wed, 24 Jul 2024 00:04:15 +0000 (00:04 +0000)] 
Allow RSNE/RSNXE/RSNOE/RSNO2E/RSNXOE to be replace for testing

This is convenient for testing STA behavior with various RSN element
combinations and special cases.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNO: Support over two octets of RSNXOE capabilities
Jouni Malinen [Tue, 23 Jul 2024 21:36:46 +0000 (21:36 +0000)] 
RSNO: Support over two octets of RSNXOE capabilities

The RSNXE generation function was extended to support this earlier, but
that update was missed from the RSNXOE variant.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNO: Allow RSNXE to be omitted
Jouni Malinen [Tue, 23 Jul 2024 21:20:45 +0000 (21:20 +0000)] 
RSNO: Allow RSNXE to be omitted

Add an explicit rsn_override_omit_rsnxe=1 configuration parameter to
allow the RSNXE to be omitted when using the RSNXOE and wanting to
minimize interoperability issues with STAs that might recognize the
RSNXE, but not handle it correctly, e.g., when multiple octets of
payload is included.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoEnhance select_network() to trigger new scans in some cases
Hu Wang [Wed, 26 Jun 2024 03:05:12 +0000 (20:05 -0700)] 
Enhance select_network() to trigger new scans in some cases

wpa_supplicant select_network() relies on fast_associate to reuse old
scan results. However, this approach does not apply in some cases in
Android:

1 - If the selected network is hidden, and the SSID is in Chinese,
Android switches between fallback SSIDs, necessitating a new scan for
switching between different hidden SSIDs.

2 - Similarly, if the selected SSID is OWE (Opportunistic Wireless
Encryption), and the OWE SSID bands have been changed, select_network()
requires a fresh scan to discover hidden OWE SSIDs.

To address these, enhance select_network() to trigger new scans instead
of relying on fast_associate. This improves network selection behavior
in Android.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNO: Use correct MLO capability while fetching RSNE/RSNXE
Veerendranath Jakkam [Tue, 2 Jul 2024 14:11:55 +0000 (19:41 +0530)] 
RSNO: Use correct MLO capability while fetching RSNE/RSNXE

Use current connection MLO capability to fetch the appropriate
RSNE/RSNXE variant while processing association event.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
12 months agoFallback to RSNXE when AP is not using valid RSN Overrding
Veerendranath Jakkam [Sat, 29 Jun 2024 21:19:21 +0000 (02:49 +0530)] 
Fallback to RSNXE when AP is not using valid RSN Overrding

wpa_supplicant was ignoring RSNXE also if the AP is not using valid
RSN overriding combination when the STA supports RSN overriding. Fix
this fallback to the RSNXE when AP is not using valid RSN overriding.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
12 months agoAdd QCA vendor interface to support Unsynchronized Service Discovery
Vinay Gannevaram [Tue, 12 Dec 2023 07:38:40 +0000 (13:08 +0530)] 
Add QCA vendor interface to support Unsynchronized Service Discovery

Add a new QCA command QCA_NL80211_VENDOR_SUBCMD_USD and related
attributes to support Unsynchronized Service Discovery (USD).

Device in active subscriber role sends SDF frames with service
information to find devices that advertise or publish the required
services. Device address, operation type, instance id, service_id,
channel info, service specific info, element container attribute, and
timeout are sent to the driver to initiate USD publish or USD subscribe
operation. The driver sends QCA_NL80211_VENDOR_SUBCMD_USD event with
instance_id and the USD operation status. QCA_NL80211_VENDOR_SUBCMD_USD
is also used to update publish operation and to cancel the publish or
subscribe operation for a service. It also allows all the operations to
be terminated using the USD flush command.

Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
12 months agotests: RSNE/RSNXE overriding
Jouni Malinen [Wed, 11 Oct 2023 09:51:17 +0000 (12:51 +0300)] 
tests: RSNE/RSNXE overriding

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRSNE/RSNXE overriding for STA
Jouni Malinen [Wed, 11 Oct 2023 09:50:05 +0000 (12:50 +0300)] 
RSNE/RSNXE overriding for STA

Add support for RSNE/RSNXE Override elements. Use these elements to
determine AP's extended RSN parameters.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoMake driver capabilities for AKM suites available within wpa_supplicant
Jouni Malinen [Thu, 27 Jun 2024 14:33:44 +0000 (17:33 +0300)] 
Make driver capabilities for AKM suites available within wpa_supplicant

In addition, add some of the previously missed AKM suites from the
default capabilities.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoUse helper functions to access RSNE/RSNXE from BSS entries
Jouni Malinen [Wed, 11 Oct 2023 09:50:05 +0000 (12:50 +0300)] 
Use helper functions to access RSNE/RSNXE from BSS entries

This is a step towards allowing the contents of RSNE/RSNXE to be
overridden.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agonl80211: Add a capability flag for RSN overriding
Veerendranath Jakkam [Thu, 13 Jun 2024 06:43:14 +0000 (12:13 +0530)] 
nl80211: Add a capability flag for RSN overriding

Add a new capability flag based on the nl80211 feature advertisement for
RSN overriding support.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
12 months agoAdd QCA vendor feature flags to indicate RSN override elements support
Veerendranath Jakkam [Tue, 28 May 2024 02:15:44 +0000 (07:45 +0530)] 
Add QCA vendor feature flags to indicate RSN override elements support

Add a separate feature flag for STA mode to indicate support for RSN
override elements.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
12 months agoRSNE/RSNXE overriding for AP
Jouni Malinen [Wed, 11 Oct 2023 09:48:05 +0000 (12:48 +0300)] 
RSNE/RSNXE overriding for AP

Allow hostapd to be configured to advertised two separate sets of
RSNE/RSNXE parameters so that RSNE/RSNXE can use a reduced set of
capabilities (e.g., WPA2-Personal only) for supporting deployed STAs
that have issues with transition modes while the new override elements
can use a newer security option (e.g., WPA3-Personal only) for STAs that
support the new mechanism.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoAllow RSNXE Override element to override RSNXE contents during parsing
Jouni Malinen [Wed, 1 Nov 2023 13:27:31 +0000 (15:27 +0200)] 
Allow RSNXE Override element to override RSNXE contents during parsing

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoAllow RSNE Override element to override RSNE contents during parsing
Jouni Malinen [Wed, 11 Oct 2023 09:46:23 +0000 (12:46 +0300)] 
Allow RSNE Override element to override RSNE contents during parsing

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoAdd RSN overriding elements into IE parsing
Jouni Malinen [Wed, 11 Oct 2023 09:45:09 +0000 (12:45 +0300)] 
Add RSN overriding elements into IE parsing

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoDefine WFA vendor specific element types for RSNE/RSNXE overriding
Jouni Malinen [Wed, 11 Oct 2023 09:43:11 +0000 (12:43 +0300)] 
Define WFA vendor specific element types for RSNE/RSNXE overriding

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoThe main branch is now used for v2.12 development
Jouni Malinen [Sat, 20 Jul 2024 18:16:55 +0000 (21:16 +0300)] 
The main branch is now used for v2.12 development

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agoPreparations for v2.11 release hostap_2_11
Jouni Malinen [Sat, 20 Jul 2024 17:50:21 +0000 (20:50 +0300)] 
Preparations for v2.11 release

Update the version number for the build and also add the ChangeLog
entries for both hostapd and wpa_supplicant to describe main changes
between v2.10 and v2.11. Update the copyright years for the main
programs.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agodbus: Fix memory leak with Bonjour params for a P2P UPnP service
Davide Caratti [Thu, 18 Jul 2024 16:23:49 +0000 (18:23 +0200)] 
dbus: Fix memory leak with Bonjour params for a P2P UPnP service

Using D-Bus, it is possible to add a valid UPnP service where 'query'
and 'response' are specified. In this case, memory for 'query' and
'response' is allocated but not used nor freed. Valgrind complains as
follows:

 42 bytes in 1 blocks are definitely lost in loss record 32 of 75
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54F41A: wpas_dbus_handler_p2p_add_service (dbus_new_handlers_p2p.c:2762)
    by 0x53B9A2: msg_method_handler (dbus_new_helpers.c:356)
    by 0x53B9A2: message_handler (dbus_new_helpers.c:412)
    by 0x4EAB4B8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.13)
    by 0x5495DF: dispatch_data (dbus_common.c:37)
    by 0x5495DF: process_watch (dbus_common.c:73)
    by 0x5495DF: process_watch_read (dbus_common.c:89)
    by 0x41EE8E: eloop_sock_table_dispatch.part.0 (eloop.c:603)
    by 0x41FA46: eloop_sock_table_dispatch (eloop.c:597)
    by 0x41FA46: eloop_run (eloop.c:1233)
    by 0x56A3CE: wpa_supplicant_run (wpa_supplicant.c:8074)
    by 0x40DB06: main (main.c:393)

 49 bytes in 1 blocks are definitely lost in loss record 37 of 75
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54F348: wpas_dbus_handler_p2p_add_service (dbus_new_handlers_p2p.c:2755)
    by 0x53B9A2: msg_method_handler (dbus_new_helpers.c:356)
    by 0x53B9A2: message_handler (dbus_new_helpers.c:412)
    by 0x4EAB4B8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.13)
    by 0x5495DF: dispatch_data (dbus_common.c:37)
    by 0x5495DF: process_watch (dbus_common.c:73)
    by 0x5495DF: process_watch_read (dbus_common.c:89)
    by 0x41EE8E: eloop_sock_table_dispatch.part.0 (eloop.c:603)
    by 0x41FA46: eloop_sock_table_dispatch (eloop.c:597)
    by 0x41FA46: eloop_run (eloop.c:1233)
    by 0x56A3CE: wpa_supplicant_run (wpa_supplicant.c:8074)
    by 0x40DB06: main (main.c:393)

Fix this ensuring that query and resp are freed both in the error and
non-error path of wpas_dbus_handler_p2p_add_service(). Also, add a test
in test_dbus.py to verify the correct behavior.

Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
12 months agodbus: Fix SignalChange property
David Ruth [Tue, 16 Jul 2024 19:53:00 +0000 (19:53 +0000)] 
dbus: Fix SignalChange property

SignalChange should be defined as a property of an interface.
Previously, it was incorrectly defined as a property of P2P peers.

Fixes: 7a7ce957460a ("dbus: Emit more information over D-Bus")
Signed-off-by: David Ruth <druth@chromium.org>
12 months agoMove NULL check for driver private data (drv_priv)
Sunil Ravi [Thu, 18 Jul 2024 23:10:46 +0000 (23:10 +0000)] 
Move NULL check for driver private data (drv_priv)

In the hostapd_cleanup_driver() function, the NULL check for the driver
private data (drv_priv) is located within the CONFIG_IEEE80211BE feature
flag. As a result, on platforms where CONFIG_IEEE80211BE is not defined,
driver->hapd_deinit(drv_priv) is called with drv_priv set to NULL. This
leads to a null pointer exception in wpa_driver_nl80211_deinit().

To address this issue, move the NULL check for drv_priv outside the
CONFIG_IEEE80211BE build flag. This ensures that the check is performed
regardless of the value of CONFIG_IEEE80211BE, preventing the NULL
pointer exception.

Fixes: df34c2ced34f ("AP MLD: De-initialize/disable link BSS properly")
Signed-off-by: Sunil Ravi <sunilravi@google.com>
12 months agoFT: Fix FTE MIC calculation with fragmented FTE
Veerendranath Jakkam [Thu, 4 Jul 2024 06:39:43 +0000 (12:09 +0530)] 
FT: Fix FTE MIC calculation with fragmented FTE

Currently wpa_ft_parse_ies() is setting FTE information to wpa_buf
pointer data which is generated after defragmentation. This data will
not contain FTE and Fragment element(s) headers.

IEEE P802.11be/D5.0 describes the MIC to be calculated on the
concatenation of FTE and corresponding Fragment element(s) which
implies the element headers are included for each element in the
fragmented case.

Fix this by correctly populating FTE information when FTE is
fragmented.

Fixes: 43b5f11d9 ("Defragmentation of FTE")
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
12 months agoMLD STA: Find partner links by BSSID and SSID
Michael-CY Lee [Tue, 9 Apr 2024 06:50:23 +0000 (14:50 +0800)] 
MLD STA: Find partner links by BSSID and SSID

Non-AP MLD finds AP MLD's partner links by BSSID from the scan results.
However, if the scan results contain BSSs with the same BSSID but
different BSS information, the non-AP MLD might assign a wrong BSS to
one of the AP MLD's partner links.

Avoids the problem by using both BSSID and SSID to find the AP MLD's
partner links.

Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
12 months agotests: Check CSA between non DFS and DFS chan
marek@mazekey.pl [Fri, 26 Apr 2024 22:11:18 +0000 (00:11 +0200)] 
tests: Check CSA between non DFS and DFS chan

Add test to validate CSA between non DFS channel
and DFS channel with different operating class.

Signed-off-by: Marek Kwaczynski <marek@mazekey.pl>
12 months agohostapd: Fix opclass during CSA with DFS channels
marek@mazekey.pl [Tue, 23 Apr 2024 09:08:08 +0000 (11:08 +0200)] 
hostapd: Fix opclass during CSA with DFS channels

During CSA with DFS channels, disable, enable interface is a part of the
algorithm. When interface was enabled old operating class before switch
and new channel were used causing mismatch in
configured_fixed_chan_to_freq() function.

Example of log when switch from channel 157 to 108 was triggered:
"Could not convert op_class 124 channel 108 to operating frequency"

Fixes: bb781c763 ("AP: Populate iface->freq before starting AP")
Signed-off-by: Marek Kwaczynski <marek@mazekey.pl>
12 months agoMulti-AP: Honor wds_sta even with multi_ap
gasmibal@gmail.com [Sun, 28 Apr 2024 19:47:21 +0000 (21:47 +0200)] 
Multi-AP: Honor wds_sta even with multi_ap

When multi_ap is active, hostapd creates an AP-VLAN interface for 4addr
stations, even though wds_sta is not configured.

A check should be added to determine if wds_sta is active before
re-enabling the WDS mode by creating an AP-VLAN for 4addr stations.

Signed-off-by: Baligh Gasmi <gasmibal@gmail.com>
12 months agotests: Set sta_wds in multi_ap_backhaul_shared_bss
Jouni Malinen [Sat, 13 Jul 2024 15:06:42 +0000 (18:06 +0300)] 
tests: Set sta_wds in multi_ap_backhaul_shared_bss

This is needed to add the WDS interface for a STA with stricter
implementation checks.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agotests: wpa_supplicant secure mesh and injected SAE messages
Jouni Malinen [Sat, 13 Jul 2024 13:38:48 +0000 (16:38 +0300)] 
tests: wpa_supplicant secure mesh and injected SAE messages

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoSAE: Drop default dot11RSNASAESync value from 5 to 3
Jouni Malinen [Sat, 13 Jul 2024 13:37:15 +0000 (16:37 +0300)] 
SAE: Drop default dot11RSNASAESync value from 5 to 3

Going through five extra rounds of SAE commit messages in cases where
SAE peers are somehow unsynchronized feels unnecessary much to do by
default, so drop the default value to 3.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoSAE: Disable protocol instance temporarily on sync error in mesh
Jouni Malinen [Sat, 13 Jul 2024 13:35:12 +0000 (16:35 +0300)] 
SAE: Disable protocol instance temporarily on sync error in mesh

Reduce the number of unwanted SAE commit retries in synchronization
error cases when Sync > dot11RSNASAESync in mesh cases by discarding
received SAE commit messages for 10 seconds after a sync error has been
detected.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agonl80211: Fix AP scan with STA fallback error path
Nicolas Escande [Fri, 26 Apr 2024 12:35:53 +0000 (14:35 +0200)] 
nl80211: Fix AP scan with STA fallback error path

I've run into a case where I can bring a 2.4 GHz AP up without it being
in a bridge while I used the 'bridge=' config option. This happens when
the HT scan needed for 40 MHz operation failed to start from the get go
because another dev on the same phy was already in a scan. At the end
the AP is up and running but not added into any bridge.

Upon looking at the code, it seems that some hardware fails to issue a
scan while in AP and thus we have a fallback that switches the interface
from AP to STA before retrying another scan (it will change it back to
AP later on when finished). As we cannot have a (non-WDS) STA in a
bridge, during that procedure, we also remove/add the AP/STA from/to the
bridge as needed.

However, in wpa_driver_nl80211_scan() we do not set
drv->ap_scan_as_station until the end of the switch-to-sta &
retry-scan-start block. This means that when the recursive call to
wpa_driver_nl80211_scan() fails (the hardware is busy in my case) we
restore the interface to AP with wpa_driver_nl80211_set_mode() but that
will not add it back to the bridge. Problem.

To fix this lets always set drv->ap_scan_as_station before calling
wpa_driver_nl80211_set_mode(). In case wpa_driver_nl80211_set_mode() or
wpa_driver_nl80211_scan() fails lets call nl80211_restore_ap_mode() that
will set the mode back to AP but also handle the bridge thing as needed.

Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
12 months agonl80211: NAN: Register multicast action frames if possible
Chien Wong [Sat, 27 Apr 2024 08:19:46 +0000 (16:19 +0800)] 
nl80211: NAN: Register multicast action frames if possible

The USD passive subscriber and solicited transmission only publisher
require receiving multicast NAN action frames in order to work.
Currently, we are not requesting to receive multicast when
registering NAN action frames. As a result, USD passive subscribe or
solicited only publish may not work.

The NL80211_ATTR_RECEIVE_MULTICAST attribute corresponds to wiphy
ext feature NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS, which
requires driver support and only a few drivers in the kernel tree
support it. Namely ath9k, ath9k_htc, ath10k and hwsim. We should
fall back to register non multicast action frames if the driver
has no support.

It was confirmed that ath9k_htc starts to work after the changes.

Note that even without requesting to receive multicast Action
frames, some drivers would still upload them. For example, rtl8192cu
and hwsim. This is why test cases like test_nan_usd_match would not
fail.

Tested-on: TP-LINK TL-WN821N v3(AR7010+AR9287, ath9k_htc)
Signed-off-by: Chien Wong <m@xv97.com>
12 months agotests: NAN: Check USD publish type
Chien Wong [Sat, 27 Apr 2024 08:19:45 +0000 (16:19 +0800)] 
tests: NAN: Check USD publish type

Signed-off-by: Chien Wong <m@xv97.com>
12 months agoNAN: Reject undefined publish type
Chien Wong [Sat, 27 Apr 2024 08:19:44 +0000 (16:19 +0800)] 
NAN: Reject undefined publish type

The Wi-Fi Aware Specification v4.0 only defines unsolicited
transmissions only, solicited transmissions only and both unsolicited
and solicited transmissions publish. The other possibility is undefined
so we should reject it.

Signed-off-by: Chien Wong <m@xv97.com>
12 months agoNAN: Fix a typo in USD doc
Chien Wong [Sat, 27 Apr 2024 08:19:43 +0000 (16:19 +0800)] 
NAN: Fix a typo in USD doc

The 'req_instance' parameter in transmit command should be
'req_instance_id'.

Fixes: e3f9ab3c3a01 ("NAN: USD in wpa_supplicant")
Signed-off-by: Chien Wong <m@xv97.com>
12 months agonl80211: AP MLD: Reassign drv->ctx correctly to prevent hostapd crash
Michael-CY Lee [Tue, 14 May 2024 01:20:35 +0000 (09:20 +0800)] 
nl80211: AP MLD: Reassign drv->ctx correctly to prevent hostapd crash

When the first link is deleted and there are still remaining links,
drv->ctx should be updated to the new default link on the bss.
Otherwise, drv->ctx points to the address that has already been freed
and makes hostapd crash.

Fixes: d2b62b3fe500 ("AP MLD: Support link removal before removing interface")
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
12 months agotests: Make SSID verification through beacon protection more robust
Jouni Malinen [Fri, 12 Jul 2024 10:15:57 +0000 (13:15 +0300)] 
tests: Make SSID verification through beacon protection more robust

Clear scan results at the beginning of the test case to avoid incorrect
behavior if there are multiple entries for the same BSS. In addition,
use a bit longer wait for receiving an updated Beacon frame in scan
results.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoMake Beacon frame checks less frequent for SSID verification
Jouni Malinen [Fri, 12 Jul 2024 10:13:09 +0000 (13:13 +0300)] 
Make Beacon frame checks less frequent for SSID verification

Instead of checking the latest scan results every second indefinitely,
add more latency between the checks in case the driver does not update
the time stamp value (i.e., does not report new Beacon frames during an
association).

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agotests: Fix run_eht_mld_sae_two_links()
Ilan Peer [Wed, 1 May 2024 07:19:53 +0000 (10:19 +0300)] 
tests: Fix run_eht_mld_sae_two_links()

In the case that the AP MLD is disabled and enabled again, flush
the wpa_supplicant BSS table before reconnecting as otherwise
the previous AP MLD BSSs would be in the BSS table and the wpa_supplicant
would try to connect to them.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
12 months agowlantest: ICMP: Use sta_find_mlo()
Johannes Berg [Wed, 8 May 2024 20:15:43 +0000 (22:15 +0200)] 
wlantest: ICMP: Use sta_find_mlo()

Using just sta_find() won't work for any link addresses
but the assoc link, use sta_find_mlo() instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agotests: Use different groups in test_sae_no_ffc_by_default
Andrei Otcheretianski [Wed, 8 May 2024 13:42:13 +0000 (16:42 +0300)] 
tests: Use different groups in test_sae_no_ffc_by_default

The test assumes that STA will try to reconnect with the same SAE group
after the first authentication attempt is rejected due to unsupported
group. Since this behaviour is fixed in the previous patch, configure
two different groups to trigger the second authentication attempt.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
12 months agowpa_supplicant: Do not select a rejected SAE group
Andrei Otcheretianski [Wed, 8 May 2024 13:42:12 +0000 (16:42 +0300)] 
wpa_supplicant: Do not select a rejected SAE group

Make sure that sme_set_sae_group() doesn't select a group that was
previously rejected during this instance of SAE authentication.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
12 months agoAdd int_array_includes()
Andrei Otcheretianski [Wed, 8 May 2024 13:42:12 +0000 (16:42 +0300)] 
Add int_array_includes()

This is a convenient helper function for using int_array instances.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
12 months agowpa_supplicant: Always clear SAE rejected groups on roaming to another BSS
Andrei Otcheretianski [Wed, 8 May 2024 13:42:12 +0000 (16:42 +0300)] 
wpa_supplicant: Always clear SAE rejected groups on roaming to another BSS

SAE rejected groups were not cleared in case of re-association to the
same ESS. Since new BSS can support different groups, keeping rejected
groups doesn't make sense and may result in AP rejecting the
authentication. Fix it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
12 months agoACS: Fix primary channel puncturing in ACS
Hari Naraayana Desikan Kannan [Tue, 30 Apr 2024 09:52:32 +0000 (15:22 +0530)] 
ACS: Fix primary channel puncturing in ACS

Currently, when the ACS is updating the puncturing bitmap, the function
acs_update_puncturing_bitmap() sets the primary channel bitmap to 0.
This leads to a potential issue where the primary channel could be
punctured if ACS selects a different best channel within the same
segment.

To fix this issue, ensure that the primary channel bitmap is correctly
set by calculating the index of the primary channel based on the
frequency difference between the current channel and the best channel in
the segment, and is then passed to acs_update_puncturing_bitmap().

Fixes: af0f60e7dd00 ("EHT: Calculate puncturing bitmap for ACS")
Signed-off-by: Hari Naraayana Desikan Kannan <quic_hnaraaya@quicinc.com>
12 months agoACS: Fix ACS behavior for channel selection
Hari Naraayana Desikan Kannan [Tue, 30 Apr 2024 09:52:31 +0000 (15:22 +0530)] 
ACS: Fix ACS behavior for channel selection

The current ACS algorithm incorrectly returns success even when there is
no survey list, leading to improper interference factor calculation.
This leads to treating 0 as a valid interference factor, which affects
channel selection judgment.

Fix the issue by ensuring success is only returned when the survey list
is not empty, thereby ignoring non-zero values in the interference
factor calculation.

Signed-off-by: Hari Naraayana Desikan Kannan <quic_hnaraaya@quicinc.com>
12 months agoACS: Update ACS documentation
Hari Naraayana Desikan Kannan [Tue, 30 Apr 2024 09:52:30 +0000 (15:22 +0530)] 
ACS: Update ACS documentation

Update the documentation to reflect the ACS algorithm used in the code.
No functionality change.

Signed-off-by: Hari Naraayana Desikan Kannan <quic_hnaraaya@quicinc.com>
12 months agoMLO: Swap Tx/Rx keys for GTK TKIP Michael MIC in MLO GTK KDE
Hu Wang [Tue, 9 Jul 2024 07:55:28 +0000 (00:55 -0700)] 
MLO: Swap Tx/Rx keys for GTK TKIP Michael MIC in MLO GTK KDE

While TKIP should not really be used at all anymore and is not allowed
for WPA3 (which is required for Wi-Fi 7), there are some deployed APs
that allow WPA2 PSK to be used with MLO and even allowing WPA+WPA2 mode
with TKIP as the group cipher). IEEE P802.11be/D5.0 does not seem to
explicitly disallow this combination, so handle the MLO GTK KDE key
processing similarly to the way GTK KDE is processed, i.e., including
swapping of Michael MIC Tx and Rx keys for TKIP.

This fixes issues with Michael MIC failures if TKIP is used as a group
cipher for a multi-link association.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoFix channel switch without 'ht' for HE and EHT modes in 2.4 GHz band
Pradeep Kumar Chitrapu [Wed, 8 May 2024 18:04:05 +0000 (11:04 -0700)] 
Fix channel switch without 'ht' for HE and EHT modes in 2.4 GHz band

hostapd_cli chan_switch command fails in 2.4 GHz band for HE and EHT
modes if the user does not explicitly specify 'ht' option in the
command.

For example:
"hostapd_cli -i wlan2 chan_switch 10 2412 sec_channel_offset=0 \
 center_freq1=2412 bandwidth=20 blocktx he"

Fix this by enabling HT by default if HE is enabled in the 2.4 GHz and 5
GHz bands. Similarly, enable VHT by default when HE is enabled in the 5
GHz band.

Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
12 months agoFix mesh 6 GHz incorrect channel bandwidth
Harshitha Prem [Fri, 12 Jul 2024 07:34:21 +0000 (13:04 +0530)] 
Fix mesh 6 GHz incorrect channel bandwidth

When the wiphy supports multiple bands and reports different capability
values between 5 GHz and 6 GHz channels, the 6 GHz mesh interface is
unable to correctly map the channel width in function
ibss_mesh_setup_freq(). This issue arises because the modes of 5 GHz and
6 GHz interfaces are the same (HOSTAPD_MODE_IEEE80211A) in supported
modes.

To address this, use function get_mode() to determine the appropriate
mode during mesh setup. This will iterates through all the hw_features
sets and ensures compatibility with the band of the channel supported in
hw_features set.

Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
12 months agotests: SSID verification using beacon protection
Jouni Malinen [Thu, 11 Jul 2024 20:55:14 +0000 (23:55 +0300)] 
tests: SSID verification using beacon protection

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoSSID verification based on beacon protection
Jouni Malinen [Thu, 11 Jul 2024 20:52:30 +0000 (23:52 +0300)] 
SSID verification based on beacon protection

If SSID was not verified during the initial setup of an association, but
beacon protection was negotiated, try verify the SSID based on Beacon
frames that have been received after the first BIGTK has been
configured.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoBSS: Add wpa_bss_get_ie_beacon()
Jouni Malinen [Thu, 11 Jul 2024 20:50:55 +0000 (23:50 +0300)] 
BSS: Add wpa_bss_get_ie_beacon()

This is a variant of wpa_bss_get_ie() to allow IEs to be checked from
only Beacon frames similarly to how wpa_bss_get_vendor_ie_beacon()
behaves for vendor specific elements.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agotests: Verify bigtk_set=1 indication
Jouni Malinen [Thu, 11 Jul 2024 20:16:05 +0000 (23:16 +0300)] 
tests: Verify bigtk_set=1 indication

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoIndicate if BIGTK has been set in STATUS output
Jouni Malinen [Thu, 11 Jul 2024 20:14:02 +0000 (23:14 +0300)] 
Indicate if BIGTK has been set in STATUS output

The new "bigtk_set=1" entry in the control interface STATUS command
output indicates that a BIGTK has been successfully configured. This
shows that beacon protection has been enabled for the current
association.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agotests: Verify that ssid_verified=1 is set appropriately
Jouni Malinen [Thu, 11 Jul 2024 19:46:59 +0000 (22:46 +0300)] 
tests: Verify that ssid_verified=1 is set appropriately

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoIndicate if SSID has been verified in STATUS output
Jouni Malinen [Thu, 11 Jul 2024 19:44:46 +0000 (22:44 +0300)] 
Indicate if SSID has been verified in STATUS output

Add a new "ssid_verified=1" entry into the control interface STATUS
command output if the SSID has been verified for the current
association. This verification may have been done implicitly (e.g., with
SAE H2E and FT protocol binding in the SSID into key derivation or with
FILS protecting the SSID element in the (Re)Association Request frame)
or explicitly with the recently added SSID protection mechanism during
the 4-way handshake.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoPASN: Derive KDK on AP only when both ends support SecureLTF
Sai Pratyusha Magam [Thu, 9 May 2024 09:46:29 +0000 (15:16 +0530)] 
PASN: Derive KDK on AP only when both ends support SecureLTF

On the AP responder side, KDK was derived if the driver advertises
WPA_DRIVER_FLAGS2_SEC_LTF_AP. That is not correct, i.e., this needs to
also depend on the initiator indicating support for this in the RSNXE of
PASN authentication frame 1.

Signed-off-by: Sai Pratyusha Magam <quic_smagam@quicinc.com>
12 months agodbus: Fix error path in scan request handling
Ilan Peer [Sun, 30 Jun 2024 16:39:46 +0000 (19:39 +0300)] 
dbus: Fix error path in scan request handling

In case the scan request handling fails, exit cleanly, i.e., without
setting internal state such as the 'scan_res_handler' pointer.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
12 months agotests: Ignore large memory blocks when searching for keys
Benjamin Berg [Fri, 14 Jun 2024 08:13:51 +0000 (10:13 +0200)] 
tests: Ignore large memory blocks when searching for keys

wpa_supplicant will generally never allocate a memory block of that
size. We can therefore assume that it belongs to ASAN and we need to
ignore it.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotrace: Only permit explicit prefix matching for functions
Benjamin Berg [Fri, 14 Jun 2024 08:13:50 +0000 (10:13 +0200)] 
trace: Only permit explicit prefix matching for functions

The matching code currently only tests whether the prefix of a function
matches. Make this more strict by ensuring that the function name is not
longer.

However, as this breaks some tests (due to inlining), add the ability to
do an explicit prefix match by appending a '*' to the function name. Use
this to change the eap_eke_prf match to eap_eke_prf_* in order to match
one of the actual implementations.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotrace: Use strncmp() to match function names
Benjamin Berg [Fri, 14 Jun 2024 08:13:49 +0000 (10:13 +0200)] 
trace: Use strncmp() to match function names

The functions specified by the user might be longer than the function in
the backtrace, potentially overflowing the memcmp(). In practice, it
should not be a relevant out-of-memory read. However, we can use
strncmp() instead.

Note that, as before, this is only a prefix match. If a function name is
longer in the backtrace it will still match.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotests: Use sha256_prf_bits for failure stack matching
Benjamin Berg [Fri, 14 Jun 2024 08:13:48 +0000 (10:13 +0200)] 
tests: Use sha256_prf_bits for failure stack matching

It seems that sha256_prf may not always be in the stack trace for
failure checking, possibly due to tail call optimization as it simply
calls sha256_prf_bits with updated parameters. Simply match against
sha256_prf_bits directly to avoid issues due to optimizations.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotests: Remove duplicate fail test check
Benjamin Berg [Fri, 14 Jun 2024 08:13:47 +0000 (10:13 +0200)] 
tests: Remove duplicate fail test check

The wpas_p2p_nfc_handover failure test and the more specific
wps_build_nfc_handover_req_p2p were effectively the same as the matching
currently does a prefix match. The code-path tested in these two cases
only hit a single TEST_FAIL macro in openssl_digest_vector.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotests: Use more specific alloc_fail location
Benjamin Berg [Fri, 14 Jun 2024 08:13:46 +0000 (10:13 +0200)] 
tests: Use more specific alloc_fail location

The test here is triggering the allocation failure in the static
wpa_config_parse_password() helper. Use this and decrease the count
instead of matching both wpa_config_set_quoted() and wpa_config_set()
and counting down based on that.

This is in preparation to fix the failure function matching to not do a
prefix match.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotests: Specify correct function name for failure
Benjamin Berg [Fri, 14 Jun 2024 08:13:45 +0000 (10:13 +0200)] 
tests: Specify correct function name for failure

The test expects rsn_pmkid_suite_b_192() to fail but specified only
rsn_pmkid_suite_b without the _192 postfix. Add the postfix so that the
function matching can be fixed later.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agoPMKSA: Guard against NULL KCK for memcpy()
Benjamin Berg [Fri, 14 Jun 2024 08:13:44 +0000 (10:13 +0200)] 
PMKSA: Guard against NULL KCK for memcpy()

If the kck_len is 0 then the pointer may be NULL. If that happens UBSAN
complains about the NULL pointer as memcpy() has the arguments declared
to never be NULL even if the copied number of bytes were zero.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agoMLD: Ensure link_bssid array has space for sentinel
Benjamin Berg [Fri, 14 Jun 2024 08:13:43 +0000 (10:13 +0200)] 
MLD: Ensure link_bssid array has space for sentinel

The consumer of the link_bssid array assumes it is a NULL terminated
array of BSSIDs. As such, add one to the maximum number of links to
ensure that there is always a sentinel value.

Fixes: 5af986c75af4 ("MLD: Also mark links as failed after association failure")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agoMLD: Ensure link BSSIDs remain on stack for ignore
Benjamin Berg [Fri, 14 Jun 2024 08:13:42 +0000 (10:13 +0200)] 
MLD: Ensure link BSSIDs remain on stack for ignore

When ignoring a link BSSID the multi-link information was parsed out
into a struct ml_sta_link_info on the stack. However, this stack
variable went out of scope before it was used by passing the link_bssids
pointer array to another function.

Fixes: 5af986c75af4 ("MLD: Also mark links as failed after association failure")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agodbus: Make sure ServiceDiscoveryRequest/Result does not override pointers
Jouni Malinen [Thu, 11 Jul 2024 15:35:28 +0000 (18:35 +0300)] 
dbus: Make sure ServiceDiscoveryRequest/Result does not override pointers

Explicitly free the previously allocated copy if ServiceDiscoveryRequest
or Service DiscvoveryResponse parsing loop finds multiple instances of
the same dict entry.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agodbus: Fix memory leak in case dbus provides 'tlvs' in invalid P2P SD response
Davide Caratti [Thu, 30 May 2024 08:46:33 +0000 (10:46 +0200)] 
dbus: Fix memory leak in case dbus provides 'tlvs' in invalid P2P SD response

Using D-Bus it is possible to request an invalid SD response where
"tlvs" is specified and there is an unknown key (e.g. "bar": "foo"). In
this case, "tlv" is allocated and then never used nor freed. Valgrind
complains as follows:

 36 bytes in 1 blocks are definitely lost in loss record 20 of 74
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54FB94: wpas_dbus_handler_p2p_service_sd_res (dbus_new_handlers_p2p.c:3016)
    by 0x53B9A2: msg_method_handler (dbus_new_helpers.c:356)
    by 0x53B9A2: message_handler (dbus_new_helpers.c:412)
    by 0x4EAB4B8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.13)
    by 0x5495DF: dispatch_data (dbus_common.c:37)
    by 0x5495DF: process_watch (dbus_common.c:73)
    by 0x5495DF: process_watch_read (dbus_common.c:89)
    by 0x41EE8E: eloop_sock_table_dispatch.part.0 (eloop.c:603)
    by 0x41FA46: eloop_sock_table_dispatch (eloop.c:597)
    by 0x41FA46: eloop_run (eloop.c:1233)
    by 0x56A3EE: wpa_supplicant_run (wpa_supplicant.c:8074)
    by 0x40DB06: main (main.c:393)

Fix it ensuring that "tlv" is freed both in the error and non-error path
of wpas_dbus_handler_p2p_service_sd_res(). Also, add a test case in
test_dbus.py to verify correct behavior.

Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
12 months agodbus: Fix memory leak in case dbus provides tlv in P2P UPnP SD request
Davide Caratti [Thu, 30 May 2024 08:46:32 +0000 (10:46 +0200)] 
dbus: Fix memory leak in case dbus provides tlv in P2P UPnP SD request

Using D-Bus it is possible to trigger a valid UPnP SD request where
"tlv" is specified: in this case "tlv" is allocated, and then not used
nor freed. Valgrind complains as follows:

 72 bytes in 2 blocks are definitely lost in loss record 46 of 68
    at 0x484C214: calloc (vg_replace_malloc.c:1675)
    by 0x41C673: wpabuf_alloc (wpabuf.c:124)
    by 0x41C673: wpabuf_alloc_copy (wpabuf.c:162)
    by 0x54F8B5: wpas_dbus_handler_p2p_service_sd_req (dbus_new_handlers_p2p.c:2928)
    by 0x53B9A2: msg_method_handler (dbus_new_helpers.c:356)
    by 0x53B9A2: message_handler (dbus_new_helpers.c:412)
    by 0x4EAB4B8: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.19.13)
    by 0x5495DF: dispatch_data (dbus_common.c:37)
    by 0x5495DF: process_watch (dbus_common.c:73)
    by 0x5495DF: process_watch_read (dbus_common.c:89)
    by 0x41EE8E: eloop_sock_table_dispatch.part.0 (eloop.c:603)
    by 0x41FA46: eloop_sock_table_dispatch (eloop.c:597)
    by 0x41FA46: eloop_run (eloop.c:1233)
    by 0x56A3CE: wpa_supplicant_run (wpa_supplicant.c:8074)
    by 0x40DB06: main (main.c:393)

Fix it ensuring that "tlv" is freed, both in the error and non-error
path of wpas_dbus_handler_p2p_service_sd_req(). Also, add a test case in
test_dbus.py to verify correct behavior.

Signed-off-by: Davide Caratti <davide.caratti@gmail.com>
12 months agonl80211: Use actual number of supported AKMs for AP setup
Sascha Hauer [Thu, 30 May 2024 12:31:05 +0000 (14:31 +0200)] 
nl80211: Use actual number of supported AKMs for AP setup

Since 0ce1545dcb8 ("nl80211: Determine maximum number of supported
AKMs") we get the maximum number of supported AKMs from the kernel.
Let's use that instead of the legacy NL80211_MAX_NR_AKM_SUITES when
setting up AP mode operation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
12 months agoSecureLTF: Work around misbehaving STAs for PTK derivation without KDK
Sai Pratyusha Magam [Sun, 2 Jun 2024 15:20:38 +0000 (20:50 +0530)] 
SecureLTF: Work around misbehaving STAs for PTK derivation without KDK

Some deployed STAs that advertise SecureLTF support in the RSNXE in
(Re)Association Request frames, do not derive KDK during PTK generation.
Since the correct key calculations in the AP includes an additional KDK
generation in such cases, this causes different PTK-KCK being derived
and the AP ultimately discarding EAPOL-Key message 2/4 due to MIC
validation failure.

Try to derive a PTK without KDK as a workaround in such cases and allow
the 4-way handshake to continue if this results in a matching MIC.

Signed-off-by: Sai Pratyusha Magam <quic_smagam@quicinc.com>
12 months agoDo not derive SAE PT if the network profile does not include SAE
Hu Wang [Wed, 5 Jun 2024 05:21:02 +0000 (22:21 -0700)] 
Do not derive SAE PT if the network profile does not include SAE

wpa_s_setup_sae_pt() derived SAE PT even when the configured key
management options did not include SAE if the global sae_pwe
configuration parameter had been changed to enable H2E. This adds
unnecessary extra delay, so derive PT only if SAE is actually enabled in
the network profile.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agotests: Extend color change test for a non-first link of an AP MLD
Aditya Kumar Singh [Wed, 12 Jun 2024 14:27:54 +0000 (19:57 +0530)] 
tests: Extend color change test for a non-first link of an AP MLD

Currently color change test is supported only on the first link of the
AP MLD. Extend the support to test on non-first link as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
12 months agonl80211: AP MLD: Parse link ID to determine the BSS for color event
Aditya Kumar Singh [Wed, 12 Jun 2024 14:27:53 +0000 (19:57 +0530)] 
nl80211: AP MLD: Parse link ID to determine the BSS for color event

When an HE BSS color event is received from the driver, the event was
delevered to the first link BSS ctx. To support HE BSS color with MLO,
there is a need to identify the correct link for which the event is
intended.

Add link ID parsing support in the event handler and pass the link ID
(if included) down to the event handler so that appropriate link can be
selected.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
12 months agonl80211: Refactor color collision related nl80211 commands handling
Aditya Kumar Singh [Wed, 12 Jun 2024 14:27:52 +0000 (19:57 +0530)] 
nl80211: Refactor color collision related nl80211 commands handling

Almost same logic is there in handling four different commands related
to color collision. Later when link ID needs to be parsed, it would be
more duplicate logic at four different places. Hence refactor and bring
it in a single function.

No functionality changes.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
12 months agohostapd: Fix updating Beacon frames during association handling
Aditya Kumar Singh [Thu, 11 Jul 2024 09:05:39 +0000 (14:35 +0530)] 
hostapd: Fix updating Beacon frames during association handling

In function handle_assoc(), ieee802_11_update_beacons() was used to
update the Beacon frames. However, with commit a5d0bb42a226 ("Reduce
delay between Association Request and Association Response"), it was
changed to ieee802_11_set_beacons() which basically overturned what
commit e59d2a31cfb4 ("hostapd: Fix premature beacon set during
association handling") did which is not correct.

Fix this and use ieee802_11_update_beacons() instead of
ieee802_11_set_beacons().

Fixes: a5d0bb42a226 ("Reduce delay between Association Request and Association Response")
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
12 months agoSAE: Reject invalid Rejected Groups element in the parser
Jouni Malinen [Tue, 9 Jul 2024 20:34:34 +0000 (23:34 +0300)] 
SAE: Reject invalid Rejected Groups element in the parser

There is no need to depend on all uses (i.e., both hostapd and
wpa_supplicant) to verify that the length of the Rejected Groups field
in the Rejected Groups element is valid (i.e., a multiple of two octets)
since the common parser can reject the message when detecting this.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agoSAE: Check for invalid Rejected Groups element length explicitly on STA
Jouni Malinen [Tue, 9 Jul 2024 20:33:38 +0000 (23:33 +0300)] 
SAE: Check for invalid Rejected Groups element length explicitly on STA

Instead of practically ignoring an odd octet at the end of the element,
check for such invalid case explicitly. This is needed to avoid a
potential group downgrade attack.

Fixes: 444d76f74f65 ("SAE: Check that peer's rejected groups are not enabled")
Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agonl80211: Send link ID with NL80211_CMD_TDLS_MGMT to enable TDLS with MLO
Aleti Nageshwar Reddy [Wed, 3 Jul 2024 10:34:45 +0000 (16:04 +0530)] 
nl80211: Send link ID with NL80211_CMD_TDLS_MGMT to enable TDLS with MLO

The latest Linux kernel is mandating link ID with NL80211_CMD_TDLS_MGMT
for MLO connections. This resulted in not being able to perform TDLS
operations during a multi-link association.

Fix this by sending link ID in NL80211_CMD_TDLS_MGMT when available. If
link ID info is not available, send the link ID of the association link.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
12 months agoRADIUS: Check Message-Authenticator if it is present even if not required
Jouni Malinen [Sun, 17 Mar 2024 08:47:58 +0000 (10:47 +0200)] 
RADIUS: Check Message-Authenticator if it is present even if not required

Always check the Message-Authenticator attribute in a received RADIUS
message if it is present. Previously, this would have been skipped if
the attribute was not required to be present.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agoRADIUS: Require Message-Authenticator attribute in MAC ACL cases
Jouni Malinen [Sun, 17 Mar 2024 08:42:56 +0000 (10:42 +0200)] 
RADIUS: Require Message-Authenticator attribute in MAC ACL cases

hostapd required Message-Authenticator attribute to be included in EAP
authentication cases, but that requirement was not in place for MAC ACL
cases. Start requiring Message-Authenticator attribute for MAC ACL by
default. Unlike the EAP case, this can still be disabled with
radius_require_message_authenticator=1 to maintain compatibility with
some RADIUS servers when used in a network where the connection to such
a server is secure.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agoRequire Message-Authenticator in Access-Reject even without EAP-Message
Jouni Malinen [Sat, 16 Mar 2024 09:31:37 +0000 (11:31 +0200)] 
Require Message-Authenticator in Access-Reject even without EAP-Message

Do not allow the exception for missing Message-Authenticator in
Access-Reject without EAP-Message. While such exception is allowed in
RADIUS definition, there is no strong reason to maintain this since
Access-Reject is supposed to include EAP-Message and even if it doesn't,
discarding Access-Reject will result in the connection not completing.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agoRADIUS DAS: Move Message-Authenticator attribute to be the first one
Jouni Malinen [Sat, 16 Mar 2024 09:26:58 +0000 (11:26 +0200)] 
RADIUS DAS: Move Message-Authenticator attribute to be the first one

Even if this might not be strictly speaking necessary for mitigating
certain RADIUS protocol attacks, be consistent with the RADIUS server
behavior and move the Message-Authenticator attribute to be the first
attribute in the RADIUS DAS responses from hostapd.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agohostapd: Move Message-Authenticator attribute to be the first one in req
Jouni Malinen [Sat, 16 Mar 2024 09:22:43 +0000 (11:22 +0200)] 
hostapd: Move Message-Authenticator attribute to be the first one in req

Even if this is not strictly speaking necessary for mitigating certain
RADIUS protocol attacks, be consistent with the RADIUS server behavior
and move the Message-Authenticator attribute to be the first attribute
in the message from RADIUS client in hostapd.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agoeapol_test: Move Message-Authenticator attribute to be the first one
Jouni Malinen [Sat, 16 Mar 2024 09:16:12 +0000 (11:16 +0200)] 
eapol_test: Move Message-Authenticator attribute to be the first one

Even if this is not strictly speaking necessary for mitigating certain
RADIUS protocol attacks, be consistent with the RADIUS server behavior
and move the Message-Authenticator attribute to be the first attribute
in the message from RADIUS client.

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