]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
16 months agoMulti-AP: Use proper length for remaining buffer for the element
Jouni Malinen [Tue, 19 Mar 2024 14:44:00 +0000 (16:44 +0200)] 
Multi-AP: Use proper length for remaining buffer for the element

Replace the hardcoded buffer length with the actually number of
remaining bytes on the buffer. This is needed to be able to do real
buffer size validation within add_multi_ap_ie().

Furthermore, make hostapd_eid_multi_ap() static since it is not used
outside this file.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agoMulti-AP: Move IE parameters into a struct for extensibility
Manoj Sekar [Mon, 26 Feb 2024 12:48:21 +0000 (18:18 +0530)] 
Multi-AP: Move IE parameters into a struct for extensibility

This makes it easier to extend the information that is encoded in the
Multi-AP element.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
16 months agotests: cfg80211_tx_frame: filter frames based on SA
Jouni Malinen [Sun, 17 Mar 2024 17:55:11 +0000 (19:55 +0200)] 
tests: cfg80211_tx_frame: filter frames based on SA

This makes the test care less likely to fail due to another STA
happening to be listening for Public Action frames and replying to the
P2P GO Negotiation Request.

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agotests: Allow WlantestCapture to be used with context managers
Jouni Malinen [Sun, 17 Mar 2024 14:27:54 +0000 (16:27 +0200)] 
tests: Allow WlantestCapture to be used with context managers

In addition, convert many of the uses to do so.

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agotests: Clean up test case importing
Jouni Malinen [Sun, 17 Mar 2024 13:39:54 +0000 (15:39 +0200)] 
tests: Clean up test case importing

Move this to a helper function and return a set of test names instead of
a list.

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agotests: Add missed test case __doc__ strings
Jouni Malinen [Sun, 17 Mar 2024 13:21:11 +0000 (15:21 +0200)] 
tests: Add missed test case __doc__ strings

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agotests: Verify test case function documentation
Jouni Malinen [Sun, 17 Mar 2024 13:20:26 +0000 (15:20 +0200)] 
tests: Verify test case function documentation

Check that each test case function includes a title in __doc__ and also
verify that the same test case is not added multiple times from
different files.

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agotests: Use CS more carefully in p2p_device_autogo_chan_switch
Jouni Malinen [Sat, 9 Mar 2024 16:08:52 +0000 (18:08 +0200)] 
tests: Use CS more carefully in p2p_device_autogo_chan_switch

Do not disable HT support on the GO and wait for the channel switch
event on the P2P Client before proceeding with connectivity test.

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agotests: Use triple double quotes around docstrings more consistently
Jouni Malinen [Sat, 9 Mar 2024 15:11:03 +0000 (17:11 +0200)] 
tests: Use triple double quotes around docstrings more consistently

Signed-off-by: Jouni Malinen <j@w1.fi>
16 months agoDBus: Add ANQP fields to BSS properties
Damien Dejean [Mon, 26 Feb 2024 16:32:41 +0000 (16:32 +0000)] 
DBus: Add ANQP fields to BSS properties

Add ANQP fields to the BSS properties to allow DBus clients to be
notified and obtain the values when it changes.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
16 months agoDBus: Signal ANQP query done
Damien Dejean [Tue, 20 Feb 2024 12:12:11 +0000 (12:12 +0000)] 
DBus: Signal ANQP query done

Add a D-Bus signal "ANQPQueryDone" to notify of the result of an ANQP
request.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
16 months agoDBus: Add a method to get ANQP fields
Damien Dejean [Tue, 20 Feb 2024 12:11:40 +0000 (12:11 +0000)] 
DBus: Add a method to get ANQP fields

Add a D-Bus method to perform ANQP get requests. The new method is
equivalent to the "anqp_get" command available in wpa_cli.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
16 months agoDBus: Add dict helper for uint16 arrays
Damien Dejean [Tue, 20 Feb 2024 12:11:40 +0000 (12:11 +0000)] 
DBus: Add dict helper for uint16 arrays

Extend dict helper to support uint16 arrays.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
16 months agoOpenSSL: Fix a memory leak on hpke_labeled_expand() error path
Chien Wong [Tue, 5 Mar 2024 14:20:41 +0000 (22:20 +0800)] 
OpenSSL: Fix a memory leak on hpke_labeled_expand() error path

Fixes: 786ea402bc5f ("HPKE base mode with single-shot API")
Signed-off-by: Chien Wong <m@xv97.com>
16 months agoOpenSSL: Fix a memory leak on openssl_evp_pkey_ec_prime_len() error path
Chien Wong [Tue, 5 Mar 2024 14:20:40 +0000 (22:20 +0800)] 
OpenSSL: Fix a memory leak on openssl_evp_pkey_ec_prime_len() error path

Fixes: b700a56e1478 ("OpenSSL 3.0: Determine the prime length for an EC key group using EVP_PKEY")
Signed-off-by: Chien Wong <m@xv97.com>
16 months agoDPP: Emit a DPP PB_STATUS event when push button starts
Evan Benn [Mon, 4 Mar 2024 02:24:31 +0000 (13:24 +1100)] 
DPP: Emit a DPP PB_STATUS event when push button starts

To implement an action script that listens for DPP push button events
and for example blinks a LED it is useful to know when push button has
started. Emit an event when push button starts.

Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
16 months agotests: Wait for a specific DPP-PB-STATUS event
Jouni Malinen [Fri, 8 Mar 2024 08:36:38 +0000 (10:36 +0200)] 
tests: Wait for a specific DPP-PB-STATUS event

This wait for a specific event is needed to allow a new DPP-PB-STATUS
event to be added at the start of the PB operation.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agotests: Add basic MLO CSA test case
Aditya Kumar Singh [Fri, 8 Mar 2024 04:35:08 +0000 (10:05 +0530)] 
tests: Add basic MLO CSA test case

Verify that CSA can be performed on the first link of an AP MLD and
further check that traffic still continues even after channel switch.

Finally, check again that a subsequent CSA can be performed without
affecting the data traffic.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
16 months agotests: Set valid configuration for EHT puncturing tests
Johannes Berg [Mon, 29 Jan 2024 18:26:39 +0000 (19:26 +0100)] 
tests: Set valid configuration for EHT puncturing tests

When puncturing is used on EHT, the HT/VHT/HE channel configuration must
not encompass the punctured subchannel, so must use a lower bandwidth.
Change the puncturing tests accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agoRevert "tests: Remove eht_5ghz_80mhz_puncturing_override_1 for now"
Jouni Malinen [Fri, 8 Mar 2024 08:03:41 +0000 (10:03 +0200)] 
Revert "tests: Remove eht_5ghz_80mhz_puncturing_override_1 for now"

This reverts commit eecaceed8f03cee676d47dd9fb70efd25d50e3e9. This test
case can now be restored since hostapd is modified to allow test cases
changes to be done to cover the special impact from EHT puncturing to
available HT/VHT/HE channel bandwidth in this particular case.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agoEHT: More accurate no-second-channel-offset checks when puncturing
Jouni Malinen [Fri, 8 Mar 2024 08:02:49 +0000 (10:02 +0200)] 
EHT: More accurate no-second-channel-offset checks when puncturing

This is needed to allow some cases where puncturing prevents HT/VHT/HE
from using the full channel bandwidth.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agoEHT: Support punct_bitmap overriding in HE element generation
Jouni Malinen [Fri, 8 Mar 2024 08:12:16 +0000 (10:12 +0200)] 
EHT: Support punct_bitmap overriding in HE element generation

This was already added for VHT, but a similar change is needed for HE as
well.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agoMove punct_update_legacy_bw() into src/common
Jouni Malinen [Fri, 8 Mar 2024 08:10:41 +0000 (10:10 +0200)] 
Move punct_update_legacy_bw() into src/common

This function is needed for more common operations so move it to a more
suitable location.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agoProvide punct_bitmap to hostapd_set_freq_params()
Jouni Malinen [Fri, 8 Mar 2024 08:01:30 +0000 (10:01 +0200)] 
Provide punct_bitmap to hostapd_set_freq_params()

This is needed to be able to check validity of the channel parameters
for cases where EHT puncturing impacts what can be enabled for
HT/VHT/HE.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
16 months agoEHT: Move puncturing bitmap determination into a helper function
Jouni Malinen [Fri, 8 Mar 2024 08:00:35 +0000 (10:00 +0200)] 
EHT: Move puncturing bitmap determination into a helper function

Avoid duplicated implementation for this by using a shared helper
function.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agotests: Remove eht_5ghz_80mhz_puncturing_override_1 for now
Jouni Malinen [Wed, 6 Mar 2024 20:38:09 +0000 (22:38 +0200)] 
tests: Remove eht_5ghz_80mhz_puncturing_override_1 for now

mac80211 has been modified to reject the configuration that is used in
this test case. For now, remove this until the puncturing of the second
20 MHz segment can be handled in a manner that allows mac80211 STA to
use EHT.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoEHT: Use eht_oper_puncturing_override when constructing VHT elements
Jouni Malinen [Wed, 6 Mar 2024 20:34:57 +0000 (22:34 +0200)] 
EHT: Use eht_oper_puncturing_override when constructing VHT elements

The testing functionality for overriding EHT puncturing bitmap was
applied only for the EHT elements. The mac80211 has been updated to
enforce compartibility between EHT and HT/VHT information and that made
the related test cases fail. Apply the override value for VHT element
generation to avoid some of those issues.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agotests: Do not drop HT capability on CS to avoid test failures
Jouni Malinen [Wed, 6 Mar 2024 17:32:16 +0000 (19:32 +0200)] 
tests: Do not drop HT capability on CS to avoid test failures

Leave the HT capability of the AP as-is when running channel switch test
cases that started failing with a recent kernel change that disconnects
on such "unexpected" change in AP capabilities.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agotests: Fix fuzzing tester for WNM
Jouni Malinen [Wed, 6 Mar 2024 15:36:10 +0000 (17:36 +0200)] 
tests: Fix fuzzing tester for WNM

Processing of WNM frames can results in a lookup of the current BSS
table. As such, the testing tool needs to initialize the BSS table to
avoid NULL pointer dereferences. This is not an issue that would show up
with real production uses with wpa_supplicant since wpa_bss_init() is
called there.

Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67244
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoFix fuzzing test build
Jouni Malinen [Tue, 5 Mar 2024 15:09:25 +0000 (17:09 +0200)] 
Fix fuzzing test build

The commit that renamed the WNM BTM deallocation function forgot to
update the fuzz tester tool.

Fixes: e508c070c40e ("WNM: Keep BTM information until connection completes")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agotests: Update Supported Operating Classes element validation
Jouni Malinen [Tue, 5 Mar 2024 15:02:45 +0000 (17:02 +0200)] 
tests: Update Supported Operating Classes element validation

The wpa_supplicant implementation for building the Supported Operating
Classes element was modified to add support for 80 MHz and wider
bandwidth on the 6 GHz band, 2-octet operating classes, and freq_list on
the 6 GHz band. Update the test cases that verify exact encoding of this
information to match the implementation changes.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoHandle 6 GHz channels in Supported Operating Classes with freq_list
Jouni Malinen [Tue, 5 Mar 2024 15:01:30 +0000 (17:01 +0200)] 
Handle 6 GHz channels in Supported Operating Classes with freq_list

Only the 2.4 and 5 GHz channels were handled previously when removing
operating classes from the Supported Operating Classes element based on
the freq_list parameter. Extend this to include the 6 GHz band as well.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months ago2-octet operating classes in Support Operating Classes element
Jouni Malinen [Tue, 5 Mar 2024 14:07:22 +0000 (16:07 +0200)] 
2-octet operating classes in Support Operating Classes element

A previous workaround was used to move the special operating class 130
to the end of the Supported Operating Classes element to avoid getting
any following entry being ignored or misunderstood. That is not really
the correct way of encoding the special cases, i.e., 80+80 MHz channels
that use two nonadjacent frequency segments.

Add support for encoding the 80+80 MHz channel with the 2-octet
operating class design using the Operating Class Duple sequence field of
the Supported Operating Classes element instead of listing the operating
classes that have the 80+ behavior limit set indication in Table E-4
(i.e., opclass 130 and 135) as 1-octet operating classes in the
Operating Classes field.

Fixes: a92660a00e10 ("Work around Supported Operating Classes element issues for 6 GHz")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agotests: Verify supported operating classes indication for 6 GHz
Jouni Malinen [Mon, 4 Mar 2024 16:48:06 +0000 (18:48 +0200)] 
tests: Verify supported operating classes indication for 6 GHz

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoExtend support for the 6 GHz operating class 137 (320 MHz)
Ainy Kumari [Thu, 22 Feb 2024 04:02:04 +0000 (09:32 +0530)] 
Extend support for the 6 GHz operating class 137 (320 MHz)

Commit 085a3fc76e6b ("EHT: Add 320 channel width support") added this in
various places, but it did not cover everything. Extend this support to
be more complete. In particular, this allows wpa_supplicant to report
the operating class 137 in the Supported Operating Classes element and
to use it when processing beacon requests.

Signed-off-by: Ainy Kumari <quic_ainykuma@quicinc.com>
17 months agonl80211: Process 6 GHz regulatory rules to accurate channel flags
Ainy Kumari [Thu, 22 Feb 2024 04:02:04 +0000 (09:32 +0530)] 
nl80211: Process 6 GHz regulatory rules to accurate channel flags

This is needed to be able to indicate all supported operating classes.

Signed-off-by: Ainy Kumari <quic_ainykuma@quicinc.com>
17 months agoUse a helper function to free neighbor DB entries
Jouni Malinen [Sun, 3 Mar 2024 18:41:30 +0000 (20:41 +0200)] 
Use a helper function to free neighbor DB entries

There is no need to duplicate this code in multiple locations.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoClear all neighbor entry items explicitly
Jouni Malinen [Sun, 3 Mar 2024 18:39:29 +0000 (20:39 +0200)] 
Clear all neighbor entry items explicitly

Do not leave some of the variables to their previously used values when
a neighbor entry is cleared.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoUpdate own report in nr_db if SSID is changed
Nikita Chernikov [Thu, 1 Feb 2024 16:05:02 +0000 (18:05 +0200)] 
Update own report in nr_db if SSID is changed

short_ssid in the own neighbor report might get out of sync, causing
advertising RNR element based on the old SSID, when SSID is changed
either with control interface command SET or with SIGHUP. Therefore,
sync the own report entry by removing the old entry and setting own
report again if the short SSID value has changed.

Signed-off-by: Nikita Chernikov <nchernikov@maxlinear.com>
17 months agoAP MLD: Set link address only when non-AP MLD is not added to driver
Michael-CY Lee [Thu, 15 Feb 2024 07:36:41 +0000 (15:36 +0800)] 
AP MLD: Set link address only when non-AP MLD is not added to driver

Once the non-AP MLD is added to the driver, the driver handles the
address translation so that hostapd receives Management frames with
SA/DA being translated into MLD MAC addresses.

If the Authentication frmae is retransmitted with transaction being 1,
SA of the retransmitted Authentication frame is translated into the MLD
MAC address by the driver, and then in the function handle_auth(),
sta->mld_info.links[].peer_addr would be replaced by the MLD MAC address
even though it is supposed to be the link address.

Therefore, update the MLD information only when the STA has not yet been
added into the driver to avoid replacing the previously determined link
address with the MLD MAC address.

Fixes: bcbe80a66 ("AP: MLO: Handle Multi-Link element during authentication")
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
17 months agoFix INTERFACES command buffer size to allow more data
Mujibur Rahiman K [Wed, 14 Feb 2024 10:03:25 +0000 (15:33 +0530)] 
Fix INTERFACES command buffer size to allow more data

reply_size instead sizeof(buffer) should be provided to
hostapd_global_ctrl_iface_interfaces() when processing INTERFACES
commands. The previous use of sizeof(buffer) used a significantly
shorter limit (256 vs. 4096 bytes) for the output and this could have
resulted in unnecessary truncation of the output.

Fixes: 618f5d01b0cf ("hostapd: Add INTERFACES ctrl_iface command")
Signed-Off-By : Mujibur Rahiman K mujiburrahimank@maxlinear.com

17 months agohostapd: Dump VHT/HE/EHT full capabilities in STA command output
Janusz Dziedzic [Tue, 27 Feb 2024 17:17:47 +0000 (18:17 +0100)] 
hostapd: Dump VHT/HE/EHT full capabilities in STA command output

Show full VHT/HE/EHT capabilities for connected stations.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
17 months agoUse os_snprintf_error() more consistently in STA output generation
Jouni Malinen [Sun, 3 Mar 2024 18:01:27 +0000 (20:01 +0200)] 
Use os_snprintf_error() more consistently in STA output generation

In theory, os_snprintf() could return a negative value and as such,
os_snprintf_error() should be used in all cases where the buffer might
not be large enough.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoDo not change out-of-range configuration parameters
Jouni Malinen [Sun, 3 Mar 2024 17:55:45 +0000 (19:55 +0200)] 
Do not change out-of-range configuration parameters

The INT_RANGE() cases for wpa_supplicant global and network profile
parameters ended up changing the configured value to the minimum value
if the provided value was too small or to the maximum value if the
provided value was too large. This does not seem most logical. Change
this to not change the configured value at all if the provided value is
outside the valid range.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agotests: More debug info for eht_mld_sae_legacy_client
Jouni Malinen [Sun, 3 Mar 2024 17:25:27 +0000 (19:25 +0200)] 
tests: More debug info for eht_mld_sae_legacy_client

It looks like this test case can fail in some cases. Add more debug info
and event wait that might help with a race condition.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agotests: Use even larger timeout of concurrent P2P operations
Jouni Malinen [Sun, 3 Mar 2024 17:09:10 +0000 (19:09 +0200)] 
tests: Use even larger timeout of concurrent P2P operations

It looks like the 30 second timeout, i.e., 25 second to discover and
receive GO Negotiation Request, was not sufficient for all cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agotests: wpa_supplicant configuration parser range checking
Jouni Malinen [Sun, 3 Mar 2024 16:16:58 +0000 (18:16 +0200)] 
tests: wpa_supplicant configuration parser range checking

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoFix valid range for disable_ht40
Jouni Malinen [Sun, 3 Mar 2024 16:36:46 +0000 (18:36 +0200)] 
Fix valid range for disable_ht40

This network parameter uses values 0 and 1, so -1 should not have been
accepted.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoEnforce valid range check for SET mbo_cell_capa and oce
Jouni Malinen [Sun, 3 Mar 2024 16:15:18 +0000 (18:15 +0200)] 
Enforce valid range check for SET mbo_cell_capa and oce

These parameters have both a separate SET command handler and a global
configuration parameter handler. Only the global configuration parameter
handler for enforcing valid range checking. Do that for the SET command
as well.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agowpa_supplicant: Fix ignoring boundary 0 in config parser
Chien Wong [Thu, 29 Feb 2024 13:08:31 +0000 (21:08 +0800)] 
wpa_supplicant: Fix ignoring boundary 0 in config parser

The following config file contains invalid items:
----
filter_rssi=1234 # should be rejected

network={
 mode=-1 # should be rejected
 ssid="ssid"
 psk="password"
}
----
But it is accepted by the config parser. The issue is due to using NULL
to represent no limit. If a boundary is set to 0, it's disregarded.
Fix this.
Note that string parser is not affected as length cannot be negative and
we are not limiting any string to be always empty.

Signed-off-by: Chien Wong <m@xv97.com>
17 months agoP2P: Fix pri/sec channel switch skipping for GO
Jouni Malinen [Sat, 2 Mar 2024 19:04:30 +0000 (21:04 +0200)] 
P2P: Fix pri/sec channel switch skipping for GO

Use of wpa_s->p2p_go_no_pri_sec_switch needs to be conditional on
CONFIG_P2P being defined for the build to avoid a compilation error and
ssid->p2p_group to avoid using this for non-P2P AP mode case in
wpa_supplicant. Furthermore, it is better to clear this flag when
stopping a P2P GO to reduce risk of this getting used for a separate
instance of starting a GO.

Fixes: b18d95759375 ("P2P: Disable pri/sec channel switch for GO with forced frequency")
Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoWNM: Keep BTM information until connection completes
Benjamin Berg [Tue, 20 Feb 2024 13:18:27 +0000 (14:18 +0100)] 
WNM: Keep BTM information until connection completes

In the MLD case, the information from the transition management request
is relevant during the association process in order to filter out links
that were disallowed by the BTM request. Also, the information remains
useful should a connection attempt fail.

To enable these scenarios, keep the information around until the
connection has completed. As this might make it impossible to establish
a connection, also clear this information at the same time that a normal
BSS ignore is cleared to avoid getting stuck in case the transition
fails unexpectedly.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Follow BTM procedure if the last link is dropped
Benjamin Berg [Tue, 20 Feb 2024 13:18:26 +0000 (14:18 +0100)] 
WNM: Follow BTM procedure if the last link is dropped

If the last link is dropped, it makes sense to follow the BTM procedure.
However, in that case we need to prevent reconnection to this link
specifically, while if the AP MLD is terminating we need to forbid
connecting to the AP MLD.

As such, add a new variable to track the BSSID or AP MLD MAC address.
Which one it refers to depends on whether wnm_link_removal is set.

This also simplifies the check in wnm_is_bss_excluded() and untangles it
from wpa_s->current_bss.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Remove dialog_token parameter
Benjamin Berg [Tue, 20 Feb 2024 13:18:25 +0000 (14:18 +0100)] 
WNM: Remove dialog_token parameter

All callers of wnm_send_bss_transition_mgmt_resp() are explicitly
passing wpa_s->wnm_dialog_token. As such, we might as well not pass it
and use the variable directly.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Set wnm_reply to 0 when sending it
Benjamin Berg [Tue, 20 Feb 2024 13:18:24 +0000 (14:18 +0100)] 
WNM: Set wnm_reply to 0 when sending it

There is no point in the caller to set it to zero. Just do so within
wnm_send_bss_transition_mgmt_resp().

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Do not store coloc_intf_elems
Benjamin Berg [Tue, 20 Feb 2024 13:18:23 +0000 (14:18 +0100)] 
WNM: Do not store coloc_intf_elems

The elements are (currently) not used except for sending an immediate
response similar to COLOC_INTF_REPORT with the main difference being
that the dialog token is included.

Do not store the elements. It easy enough to re-add this should the
implementation improve. And this fixes the fact that the variable is
cleared at odd times as wnm_deallocate_memory() is used specifically to
clear the neighbor report list of a BTM request.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Drop explicit wpa_is_bss_tmp_disallowed() check
Benjamin Berg [Tue, 20 Feb 2024 13:18:22 +0000 (14:18 +0100)] 
WNM: Drop explicit wpa_is_bss_tmp_disallowed() check

There is no need for this check as wpa_scan_res_match() already calls
the function through wpa_scan_res_ok() before accepting a match.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Drop explicit SSID check
Benjamin Berg [Tue, 20 Feb 2024 13:18:21 +0000 (14:18 +0100)] 
WNM: Drop explicit SSID check

The call to wpa_scan_res_match already checks that the SSID matches
current_ssid. Therefore there is no need to do any further checking.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Drop check for current_ssid
Benjamin Berg [Tue, 20 Feb 2024 13:18:20 +0000 (14:18 +0100)] 
WNM: Drop check for current_ssid

It should never be NULL. In the unlikely event that it is NULL, the
logic changes slightly to reject all candidates.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Define a stub wnm_is_bss_excluded if WNM is disabled
Benjamin Berg [Tue, 20 Feb 2024 13:18:19 +0000 (14:18 +0100)] 
WNM: Define a stub wnm_is_bss_excluded if WNM is disabled

This removes the need to check for CONFIG_WNM.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Wait for BTM response TX status before roaming
Avraham Stern [Tue, 20 Feb 2024 13:18:18 +0000 (14:18 +0100)] 
WNM: Wait for BTM response TX status before roaming

When accepting a BSS transition request there is a race between
sending the response and roaming to the target AP. As a result,
the response may not be sent because the station deauthenticated
from the AP before the response was actually sent.

To make sure the BSS transition response is sent, start roaming only
after the TX status is received for the BSS transition response.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Don't scan frequencies of neighbors that should be ignored
Benjamin Berg [Tue, 20 Feb 2024 13:18:17 +0000 (14:18 +0100)] 
WNM: Don't scan frequencies of neighbors that should be ignored

It does not make sense to scan for neighbors that we are not supposed to
use anyway. As such, skip them.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoWNM: Clean up old scan data processing
Benjamin Berg [Tue, 20 Feb 2024 13:18:16 +0000 (14:18 +0100)] 
WNM: Clean up old scan data processing

When receiving a BTM request, wpa_supplicant would try to fetch new
results from the driver, and, independently of that, would also process
the latest scan results that were partially updated by the previous
fetch.

Simplify the logic by using wpa_supplicant_get_scan_results() directly
and then process the old scan data as usual. However, this data may be
outdated, so add a new heuristic to avoid roaming to a BSS if it is
either outdated or bad.

Doing this moves all scan data processing into wnm_scan_process() and
removes duplicated functionality for scan result processing in scan.c.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoDPP: Wait for TX wait expiration on moving to neg_freq for Auth Resp
Jouni Malinen [Sat, 2 Mar 2024 17:37:11 +0000 (19:37 +0200)] 
DPP: Wait for TX wait expiration on moving to neg_freq for Auth Resp

Avoid potential race conditions with the driver operations between
stopping an ongoing wait for responses for an offchannel TX that was
used to send Authentication Request with a request to use a different
channel for Authentication Response and the start of a new ROC on the
other channel by waiting for the TX expiration event before issuing the
ROC request.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agonl80211: Indicate EVENT_TX_WAIT_EXPIRE on match-saved
Jouni Malinen [Sat, 2 Mar 2024 17:34:17 +0000 (19:34 +0200)] 
nl80211: Indicate EVENT_TX_WAIT_EXPIRE on match-saved

The event indicating expiration of an offchannel TX is useful for cases
where the wait is for a frame that was explicitly requested to have the
pending cookie to be saved.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoDPP: Wait for ROC cancelled event on Auth Resp TX on another channel
Jouni Malinen [Sat, 2 Mar 2024 17:06:15 +0000 (19:06 +0200)] 
DPP: Wait for ROC cancelled event on Auth Resp TX on another channel

Avoid potential race conditions with the driver operations between
cancelling an ongoing ROC that was used to receive Authentication
Request that requested a different channel to be used for the
negotiation by waiting for the ROC cancelled event before issuing the
offchannel TX command for the Authentication Response.

In addition, speed up the retry on Authentication Response in this type
of a case if the first attempt on the other channel is not AKC'ed since
it might take the peer device a bit more time to be ready to listen
there.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoBSS: Switch struct wpa_bss to use valid_links bitmask
Benjamin Berg [Tue, 20 Feb 2024 13:18:15 +0000 (14:18 +0100)] 
BSS: Switch struct wpa_bss to use valid_links bitmask

This aligns both the wpa_supplicant and bss structures to use the same
pattern of a valid_links bitmask plus per-link entries.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agonl80211: Remnove unused struct i802_link ctx
Benjamin Berg [Tue, 20 Feb 2024 13:18:14 +0000 (14:18 +0100)] 
nl80211: Remnove unused struct i802_link ctx

This was never used.

Fixes: 47269be36e61 ("nl80211: Refactor i802_bss to support multiple links")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agonl80211: Use valid_links bitmask for bss->links array
Benjamin Berg [Tue, 20 Feb 2024 13:18:14 +0000 (14:18 +0100)] 
nl80211: Use valid_links bitmask for bss->links array

Most places in the codebase use a valid_links bitmask with an array.
Switch the bss->links array to use the same design with the Link ID
being used as the array index instead of having a link_id inside.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoUse a single define MAX_NUM_MLD_LINKS for the maximum number of links
Jouni Malinen [Sat, 2 Mar 2024 09:21:48 +0000 (11:21 +0200)] 
Use a single define MAX_NUM_MLD_LINKS for the maximum number of links

There is no need to maintain a separate MAX_NUM_MLO_LINKS define for
practically the same thing.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoUse for_each_link() where possible
Benjamin Berg [Tue, 20 Feb 2024 13:18:13 +0000 (14:18 +0100)] 
Use for_each_link() where possible

This takes care of the places that the spatch did not catch already.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoUse for_each_link() in most cases
Benjamin Berg [Tue, 20 Feb 2024 13:18:12 +0000 (14:18 +0100)] 
Use for_each_link() in most cases

This was done using the below semantic patch. There are a few more
places that were missed due to variable declarations or additional
checks in the for loop.

@@
iterator name for_each_link;
identifier max_links =~ "MAX_NUM_MLD_LINKS|MAX_NUM_MLO_LINKS";
expression links;
expression further_tests;
identifier i;
statement stmt;
@@
-for (i = 0; i < max_links; i++)
+for_each_link(links, i)
 {
(
-  if (!(links & BIT(i)))
-    continue;
   ...
|
-  if (!(links & BIT(i)) || further_tests)
+  if (further_tests)
     continue;
   ...
|
-  if (further_tests || !(links & BIT(i)))
+  if (further_tests)
     continue;
   ...
|
-  if (links & BIT(i))
     stmt
|
-  if (further_tests && (links & BIT(i)))
+  if (further_tests)
     stmt
|
-  if ((links & BIT(i)) && further_tests)
+  if (further_tests)
     stmt
)
 }

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agocommon: Introduce for_each_link() macro
Benjamin Berg [Tue, 20 Feb 2024 13:18:11 +0000 (14:18 +0100)] 
common: Introduce for_each_link() macro

This is a simple macro iterating the given bitmask using the given
variable. Having the macro avoids the for loop-continuation making it
more readable overall.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agonl80211: Fix link indexing in nl80211_connect_common()
Benjamin Berg [Tue, 20 Feb 2024 13:18:10 +0000 (14:18 +0100)] 
nl80211: Fix link indexing in nl80211_connect_common()

In some places the wrong index variable was used to access the link
configuration. Fix this by simply using link_id instead of i.

With this, the i loop variable is not needed anymore. We can simply
always pass 0 to nla_nest_start(). Also, the kernel does not care about
the order that the links are provides, so just remove the special
handling for the association link.

Fixes: a2c4c0b1b6bb ("nl80211: Support MLD association request")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agonl80211: Explicitly differentiate between 5 GHz and 6 GHz modes
Ilan Peer [Tue, 20 Feb 2024 13:18:09 +0000 (14:18 +0100)] 
nl80211: Explicitly differentiate between 5 GHz and 6 GHz modes

When a device supports both the 5 GHz band and the 6 GHz band,
these are reported as two separate modes, both with mode set to
HOSTAPD_MODE_IEEE80211A. However, as these are different modes,
each with its own characteristics, e.g., rates, capabilities etc.,
specifically differentiate between them by adding a flag to indicate
whether the mode describes a 6 GHz band capabilities or not.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agotests: Add missing scan cache flush
Benjamin Berg [Tue, 20 Feb 2024 13:18:08 +0000 (14:18 +0100)] 
tests: Add missing scan cache flush

Otherwise a BSS from a previous test may still be in the cache.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
17 months agoP2P: Notify the IP address of the connected P2P Client
Sunil Ravi [Thu, 29 Feb 2024 01:36:40 +0000 (01:36 +0000)] 
P2P: Notify the IP address of the connected P2P Client

When wpa_supplicant assigns the IP address (WFA EAPOL IP address
allocation feature), the assigned IP address of the P2P Client on the GO
side is notified in the AP-STA-CONNECTED event. So to obtain the IP info
to external programs, modify the STA authorized event to include the the
assigned IP address of the P2P Client.

Test: Establish P2P connection and verified from the logs that
      the P2P Client IP address is notified.
Signed-off-by: Sunil Ravi <sunilravi@google.com>
17 months agoP2P: Disable pri/sec channel switch for GO with forced frequency
Sunil Ravi [Mon, 3 Oct 2022 00:53:41 +0000 (00:53 +0000)] 
P2P: Disable pri/sec channel switch for GO with forced frequency

When wpa_supplicant receives a request to start a P2P group owner on a
fixed frequency with bandwidth wider than 20 MHz, wpa_supplicant scans
for neighboring BSSs prior to starting the GO. This is done to switch
the primary/secondary channels if there are any other networks which are
operating on the same secondary channel. Though this logic is defined
for 20/40 MHz coexistence and might improve throughput, there are P2P
use cases where this logic causes problem:

1. The file transfer use case takes time to start the file transfer or
   even fails when the 20/40 coex scan repeatedly fails due to an
   ongoing externally triggered scan happening in the system.
2. wpa_supplicant overrides the channel which is selected by the
   application based on the best channel it derived by looking into
   the channel conditions. This degrades the expected throughput.
3. Latency sensitive applications experience long time to
   start the group owner which gives a bad user experience.

So do not allow 40 MHz co-ex PRI/SEC switch to force a change to
Autonomous GO PRI channel when the P2P group add is called with a forced
frequency.

Test: Tested autonomous GO and confirmed from the logs that
P2P GO is not triggering 20/40 coex scan.

Signed-off-by: Sunil Ravi <sunilravi@google.com>
17 months agotests: Make ap_wpa2_gtk_rekey_fail_1_sta more robust
Jouni Malinen [Thu, 29 Feb 2024 09:55:31 +0000 (11:55 +0200)] 
tests: Make ap_wpa2_gtk_rekey_fail_1_sta more robust

Slight differences in timing might make the final data connectivity
check fail, so disable the incorrect behavior first and wait for a
successfully completed GTK rekeying at the end before the final test.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agohostapd_cli: Indentation cleanup
Jouni Malinen [Wed, 28 Feb 2024 20:35:04 +0000 (22:35 +0200)] 
hostapd_cli: Indentation cleanup

Fix indentation level for some function parameters.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoAdd "stop_ap" command for hostapd_cli
Chenming Huang [Tue, 5 Dec 2023 07:40:38 +0000 (13:10 +0530)] 
Add "stop_ap" command for hostapd_cli

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
17 months agoAP MLD: Stop AP per link
Chenming Huang [Fri, 24 Nov 2023 08:18:59 +0000 (13:48 +0530)] 
AP MLD: Stop AP per link

For AP MLD cases, the link id is required to determine the correct link
to stop in the stop_ap() driver op.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
17 months agoAP MLD: Clean up disassoc handling for non-AP MLD link validity check
Jouni Malinen [Wed, 28 Feb 2024 20:16:09 +0000 (22:16 +0200)] 
AP MLD: Clean up disassoc handling for non-AP MLD link validity check

The check for the non-AP MLD link being valid can be done one level
outside the loop that tries to find a matching AP link.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoAP MLD: Handle disassociation notification with SME offload to driver
Chenming Huang [Thu, 28 Sep 2023 07:37:01 +0000 (13:07 +0530)] 
AP MLD: Handle disassociation notification with SME offload to driver

For non-AP MLDs, clear STA entry from all affiliated links.

For legacy non-MLO case, find association link to clear the STA entry.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
17 months agotests: RADIUS/TLS with FreeRADIUS
Jouni Malinen [Sun, 25 Feb 2024 18:45:54 +0000 (20:45 +0200)] 
tests: RADIUS/TLS with FreeRADIUS

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoRADIUS: Preliminary support RADIUS/TLS as an alternative to RADIUS/UDP
Jouni Malinen [Sun, 25 Feb 2024 15:15:01 +0000 (17:15 +0200)] 
RADIUS: Preliminary support RADIUS/TLS as an alternative to RADIUS/UDP

This adds initial parts for RADIUS/TLS support in the RADIUS client.
This can be used with eapol_test and hostapd. This functionality is not
included by default and CONFIG_RADIUS_TLS=y in .config can be used to
enable it.

This version does not yet include all the needed functionality for TLS
validation and the rules for dropping a TCP connection based on invalid
RADIUS attributes.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoRADIUS: Simplify IPv4/IPv6 socket handling in client
Jouni Malinen [Sun, 25 Feb 2024 15:49:40 +0000 (17:49 +0200)] 
RADIUS: Simplify IPv4/IPv6 socket handling in client

There is only one connection in use in parallel to a RADIUS
authentication server (and similarly to a RADIUS accounting server). As
such, there is not really any need to maintain separate open IPv4 and
IPv6 sockets. Instead, open the socket for the appropriate IP version
only when actually connecting to a specific server.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoRADIUS: Simplify radius_change_server() parameters
Jouni Malinen [Sun, 25 Feb 2024 15:25:15 +0000 (17:25 +0200)] 
RADIUS: Simplify radius_change_server() parameters

There is no need for passing the sock and sock6 parameters separately
since they were always the same values for auth == 0 or auth == 1 cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agol2_packet_freebsd: Fix macOS build
Jouni Malinen [Sat, 24 Feb 2024 16:29:57 +0000 (18:29 +0200)] 
l2_packet_freebsd: Fix macOS build

ETHER_VLAN_ENCAP_LEN does not seem to be defined in macOS
net/ethernet.h, so define that, if needed, to avoid build issues.

Fixes: 5b21f4861c2e ("l2_packet_freebsd: Enable receiving priority tagged (VID=0) frames")
Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoTDLS: Defer the start request until the discovery response RX for MLO
Kiran Kumar Lokere [Tue, 6 Feb 2024 23:57:53 +0000 (15:57 -0800)] 
TDLS: Defer the start request until the discovery response RX for MLO

When the station (non-AP MLD) is associated with an AP MLD the link ID
for TDLS setup is derived from the discovery response frame and the link
ID is used in TDLS setup operation when acting as initiator. The driver
sends the received discovery response frame followed by the TDLS setup
request event. But the discovery response frame is received after the
setup request event leading to use incorrect link ID value for TDLS
setup operation causing the setup failure. Process the TDLS setup
request if the discovery response frame is received, else defer the
process until the discovery response frame is received and process the
setup request after discovery response frame is processed.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoApply CHAN_SWITCH in all BSS for MBSSID case
Haribabu Krishnasamy [Thu, 25 Jan 2024 06:47:51 +0000 (12:17 +0530)] 
Apply CHAN_SWITCH in all BSS for MBSSID case

When the CHAN_SWITCH command is executed during multi BSSID case (say
BSS1, BSS2, and BSS3), if one of the BSS is disabled (say BSS2), the
CHAN_SWITCH command returns an error in BSS2 and does not proceed to the
next BSS (BSS3).

The CHAN_SWITCH command handler iterates over all configured BSSs and
attempts to send the switch_channel to each one. However, if any one of
the BSSs fails, the entire command is aborted and returns a failure.

Continue the iteration even if one BSS is failing to make sure the
configuration is applied to other BSSs.

Signed-off-by: Haribabu Krishnasamy <quic_hkr@quicinc.com>
17 months agotest: Clear country config param at the end of kernel_reg_disconnect
Jouni Malinen [Sun, 18 Feb 2024 09:03:55 +0000 (11:03 +0200)] 
test: Clear country config param at the end of kernel_reg_disconnect

This is needed to avoid causing issues for following test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
17 months agoAdd QCA_NL80211_VENDOR_SUBCMD_ADJUST_TX_POWER command
mukul sharma [Thu, 8 Feb 2024 07:47:29 +0000 (13:17 +0530)] 
Add QCA_NL80211_VENDOR_SUBCMD_ADJUST_TX_POWER command

During high battery voltage scenario, higher MCS data rate leads to poor
EVM accuracy which causes poor user experience. Hence to provide better
user experience, EVM accuracy needs to be improved by adjusting TX power
for MCS rate of specific band/radio chain. To achieve this, add a new
vendor command to configure required parameters in the WLAN driver.

Signed-off-by: Mukul Sharma <quic_mukul@quicinc.com>
17 months agoAdd QCA vendor attribute for BTM support configuration
Veerendranath Jakkam [Thu, 8 Feb 2024 09:11:08 +0000 (14:41 +0530)] 
Add QCA vendor attribute for BTM support configuration

Add a vendor attribute to configure BTM support in STA mode.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
17 months agotests: NAN USD
Jouni Malinen [Sun, 11 Feb 2024 17:10:08 +0000 (19:10 +0200)] 
tests: NAN USD

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoNAN: USD in hostapd
Jouni Malinen [Thu, 15 Feb 2024 15:41:05 +0000 (17:41 +0200)] 
NAN: USD in hostapd

Add hostapd support for interacting with the NAN discovery engine to
allow single-channel (i.e., the AP's operating channel) USD as Publisher
or Subscriber.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoNAN: USD in wpa_supplicant
Jouni Malinen [Sat, 10 Feb 2024 09:57:23 +0000 (11:57 +0200)] 
NAN: USD in wpa_supplicant

Add wpa_supplicant support for interacting with the NAN discovery engine
to allow USD as Publisher or Subscriber.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoNAN: Unsynchronized service discovery (USD)
Jouni Malinen [Sat, 10 Feb 2024 09:57:23 +0000 (11:57 +0200)] 
NAN: Unsynchronized service discovery (USD)

Add NAN discovery engine and wpa_supplicant interface to use it for the
subset of NAN functionality that is needed for USD.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoNAN: Protocol definitions
Jouni Malinen [Sat, 10 Feb 2024 08:58:01 +0000 (10:58 +0200)] 
NAN: Protocol definitions

Add NAN protocol definitions that are needed for USD based on Wi-Fi
Aware specification v4.0.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
17 months agoAdd os_reltime helpers to work with milliseconds
Jouni Malinen [Wed, 14 Feb 2024 19:42:35 +0000 (21:42 +0200)] 
Add os_reltime helpers to work with milliseconds

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>