]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
18 months agoSME: Handle PMF association comeback when not handled in driver
Harry Bock [Wed, 10 Jan 2024 19:09:09 +0000 (14:09 -0500)] 
SME: Handle PMF association comeback when not handled in driver

In associations using PMF (IEEE 802.11w/MFP), the infrastructure
implements SA teardown protection by rejecting an (Re)Association
Request frame from an already-associated client.  The AP responds with
error 30 (Association request rejected temporarily) to instruct the
(potentially spoofing) client to back off, while it issues an SA Query
procedure to the already-associated client. If the client can respond to
it within the back-off period, it considers the new association to be a
spoof attempt.

However, there are cases where a legitimate client might need to
handle this error response - consider if the STA has deauthenticated,
but the AP cannot hear it (out of range).  If the MFP STA has deleted
its keys, it cannot respond to the SA Query procedure.

This association comeback process has commonly been implemented in the
driver, e.g., within mac80211 in case of the Linux drivers that use SME
in userspace. However, there are drivers that do not implement this
functionality. Extended wpa_supplicant to cover such cases as well.

The current implementation interprets this association error as a true
error, and will either add the BSS to the list of ignored BSSIDs, or
continue to try other BSSes. This can cause wpa_supplicant to back off
trying to reconnect for progressively longer intervals, depending on the
infrastructure's configured comeback timeout.

Allow wpa_supplicant to interpret the error, searching for the Timeout
Interval element in the (Re)Association Response frame and starting a
timer in the SME layer to re-associate after the timeout. This can be a
long delay (1-4 seconds in my experience), but it is likely much shorter
than bouncing between nearby BSSes.

This does not change behavior for drivers that implement association
comeback timer internally since they do not report the temporary
association rejection status code to user space.

Signed-off-by: Harry Bock <hbock@zebra.com>
18 months agotests: Write more info and statistics in parallel-vm.log
Jouni Malinen [Sat, 20 Jan 2024 18:53:21 +0000 (20:53 +0200)] 
tests: Write more info and statistics in parallel-vm.log

This is helpful in tracking how the total test execution time changes.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoD-Bus: Add a signal for HS2.0 terms and conditions
Damien Dejean [Fri, 19 Jan 2024 15:52:54 +0000 (15:52 +0000)] 
D-Bus: Add a signal for HS2.0 terms and conditions

Add HS20TermsAndConditions signal to D-Bus API to allow clients to be
notified when the network requires the acceptance of terms and
conditions. The URL of the T&C page is provided as a signal parameter.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
18 months agowlantest: Do not decrease debug level for test vectors
Jouni Malinen [Sat, 20 Jan 2024 17:45:20 +0000 (19:45 +0200)] 
wlantest: Do not decrease debug level for test vectors

The CCMP PV1 test vector dropped debugging verbosity at the end. This
was not really supposed to be done since these test vectors are expected
to print at EXCESSIVE verbosity.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agowlantest: Add test vectors for S1G BIP
Henry Ptasinski [Thu, 11 Jan 2024 01:20:55 +0000 (17:20 -0800)] 
wlantest: Add test vectors for S1G BIP

- CMAC and GMAC modes
- 128-bit and 256-bit modes
- normal BIP and BIP using BCE
- test vectors with minimum and optional additional header elements in
  S1G beacon frames
- S1G Beacon Compatibility element in some cases, no other beacon body
   components

Signed-off-by: Henry Ptasinski <henry@e78com.com>
Signed-off-by: Andrew Pope <andrew.pope@morsemicro.com>
Signed-off-by: David Goodall <dave@morsemicro.com>
18 months agowlantest: Fix the cipher name in a BIP-GMAC-256 test vector
Henry Ptasinski [Thu, 11 Jan 2024 01:20:55 +0000 (17:20 -0800)] 
wlantest: Fix the cipher name in a BIP-GMAC-256 test vector

Signed-off-by: Henry Ptasinski <henry@e78com.com>
Signed-off-by: Andrew Pope <andrew.pope@morsemicro.com>
Signed-off-by: David Goodall <dave@morsemicro.com>
18 months agotests: FT with dynamic RxKHs configuration
Jouni Malinen [Sat, 20 Jan 2024 08:46:23 +0000 (10:46 +0200)] 
tests: FT with dynamic RxKHs configuration

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoFT: Add control interface command to show configured RxKHs
Dariusz Kopka [Mon, 15 Jan 2024 13:16:00 +0000 (14:16 +0100)] 
FT: Add control interface command to show configured RxKHs

The new GET_RXKHS control interface command can be used to list the
currently configured RxKHs.

Signed-off-by: Dariusz Kopka <dariusz@plume.com>
18 months agoFT: Add dynamic reload of RxKH definitions from file
Dariusz Kopka [Mon, 15 Jan 2024 13:16:00 +0000 (14:16 +0100)] 
FT: Add dynamic reload of RxKH definitions from file

hostapd reads the list of Rx Key Holders from hostapd.conf file.
However, for systems where topology changes dynamically, the update
of RxKHs list is required without reloading the whole configuration.

Introduce a new source of RxKH definition with original syntax:
- rxkh_file - Path to a file containing a list of RxKHs.

In addition, add a control interface command RELOAD_RXKHS to
reload RxKHs definition from the file specified in `rxkh_file`.

This allows hostapd to properly distribute Rx keys even after topology
change (assuming rxkh_file is updated and reload_rxkhs command issued).

Syntax of rxkh_file is the same as extraction of r0kh and r1kh options
from original hostapd.conf file.

```
r0kh=ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff
r0kh=ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff
r1kh=00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeef
r1kh=00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeef
r1kh=00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeef
```

Signed-off-by: Dariusz Kopka <dariusz@plume.com>
18 months agoFT: Move RxKH configuration clearing into a helper function
Dariusz Kopka [Mon, 15 Jan 2024 13:16:00 +0000 (14:16 +0100)] 
FT: Move RxKH configuration clearing into a helper function

This can be used as a shared function for reloading RxKHs at runtime.

Signed-off-by: Dariusz Kopka <dariusz@plume.com>
18 months agoFix building against OpenSSL 3
Jouke Witteveen [Mon, 15 Jan 2024 17:57:52 +0000 (18:57 +0100)] 
Fix building against OpenSSL 3

Smartcard support uses the ENGINE API of OpenSSL, which has been
deprecated as of OpenSSL 3. Rather than migrating the code to the new API
or pretending that we do not support OpenSSL 3, accept that we use
deprecated functionality.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
18 months agonl80211: Avoid NL80211_WPA_VERSION_3 on older kernel versions
Benjamin Berg [Wed, 17 Jan 2024 19:04:28 +0000 (20:04 +0100)] 
nl80211: Avoid NL80211_WPA_VERSION_3 on older kernel versions

NL80211_WPA_VERSION_3 was only added in kernel 5.2 so it should not be
set for older kernel versions.  There is no direct way to check if the
value is supported. However, we can use the new infrastructure to check
whether the kernel has the NL80211_ATTR_SAE_PASSWORD attribute. It is
related and was added at the same time.

Fixes: 6cc78b3945d3 ("nl80211: Set NL80211_WPA_VERSION_2 vs. _3 based on AKM")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: Use pgrep instead of ps
Benjamin Berg [Wed, 17 Jan 2024 18:02:31 +0000 (19:02 +0100)] 
tests: Use pgrep instead of ps

The ps command as shipped by busybox does not support the "command"
column. Change the code to use pgrep instead which will work fine in all
environments.

In addition, raise an exception if PID was not found since the test
would just hang with pid = 0.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agoRemove the MLD specific exception for distinguishing EAPOL-Key msg 2 and 4
Jouni Malinen [Tue, 16 Jan 2024 19:14:52 +0000 (21:14 +0200)] 
Remove the MLD specific exception for distinguishing EAPOL-Key msg 2 and 4

Now that we have a more advanced check for the differences within the
Key Data field, nonzero Key Data Length case can be determined to be
EAPOL-Key msg 4/4 if there is no RSNE in the Key Data field.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agotests: Encrypted Key Data field in EAPOL-Key msg 2/4 and 4/4
Jouni Malinen [Tue, 16 Jan 2024 19:12:43 +0000 (21:12 +0200)] 
tests: Encrypted Key Data field in EAPOL-Key msg 2/4 and 4/4

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agoTesting functionality for EAPOL-Key Key Data field encryption
Jouni Malinen [Tue, 16 Jan 2024 19:11:23 +0000 (21:11 +0200)] 
Testing functionality for EAPOL-Key Key Data field encryption

Allow the Key Data field to be encrypted in EAPOL-Key msg 2/4 and 4/4.
This is for testing purposes to enable a convenient mechanism for
testing Authenticator behavior with either potential future extensions
or unexpected Supplicant behavior.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agoSupport Key Data field decryption for EAPOL-Key msg 2/4 and 4/4
Jouni Malinen [Tue, 16 Jan 2024 19:05:13 +0000 (21:05 +0200)] 
Support Key Data field decryption for EAPOL-Key msg 2/4 and 4/4

Extend RSN authenticator to be able to process EAPOL-Key msg 2/4 and 4/4
messages in cases where the Key Data field is encrypted using AES key
wrapping (i.e., non-AEAD cipher). While there is not yet any defined
case where such encryption would be used in IEEE Std 802.11-2020,
extensions are considered to be added to use such constructions (e.g.,
in IEEE P802.11bh). As such, it is good to extend the parsing and
processing rules in the authenticator to be ready for such
functionality.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agotests: Extra element and KDE in EAPOL-Key msg 2/4 and 4/4
Jouni Malinen [Tue, 16 Jan 2024 14:04:40 +0000 (16:04 +0200)] 
tests: Extra element and KDE in EAPOL-Key msg 2/4 and 4/4

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agoSupplicant side testing functionality for EAPOL-Key Key Data field
Jouni Malinen [Tue, 16 Jan 2024 14:03:34 +0000 (16:03 +0200)] 
Supplicant side testing functionality for EAPOL-Key Key Data field

Allow additional elements and KDEs to be added to EAPOL-Key msg 2/4 and
4/4. This is for testing purposes to enable a convenient mechanism for
testing Authenticator behavior with either potential future extensions or
incorrect Supplicant behavior.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agoExtend mechanism to distinguish EAPOL-Key msg 2/4 from 4/4
Jouni Malinen [Tue, 16 Jan 2024 13:52:34 +0000 (15:52 +0200)] 
Extend mechanism to distinguish EAPOL-Key msg 2/4 from 4/4

The initial Authenticator implementation depended on the Key Data field
being empty for EAPOL-Key msg 4/4. This worked fine for years in
practice, but in theory, vendor specific elements or KDEs could have
been added inti EAPOL-Key msg 4/4 and that would have broken this
design. In addition, the MLD case did introduce a KDE into EAPOL-Key msg
4/4 and required changes here.

As an initial step to make this more robust for future extensions,
recognize a received EAPOL-Key message as msg 4/4 if it is for RSN
(i.e., not WPAv1), has Secure=1, contains an unencrypted Key Data field,
and does not include RSNE.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agotests: Supplicant protocol testing for EAPOL-Key msg 1/4 and 3/4
Jouni Malinen [Tue, 16 Jan 2024 11:06:49 +0000 (13:06 +0200)] 
tests: Supplicant protocol testing for EAPOL-Key msg 1/4 and 3/4

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agoAuthenticator side testing functionality for EAPOL-Key Key Data field
Jouni Malinen [Tue, 16 Jan 2024 11:04:59 +0000 (13:04 +0200)] 
Authenticator side testing functionality for EAPOL-Key Key Data field

Allow additional elements and KDEs to be added to EAPOL-Key msg 1/4 and
3/4 and allow EAPOL-Key msg 3/4 Key Data field to be not encrypted.
These are for testing purposes to enable a convenient mechanism for
testing supplicant behavior with either potential future extensions or
incorrect Authenticator behavior.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agotests: Make wpas_ap_wps more robust
Jouni Malinen [Sun, 14 Jan 2024 19:27:38 +0000 (21:27 +0200)] 
tests: Make wpas_ap_wps more robust

Avoid race conditions (especially with UML time travel) between AP
completion of 4-way handshake and traffic test.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoVerify center frequency seg0/seg1 mapping result before use
Jouni Malinen [Sun, 14 Jan 2024 18:21:26 +0000 (20:21 +0200)] 
Verify center frequency seg0/seg1 mapping result before use

Handle the center frequency to channel mapping more cleanly by skipping
the cases where the center frequencies are not set and verifying that
the mapping succeeds when they are set.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoInitialize the variables before using it in channel update
Baligh Gasmi [Fri, 12 Jan 2024 09:46:41 +0000 (10:46 +0100)] 
Initialize the variables before using it in channel update

seg0 and seg1 variables can have any initial value, but they may cause
the BSS to have a wrong configuration later on in cases where the
separate center frequencies are not set.

Signed-off-by: Baligh Gasmi <gasmibal@gmail.com>
18 months agotests: Longer association comeback time
Jouni Malinen [Sun, 14 Jan 2024 19:00:14 +0000 (21:00 +0200)] 
tests: Longer association comeback time

Verify functionality with 10000 TU comeback time in addition to the
hostapd default of 1000 TU.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoP2P: Fix a logical error of workaround of extended listen failure
朱海 [Thu, 11 Jan 2024 07:49:00 +0000 (15:49 +0800)] 
P2P: Fix a logical error of workaround of extended listen failure

When p2p->state == P2P_LISTEN_ONLY, the statement before it
'p2p->cfg->is_p2p_in_progress(p2p->cfg->cb_ctx)' will be true, too, so
this function will print a message "Operation in progress" and return;
the workaround to handle listen failure will be never reached.

I met such an error when the 'remain-on-channel' command failed, then
the function p2p_ext_listen_timeout() just printed 'Operation in
progress' again and again, and the listen operation was not started
anymore.

Fixes: 0f1034e3889e ("P2P: Refrain from performing extended listen during P2P connection")
Signed-off-by: zhuhai <zhuhai.mail@163.com>
18 months agoGet rid of multiple MIN macros
Andrei Otcheretianski [Wed, 10 Jan 2024 14:50:27 +0000 (16:50 +0200)] 
Get rid of multiple MIN macros

There are multiple redundant MIN macro declarations, some of which are
not protecting against side effects. Move it to common.h instead.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agoApply a symmetrical bias against moving away from higher bands
Matthew Wang [Thu, 28 Dec 2023 21:03:43 +0000 (21:03 +0000)] 
Apply a symmetrical bias against moving away from higher bands

There is currently a bias towards moving to higher bands but not one
against moving away from them. Fix that.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
18 months agoDecrease cross-threshold roam difficulty with bgscan_simple
Matthew Wang [Thu, 28 Dec 2023 21:03:42 +0000 (21:03 +0000)] 
Decrease cross-threshold roam difficulty with bgscan_simple

Decrease the roam difficulty when roaming across the short background
scan threshold (i.e., when the current BSS RSSI is below the threshold
and the selected BSS RSSI is above the threshold). This tends to happen
in normal roaming scenarios when moving from the domain of one AP to
the domain of another.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
18 months agotests: Make ACS tests more reliable
Jouni Malinen [Sun, 14 Jan 2024 17:42:23 +0000 (19:42 +0200)] 
tests: Make ACS tests more reliable

The test cases that used country code ZA for the actual test on the 5
GHz band ended up failing in some cases due to various race conditions
with the initial AP start on the 5 GHz band using country code US.
Reduce the risk for that type of failures by using the same country code
ZA for both AP starts.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agotests: Add a test for kernel KUnit tests
Johannes Berg [Wed, 3 Jan 2024 13:58:21 +0000 (14:58 +0100)] 
tests: Add a test for kernel KUnit tests

Add a test that runs the cfg80211/mac80211 kunit tests (they must be
built as modules to run at this point), and checks the results. The test
is skipped if all the modules fail to load.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowpa_supplicant: Do not invalidate PMKSA cache for bssid_* updates
Benjamin Berg [Thu, 28 Dec 2023 13:19:24 +0000 (15:19 +0200)] 
wpa_supplicant: Do not invalidate PMKSA cache for bssid_* updates

These updates do not cause the PMKSA cache to become invalid. As such,
allow setting any of bssid_hint, bssid_ignore, and bssid_accept without
clearing the cache and causing the current connection to be dropped
immediately.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agoMLD: Fail connection if ML Authentication frame could not be parsed
Benjamin Berg [Thu, 28 Dec 2023 13:19:23 +0000 (15:19 +0200)] 
MLD: Fail connection if ML Authentication frame could not be parsed

If the Authentication frame response did not contain the expected ML
element (or it was invalid), we cannot continue with the ML association.
As such, the only choice we have in this case is to abort the
association.

If we do continue, we would end up sending the Association Request frame
with our MLD MAC address.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agoMLD: Read the correct BSSID from the RNR
Benjamin Berg [Thu, 28 Dec 2023 13:19:22 +0000 (15:19 +0200)] 
MLD: Read the correct BSSID from the RNR

The previous implementation would find the correct TBTT record in the
RNR but then always copied the BSSID from the first record out. Fix this
to copy the BSSID from the current position.

Fixes: de5e01010cb2 ("wpa_supplicant: Support ML probe request")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agoRRM: Handle scan TSF BSSID matching in context of MLD
Ilan Peer [Thu, 28 Dec 2023 13:19:21 +0000 (15:19 +0200)] 
RRM: Handle scan TSF BSSID matching in context of MLD

Compare the BSSID against the BSSIDs on the affiliated APs for which
there is a valid link in case of an ML association.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agonl80211: Print driver name in debug output
Jouni Malinen [Sun, 14 Jan 2024 15:32:22 +0000 (17:32 +0200)] 
nl80211: Print driver name in debug output

This can be helpful in debugging some driver specific issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agonl80211: Print kernel version in debug output
Jouni Malinen [Sun, 14 Jan 2024 15:18:57 +0000 (17:18 +0200)] 
nl80211: Print kernel version in debug output

This can be helpful in debugging some kernel specific issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agonl80211: Avoid sending unsupported attributes
Benjamin Berg [Thu, 28 Dec 2023 13:14:06 +0000 (15:14 +0200)] 
nl80211: Avoid sending unsupported attributes

The kernel will reject commands if newer attributes are included even
though they should not be. Add appropriate checks in set_ap().

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agonl80211: Retrieve maxattr via genl for nl80211
Benjamin Berg [Thu, 28 Dec 2023 13:14:05 +0000 (15:14 +0200)] 
nl80211: Retrieve maxattr via genl for nl80211

Older kernel versions may not support all attributes and may refuse
commands that include them. To avoid sending too new attributes query
the highest supported attribute. This allows adding appropriate checks
where needed.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agonl80211: Pass wiphy events to all affected interfaces
Benjamin Berg [Thu, 28 Dec 2023 13:12:48 +0000 (15:12 +0200)] 
nl80211: Pass wiphy events to all affected interfaces

Previously, we would only pass the event to the first interface that
matches. However, one wiphy can have multiple interfaces and each one
needs to get the event delivered. Without this, it could e.g. happen
that a radar detection event is forwarded to p2p-dev-wlan0 and not to
the wlan0 interface which actually needs it.

As such, keep iterating if we are processing a wiphy match and send the
event to all affected BSSs.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: Increase timeout for dpp_qr_code_auth_broadcast
Jouni Malinen [Sun, 14 Jan 2024 10:44:15 +0000 (12:44 +0200)] 
tests: Increase timeout for dpp_qr_code_auth_broadcast

This allows another initiation round to be executed if the first
broadcast frame fails to get through.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoDPP: Work arouind missing Auth Confirm ACK for testing
Jouni Malinen [Sun, 14 Jan 2024 10:10:04 +0000 (12:10 +0200)] 
DPP: Work arouind missing Auth Confirm ACK for testing

The dpp_test DPP_TEST_STOP_AT_AUTH_CONF case is supposed to prevent the
GAS exchange from happening. It was possible to bypass that testing
functionality if the TX status event for the Authentication Confirm
message was lost or delayed long enough for the GAS Request to be
proessed first. This could happen at least with UML time travel.

Work around this by checking for the special dpp_test case within GAS
request handling.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agotests: Add couple of MBO and RRM tests with MLD
Ilan Peer [Tue, 26 Dec 2023 13:30:16 +0000 (15:30 +0200)] 
tests: Add couple of MBO and RRM tests with MLD

To validate correct operation when configured as MLD.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agoRRM: Fix the parsing of the Extended Request subelement in beacon req
Ilan Peer [Tue, 26 Dec 2023 13:30:15 +0000 (15:30 +0200)] 
RRM: Fix the parsing of the Extended Request subelement in beacon req

The Extended Request subelement of a Beacon Request is expected to also
include the Requested Element ID field (that identifies the Element ID
used to indicated extended elements) which needs to be skipped to get
the Requested Element ID Extensions.

Fixes: 2d4f905214b7 ("RRM: Add support for including extended ID elements in beacon report")
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agotests: Extend MSCS testing
Daniel Gabay [Tue, 26 Dec 2023 09:45:25 +0000 (11:45 +0200)] 
tests: Extend MSCS testing

Add tests for new response handling logic:
1. Verify MSCS change response handling in association / action frame.
2. Verify MSCS unsolicited response handling.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
18 months agotests: Refactor MSCS
Daniel Gabay [Tue, 26 Dec 2023 09:45:24 +0000 (11:45 +0200)] 
tests: Refactor MSCS

Add helper functions for common logic.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
18 months agoMSCS: Process unsolciited MSCS Response frames
Daniel Gabay [Tue, 26 Dec 2023 09:45:23 +0000 (11:45 +0200)] 
MSCS: Process unsolciited MSCS Response frames

Align MSCS response handling as described in IEEE P802.11-REVme/D4.0,
11.25.3 (MSCS procedures):

AP may send unsolicited MSCS Response frame using dialog_token == 0.
Instead of dropping the frame due to dialog_token mismatch, accept
it and set the status accordingly.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
18 months agoMSCS: Extend MSCS response handling
Daniel Gabay [Tue, 26 Dec 2023 09:45:23 +0000 (11:45 +0200)] 
MSCS: Extend MSCS response handling

Align MSCS response handling as described in IEEE P802.11-REVme/D4.0,
11.25.3 (MSCS procedures):

If an MSCS Descriptor element is present in a MSCS Response
frame that does not indicate a status of "SUCCESS", the request
type field is set to "change" - the element indicates a suggested
set of parameters that could be accepted by the AP in response to a
subsequent request by the non-AP STA.

Handle both MSCS Response frame and (Re)Association Response frame with
change request by extending WPA_EVENT_MSCS_RESULT with the change
values.

Note: since we extend MSCS_RESULT event, move the original event from
both MSCS Response frame and (Re)Association Response frame handlers to
a common function that handles now both 'change' and other response.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
18 months agoMSCS: Use a define for the MSCS Descriptor element fixed field length
Jouni Malinen [Sun, 14 Jan 2024 09:06:06 +0000 (11:06 +0200)] 
MSCS: Use a define for the MSCS Descriptor element fixed field length

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agotests: Allow more time for dpp_qr_code_no_chan_list_broadcast
Jouni Malinen [Sat, 13 Jan 2024 22:21:57 +0000 (00:21 +0200)] 
tests: Allow more time for dpp_qr_code_no_chan_list_broadcast

It looks like the first broadcast frame might be missed in some cases,
so increase the timeout here to allow another round of frames to be
attempted.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agotests: Skip test cases that need FILS if CONFIG_FILS=y was not used
Jouni Malinen [Sat, 13 Jan 2024 21:48:38 +0000 (23:48 +0200)] 
tests: Skip test cases that need FILS if CONFIG_FILS=y was not used

fils_offload_to_driver2 and wpas_config_file_key_mgmt require
CONFIG_FILS=y, but they did not use check_fils_capa().

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoUse ether_addr_equal() to compare whether two MAC addresses are equal
Jouni Malinen [Sat, 13 Jan 2024 21:15:36 +0000 (23:15 +0200)] 
Use ether_addr_equal() to compare whether two MAC addresses are equal

This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:

@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoWPS: Fix authorized MAC removal
Jouni Malinen [Sat, 13 Jan 2024 21:11:08 +0000 (23:11 +0200)] 
WPS: Fix authorized MAC removal

Missing array referencing ended up only the first entry in the list to
be compared.

Fixes: 31fcea931d91 ("WPS 2.0: Add support for AuthorizedMACs attribute")
Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoIntroduce ether_addr_equal()
Jouni Malinen [Sat, 13 Jan 2024 21:05:52 +0000 (23:05 +0200)] 
Introduce ether_addr_equal()

This makes a code more readable for the large number of cases that use
os_memcmp() to check whether two ethernet addresses are equal.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoRSN: Fix (B)IGTK MLO KDE length print
Andrei Otcheretianski [Wed, 10 Jan 2024 15:31:04 +0000 (17:31 +0200)] 
RSN: Fix (B)IGTK MLO KDE length print

Array pointer was mistakenly printed instead of actual length.
Fix it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agowpa_supplicant: Don't assign pointer to bool
Andrei Otcheretianski [Wed, 10 Jan 2024 12:33:59 +0000 (14:33 +0200)] 
wpa_supplicant: Don't assign pointer to bool

As it may result in compilation error.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agoFix compiler warnings on supplicant build with PASN but no FILS
Jouni Malinen [Sat, 13 Jan 2024 20:49:13 +0000 (22:49 +0200)] 
Fix compiler warnings on supplicant build with PASN but no FILS

Get rid of unused variables and functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoAP: Fix compilation warning in hapd_pasn_update_params()
Andrei Otcheretianski [Wed, 10 Jan 2024 12:02:48 +0000 (14:02 +0200)] 
AP: Fix compilation warning in hapd_pasn_update_params()

If CONFIG_FILS isn't set, the compiler complains about unused variables.
Fix it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agobuild: bgscan_simple depends on WNM
Chien Wong [Fri, 5 Jan 2024 09:50:58 +0000 (17:50 +0800)] 
build: bgscan_simple depends on WNM

Fix build of wpa_supplicant if bgscan_simple is enabled while
WNM is not, as in the defconfig.

Fixes: ceb7f65dcc94 ("bgscan: Allow simple bgscan to do BTM queries")
Signed-off-by: Chien Wong <m@xv97.com>
18 months agotrace: Fix compilation issue due to using an undefined symbol
Jintao Lin [Thu, 4 Jan 2024 22:05:39 +0000 (22:05 +0000)] 
trace: Fix compilation issue due to using an undefined symbol

Fix commit 5545d995b3 which could use undefined symbol
testing_fail_alloc() in os_malloc() if CONFIG_WPA_TRACE=y is used
without CONFIG_WPA_TRACE_BFD=y.

Fixes: 5545d995b3d5 ("trace: Share common implementation for TEST_FAIL and TEST_ALLOC_FAIL")
Signed-off-by: Jintao Lin <jintaolin@chromium.org>
18 months agoAP: Fix a typo in function name
Ilan Peer [Tue, 26 Dec 2023 09:06:25 +0000 (11:06 +0200)] 
AP: Fix a typo in function name

Rename hostpad_dfs_update_background_chain() to
hostapd_dfs_update_background_chain().

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agomesh: Set the mld_link_id to -1 when adding a station
Benjamin Berg [Tue, 26 Dec 2023 09:06:24 +0000 (11:06 +0200)] 
mesh: Set the mld_link_id to -1 when adding a station

As otherwise the mld_link_id would be 0, which the driver would
consider a valid link id and would return an error.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agonl80211: Fix AP MLD MAC address on auth retry
Johannes Berg [Tue, 26 Dec 2023 08:29:46 +0000 (10:29 +0200)] 
nl80211: Fix AP MLD MAC address on auth retry

The AP MLD MAC address is meant to be preserved here, but since it's
reset to zeroes before attempting to authenticate in
nl80211_mark_disconnected(), we can't just point to the AP MLD MAC
address in drv->auth_ap_mld_addr. Fix it by using a copy.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agotests: Add MLD tests for deauthentication and disassociation
Ilan Peer [Mon, 25 Dec 2023 17:43:03 +0000 (19:43 +0200)] 
tests: Add MLD tests for deauthentication and disassociation

Verifying that the station can successfully associate again
after being deauthenticated or disassociated.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agoAP MLD: Remove link stations on a new station authentication
Ilan Peer [Mon, 25 Dec 2023 17:43:02 +0000 (19:43 +0200)] 
AP MLD: Remove link stations on a new station authentication

When a station tries to authenticate to an AP that is affiliated with an
AP MLD, we need to remove all station instances from all the APs.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agoAP: Support deauthenticate/disassociate with MLD
Ilan Peer [Mon, 25 Dec 2023 17:43:01 +0000 (19:43 +0200)] 
AP: Support deauthenticate/disassociate with MLD

When requested to deauthenticate/disassociate a station also handle the
corresponding MLD stations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agoAP: Move hostapd_ml_get_assoc_sta() to shared
Ilan Peer [Mon, 25 Dec 2023 17:43:00 +0000 (19:43 +0200)] 
AP: Move hostapd_ml_get_assoc_sta() to shared

So it could be used from different contexts.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agoAP MLD: Fix station lookup in hostapd_ml_get_assoc_sta()
Ilan Peer [Mon, 25 Dec 2023 17:42:59 +0000 (19:42 +0200)] 
AP MLD: Fix station lookup in hostapd_ml_get_assoc_sta()

If the station is not an MLO station do not attempt to find the
association station and return false in the ML specific disconnection
processing.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agoAP: Unify code handling deauthentication/disassociation
Ilan Peer [Mon, 25 Dec 2023 17:42:58 +0000 (19:42 +0200)] 
AP: Unify code handling deauthentication/disassociation

This avoids unnecessary code duplication and adds the sta->wpa_sm deinit
calls for deauthentication while it was previously done only in the
disassociation case.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 months agotests: Run kmemleak between tests if available
Benjamin Berg [Mon, 25 Dec 2023 10:21:09 +0000 (12:21 +0200)] 
tests: Run kmemleak between tests if available

This triggers a kmemleak scan between tests. This allows finding memory
leaks and doing this should attribute the leak to the correct test in
most cases. Note that it does add a sleep after each test, as such it is
most sensible when combined with UML time-travel.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: P2P: Also wait in go_neg_pbc()
Johannes Berg [Mon, 25 Dec 2023 10:21:08 +0000 (12:21 +0200)] 
tests: P2P: Also wait in go_neg_pbc()

Similar to other changes like this, wait a bit before
connectivity checks in go_neg_pbc().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agotests: ap_vht_40: wait a bit before connectivity check
Johannes Berg [Mon, 25 Dec 2023 10:21:07 +0000 (12:21 +0200)] 
tests: ap_vht_40: wait a bit before connectivity check

We need the station to be fully set up on the AP before
running the connectivity check, not just the station to
be set up itself. Just waiting for the events seems to
still be racy so just sleep a little bit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agotests: Optimize process memory reading using join
Benjamin Berg [Mon, 25 Dec 2023 10:21:06 +0000 (12:21 +0200)] 
tests: Optimize process memory reading using join

Appending to a bytes() object is rather inefficient. As such, avoid
doing so by first creating a list and then joining all buffers together
at the end only.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agobuild: Properly grab the libpcsclite cflags
Benjamin Berg [Mon, 25 Dec 2023 10:21:05 +0000 (12:21 +0200)] 
build: Properly grab the libpcsclite cflags

We should be grabbing the include directory using pkg-config and not
just the libs. Without this, the header file might not be found on all
systems because it may not be in /usr/include but elsewhere in the
system.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agoDisable _FORTIFY_SOURCE when building with -O0
Andrei Otcheretianski [Mon, 25 Dec 2023 10:21:04 +0000 (12:21 +0200)] 
Disable _FORTIFY_SOURCE when building with -O0

_FORTIFY_SOURCE requires at least -O2 optimization level.
This may result in compilation warnings. Fix it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agotests: Flag inside VM using an environment variable
Benjamin Berg [Mon, 25 Dec 2023 10:21:03 +0000 (12:21 +0200)] 
tests: Flag inside VM using an environment variable

It is possible to execute the tests directly inside the a VM without
necessarily running the repository wrapper script to do so. In these
cases, passing the VM flag using an environment variable allows
correctly flagging this fact to the tests.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: Stop wpa_supplicant AP at end of VHT 80 MHz (US) test
Benjamin Berg [Mon, 25 Dec 2023 10:21:02 +0000 (12:21 +0200)] 
tests: Stop wpa_supplicant AP at end of VHT 80 MHz (US) test

The regulatory domain cannot be reset while the AP is still active. Add
the appropriate commands to bring down the AP after the test, which will
also make resetting the regulatory domain work.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: Write services needed for pyrad
Benjamin Berg [Mon, 25 Dec 2023 10:21:00 +0000 (12:21 +0200)] 
tests: Write services needed for pyrad

pyrad does an internal call to getaddrinfo with the service "www".
Make sure this service is known by writing an appropriate
/etc/services file.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: Explicitly set address to bind to
Benjamin Berg [Mon, 25 Dec 2023 10:20:59 +0000 (12:20 +0200)] 
tests: Explicitly set address to bind to

pyrad internally uses socket.getaddrinfo. While it is documented that
one can pass an empty string to bind to all interfaces. The underlying
function expects None instead though, breaking the call.

Either way, it does not hurt to set the bind address to 127.0.0.1
explicitly, so do so to avoid issues.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agotests: Strip trailing space from ip output
Benjamin Berg [Mon, 25 Dec 2023 10:20:58 +0000 (12:20 +0200)] 
tests: Strip trailing space from ip output

It seems that the messages from ip may have a trailing space in some
cases, which may break matching in surrounding logic. Strip the output
to remove whitespace and avoid any issues this may cause.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
18 months agoAP MLD: Correctly set the BSS parameters change count in RNR
Ilan Peer [Mon, 25 Dec 2023 09:57:09 +0000 (11:57 +0200)] 
AP MLD: Correctly set the BSS parameters change count in RNR

Set the current value instead of hardcoded 1.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
18 months agotests: DPP responder while ML associated
Jouni Malinen [Sat, 13 Jan 2024 17:39:14 +0000 (19:39 +0200)] 
tests: DPP responder while ML associated

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agonl80211: Add NL80211_ATTR_MLO_LINK_ID for NL80211_CMD_REMAIN_ON_CHANNEL
Hu Wang [Mon, 8 Jan 2024 10:14:38 +0000 (10:14 +0000)] 
nl80211: Add NL80211_ATTR_MLO_LINK_ID for NL80211_CMD_REMAIN_ON_CHANNEL

cfg80211 requires the link ID to be specified for requests to start a
remain-on-channel operation during an ML association. This feels wrong
since the ROC operation is in most cases unrelated to the
association. However, that requirement has been in place since kernel
commit 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link
APIs") from April 2022, and as such, it looks necessary to have
wpa_supplicant work around this by specifying the currently used link ID
that would seem to match the ROC channel most closely.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
18 months agotests: GAS/ANQP during MLO association
Jouni Malinen [Sat, 13 Jan 2024 10:25:47 +0000 (12:25 +0200)] 
tests: GAS/ANQP during MLO association

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoGAS: Accept GAS response using AP MLD MAC address
Jouni Malinen [Sat, 13 Jan 2024 10:22:01 +0000 (12:22 +0200)] 
GAS: Accept GAS response using AP MLD MAC address

The GAS request may have been issued using a link address of the AP
MLD's affiliated link and the driver may translate that address to the
MLD MAC address when associated with the AP MLD. Accept GAS responses
where the addresses map to the same AP MLD.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoExtend pmf_in_use() to be aware of affiliated links on non-AP MLD
Jouni Malinen [Sat, 13 Jan 2024 10:24:00 +0000 (12:24 +0200)] 
Extend pmf_in_use() to be aware of affiliated links on non-AP MLD

The target MAC address needs to be checked against all the AP MLD link
addresses and the MLD MAC address to cover all possible cases. This is
needed to be able to correctly use Protected Dual of Public Action
frames during an ML association.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agonl80211: More detailed debug print for Management frame TX
Jouni Malinen [Sat, 13 Jan 2024 10:21:12 +0000 (12:21 +0200)] 
nl80211: More detailed debug print for Management frame TX

Print all three addresses to make it easier to debug issues with
Management frame sending.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoAP MLD: MLD address conversion for hostapd_drv_send_action_addr3_ap()
Jouni Malinen [Sat, 13 Jan 2024 10:19:12 +0000 (12:19 +0200)] 
AP MLD: MLD address conversion for hostapd_drv_send_action_addr3_ap()

Commit 31e025c033f3 ("AP: When sending Action frames, use the AP MLD MAC
address if needed") added this for hostapd_drv_send_action(), but the
A3=BSSID variant of that function needs similar changes for GAS to work
correctly with STAs that are currently associated with MLO.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoAP MLD: Fix Association Response frame ACK handling
Jouni Malinen [Sat, 13 Jan 2024 10:16:51 +0000 (12:16 +0200)] 
AP MLD: Fix Association Response frame ACK handling

Invert the check on hapd->conf->mld_ap on the affiliated links to
actually call the link specific callback handler. This is needed to set
the STA associated.

Fixes: 55038680a606 ("AP: MLO: Handle association callback")
Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoAP MLD: Prefer STA entry that has sta->wpa_sm initialized
Jouni Malinen [Sat, 13 Jan 2024 17:07:10 +0000 (19:07 +0200)] 
AP MLD: Prefer STA entry that has sta->wpa_sm initialized

This is needed to allow RSN operations, like PTK rekeying, to be
completed on the correct STA entry. The previous design worked by
accident since it was using the WLAN_STA_ASSOC flag and the code that
was supposed to set that flag did not work correctly and left it unset
for the interfaces that were not used for the initial 4-way handshake.
That needs to be fixed, so this search need to be extended to be able to
prefer the STA entry that has sta->wpa_sm set instead of just the
WLAN_STA_ASSOC flag.

Signed-off-by: Jouni Malinen <j@w1.fi>
18 months agoAdd QCA vendor command for flow policy configuration
Nirav Shah [Fri, 22 Dec 2023 06:40:25 +0000 (12:10 +0530)] 
Add QCA vendor command for flow policy configuration

Define subcmd ID 239 for flow policy configuration.

Signed-off-by: Nirav Shah <quic_nnshah@quicinc.com>
19 months agoAP: Fix a regression in indoor 6 GHz AP determination
Jouni Malinen [Thu, 4 Jan 2024 09:04:20 +0000 (11:04 +0200)] 
AP: Fix a regression in indoor 6 GHz AP determination

The change to use a helper function for checking he_6ghz_reg_pwr_type
missed the difference between two types of checks for different values:
indoor AP vs. SP AP. Fix this by introducing another helper function to
cover the indoor (i.e., SP and non-SP indoor cases).

Fixes: 121ccadeb44c ("AP: A helper function for determining whether the AP is an SP AP")
Signed-off-by: Jouni Malinen <j@w1.fi>
19 months agoLimit throughput estimation for HE 80/160 MHz based on VHT info
Jouni Malinen [Sat, 23 Dec 2023 15:39:41 +0000 (17:39 +0200)] 
Limit throughput estimation for HE 80/160 MHz based on VHT info

The current operating channel bandwidth in an HE BSS is determined with
the combination of elements, include the VHT Operation element. Use VHT
Operation element to check whether the 80, 80+80, and 160 MHz cases are
enabled if the AP claims to be capable of operating an 80/160 MHz BSS.

Signed-off-by: Jouni Malinen <j@w1.fi>
19 months agoLimit throughput estimation for HE 40 MHz based on HT info
Jouni Malinen [Sat, 23 Dec 2023 15:30:18 +0000 (17:30 +0200)] 
Limit throughput estimation for HE 40 MHz based on HT info

The current operating channel bandwidth in an HE BSS is determined with
the combination of elements, include the HT Operation element. Use HT
Operation element to check whether the 40 MHz case is enabled if the AP
claims to be capable of operating a 40 MHz BSS.

Signed-off-by: Jouni Malinen <j@w1.fi>
19 months agotests: Enable full testing for ACS with VHT160
Jouni Malinen [Sat, 23 Dec 2023 14:44:30 +0000 (16:44 +0200)] 
tests: Enable full testing for ACS with VHT160

This is now supported in hostapd, so drop the option to fail to start
the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
19 months agotests: Automatic channel selection for EHT320
Jouni Malinen [Sat, 23 Dec 2023 14:37:55 +0000 (16:37 +0200)] 
tests: Automatic channel selection for EHT320

Signed-off-by: Jouni Malinen <j@w1.fi>
19 months agoACS: Extend the 320 MHz support
Michael-CY Lee [Fri, 22 Dec 2023 04:59:11 +0000 (12:59 +0800)] 
ACS: Extend the 320 MHz support

There are bandwidth 320 MHz-1 and 320 MHz-2 channelization in EHT mode.
When using ACS, user might prefer one of the channelization or both, but
original ACS was unable to take such preference.

Another problem is that the original ACS returns only the ideal channel
but no 320 MHz channelization. The function acs_get_bw_center_chan()
also could not correctly return the center frequency of bandwidth 320
MHz that is decided by ACS.

For example, if ACS decide the ideal channel is channel 37 with
channelization 320 MHz-2 (center frequency 6265 MHz),
acs_get_bw_center_chan() returns 6105 MHz, which is 320 MHz-1.

Extend the support for 320 MHz so that ACS can choose the best channel
according to the user's preference. Also, after calling
acs_find_ideal_chan_mode(), the best channel and bandwidth can be
derived.

The changes are:
- bw_type ACS_BW320 is divided into ACS_BW320_1 and ACS_BW320_2
- in bandwidth 320 MHz, find the best channel and bandwidth according to
  user's perference (320 MHz-1, 320 Mhz-2 or both are OK)
- before acs_find_ideal_chan_mode() returns, update bw320_offset in
  iface->conf so that the best channel's channelization is recorded.
- get the best center frequency from bw320_offset

Co-developed-by: Money Wang <money.wang@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
19 months agohostapd: Add eht_bw320_offset configuration option
Michael-CY Lee [Fri, 22 Dec 2023 04:59:10 +0000 (12:59 +0800)] 
hostapd: Add eht_bw320_offset configuration option

Introduce a new configuration option, "eht_bw320_offset", which enables
devices to specify a preferred channelization for 320 MHz BSSs when
using automatic channel selection (ACS). This option is applicable only
when the channel is not already decided and the bandwidth is set to 320
MHz.

The value and meaning of the option:
0: auto-detected by ACS
1: 320 MHz-1
2: 320 MHz-2

Co-developed-by: Money Wang <money.wang@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
19 months agoACS: Fix not selecting the best channel in the segment
Michael-CY Lee [Fri, 22 Dec 2023 04:59:09 +0000 (12:59 +0800)] 
ACS: Fix not selecting the best channel in the segment

Fix the following bugs about selecting the best channels in the segment:
1. If the 'update_best' once became false, it never becomes true again.
   In other word, if one of the channels in the segment is not usable,
   the remaining channels in the segment were never able to be the best
   channel.
2. The primary channel in the segment might not be usable due to the
   insufficient survey data. Therefore, it cannot be the best channel and
   we cannot take its factor/weight into account.

Co-developed-by: Money Wang <money.wang@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>