Commit graph

19501 commits

Author SHA1 Message Date
Jouni Malinen
5b4a78b1f9 Optimize internal BSS table updates based on a specific BSSID
When wpa_supplicant needed to update the internal BSS table with the
latest scan results from the driver, it fetched all BSSs and processed
them all. This is unnecessary for cases where an update is needed only
for a specific BSS. Optimize this by filtering out the unnecessary
entries from the results.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-20 12:00:46 +02:00
Jouni Malinen
8d0bd7f9c8 Update BSS entry on roaming only for actual BSS frequency change
Commit 117e812d06 ("Update BSS table entry if roaming event indicates
frequency change") added wpa_supplicant BSS table update based on the
latest driver scan results whenever processing an association event that
results in the current operating channel changing. While that is needed
to cover the case where an AP changes its own operating channel (and
that is noticed as a roam or new connection instead of a channel switch
event), this should not really be needed for cases where the
wpa_supplicant entry for the new BSS is already up to date.

Skip the full BSS table update on association event if the event is for
a roaming case to a different BSS and the BSS entry for the target is
already available and for the current operating channel. This avoids
undesired latency when processing the association event.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-20 11:08:16 +02:00
Manoj Sekar
024d4bca13 Multi-AP: WPS support for different Multi-AP profiles
Update EAP-WSC parameters to include Multi-AP profile info to pass the
profile information through the provisioning steps. This is needed for
provisioning the STA configuration when different profiles are used.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 19:24:29 +02:00
Manoj Sekar
69d0862989 Multi-AP: Add support for VLAN related information
Add support to fill "multi_ap_vlanid" info to the hostapd config file.
Add the Multi-AP Default 802.1Q Setting subelement into Multi-AP element
generating and parsing.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 19:20:51 +02:00
Manoj Sekar
210c2b4bd7 Multi-AP: Add hostapd config option to disallow certain profiles
Add a new config option "multi_ap_client_disallow" to control allowing
backhaul STA with certain profiles alone to associate. This is done to
adhere to Wi-Fi EasyMesh specification which defined rules to
allow/disallow association of backhaul STA of certain profiles.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 19:11:27 +02:00
Manoj Sekar
9a1512532e Multi-AP: Reject non-Multi-AP STA association on backhaul-only BSS
Do not allow non-Multi-AP STAs to associate with a BSS that is
configured as a backhaul-only.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 18:57:38 +02:00
Manoj Sekar
420afbdbdf Multi-AP: Allow supported profile to be configured
Allow both hostapd and wpa_supplicant to be configured with the
supported Multi-AP profile. The configured value will be advertised in
the Multi-AP element.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 18:57:35 +02:00
Manoj Sekar
c3e5286537 Multi-AP: Parse Profile subelement
Parse the indicate profile support for the Multi-AP Profile subelement.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 18:55:14 +02:00
Manoj Sekar
0034112429 Multi-AP: Generation of Multi-AP Profile subelement
Add support for including the Multi-AP Profile subelement into the
Multi-AP element.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 18:53:45 +02:00
Manoj Sekar
364cb7c943 Multi-AP: Parse the Multi-AP element using a shared helper function
This makes it more convenient to handle extensions to the element and
allows code to be shared between hostapd and wpa_supplicant.

Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
2024-03-19 18:53:42 +02:00
Jouni Malinen
0e2ca2e4e2 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>
2024-03-19 16:45:41 +02:00
Manoj Sekar
61e46f860c 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>
2024-03-19 16:40:13 +02:00
Jouni Malinen
91b9786ced 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>
2024-03-17 19:55:11 +02:00
Jouni Malinen
ab719621b7 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>
2024-03-17 17:10:33 +02:00
Jouni Malinen
91282e29ff 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>
2024-03-17 15:39:54 +02:00
Jouni Malinen
3054112254 tests: Add missed test case __doc__ strings
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-03-17 15:21:11 +02:00
Jouni Malinen
caf0cda761 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>
2024-03-17 15:20:26 +02:00
Jouni Malinen
695277a5b3 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>
2024-03-09 18:08:52 +02:00
Jouni Malinen
541fa25246 tests: Use triple double quotes around docstrings more consistently
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-03-09 17:59:25 +02:00
Damien Dejean
2ae1e6f18b 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>
2024-03-09 17:59:22 +02:00
Damien Dejean
2ea04435ec 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>
2024-03-09 17:20:52 +02:00
Damien Dejean
d71c838519 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>
2024-03-09 17:16:27 +02:00
Damien Dejean
5eb409c4bc DBus: Add dict helper for uint16 arrays
Extend dict helper to support uint16 arrays.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
2024-03-09 17:05:29 +02:00
Chien Wong
a438e52933 OpenSSL: Fix a memory leak on hpke_labeled_expand() error path
Fixes: 786ea402bc ("HPKE base mode with single-shot API")
Signed-off-by: Chien Wong <m@xv97.com>
2024-03-08 10:43:52 +02:00
Chien Wong
b35b1036fe OpenSSL: Fix a memory leak on openssl_evp_pkey_ec_prime_len() error path
Fixes: b700a56e14 ("OpenSSL 3.0: Determine the prime length for an EC key group using EVP_PKEY")
Signed-off-by: Chien Wong <m@xv97.com>
2024-03-08 10:43:39 +02:00
Evan Benn
35df7ee09e 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>
2024-03-08 10:37:28 +02:00
Jouni Malinen
d8dca78a3a 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>
2024-03-08 10:37:28 +02:00
Aditya Kumar Singh
2986146d9c 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>
2024-03-08 10:26:34 +02:00
Johannes Berg
da833a7520 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>
2024-03-08 10:20:51 +02:00
Jouni Malinen
e625b46a9d Revert "tests: Remove eht_5ghz_80mhz_puncturing_override_1 for now"
This reverts commit eecaceed8f. 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>
2024-03-08 10:20:51 +02:00
Jouni Malinen
69dd408fb8 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>
2024-03-08 10:20:28 +02:00
Jouni Malinen
131ee59266 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>
2024-03-08 10:13:12 +02:00
Jouni Malinen
c96c3adc36 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>
2024-03-08 10:13:12 +02:00
Jouni Malinen
9f43c1e26b 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>
2024-03-08 10:01:30 +02:00
Jouni Malinen
47dad1ed16 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>
2024-03-08 10:00:35 +02:00
Jouni Malinen
eecaceed8f 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>
2024-03-06 22:38:09 +02:00
Jouni Malinen
010d8d10ed 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>
2024-03-06 22:34:57 +02:00
Jouni Malinen
0eb67e43bb 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>
2024-03-06 19:32:16 +02:00
Jouni Malinen
0a321d1733 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>
2024-03-06 17:38:08 +02:00
Jouni Malinen
40d5fecac2 Fix fuzzing test build
The commit that renamed the WNM BTM deallocation function forgot to
update the fuzz tester tool.

Fixes: e508c070c4 ("WNM: Keep BTM information until connection completes")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-05 17:24:50 +02:00
Jouni Malinen
27dac87b7c 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>
2024-03-05 17:24:50 +02:00
Jouni Malinen
c00abc69f2 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>
2024-03-05 17:01:30 +02:00
Jouni Malinen
9e90486bce 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: a92660a00e ("Work around Supported Operating Classes element issues for 6 GHz")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-05 16:24:35 +02:00
Jouni Malinen
460df51ed8 tests: Verify supported operating classes indication for 6 GHz
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-04 19:20:03 +02:00
Ainy Kumari
5dabc10185 Extend support for the 6 GHz operating class 137 (320 MHz)
Commit 085a3fc76e ("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>
2024-03-04 19:20:03 +02:00
Ainy Kumari
e74d95e0aa 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>
2024-03-04 19:20:03 +02:00
Jouni Malinen
59951ebf09 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>
2024-03-03 21:33:46 +02:00
Jouni Malinen
96f0af07e6 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>
2024-03-03 21:33:46 +02:00
Nikita Chernikov
6f285fbafc 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>
2024-03-03 21:33:46 +02:00
Michael-CY Lee
b653420a23 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>
2024-03-03 21:33:46 +02:00