Commit graph

19695 commits

Author SHA1 Message Date
Jouni Malinen
689a248260 eapol_test: Move Message-Authenticator attribute to be the first one
Even if this is not strictly speaking necessary for mitigating certain
RADIUS protocol attacks, be consistent with the RADIUS server behavior
and move the Message-Authenticator attribute to be the first attribute
in the message from RADIUS client.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-09 14:58:39 +03:00
Jouni Malinen
54abb0d3cf RADIUS server: Place Message-Authenticator attribute as the first one
Move the Message-Authenticator attribute to be the first attribute in
the RADIUS messages. This mitigates certain MD5 attacks against
RADIUS/UDP.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-09 14:58:39 +03:00
Jouni Malinen
adac846bd0 RADIUS: Allow Message-Authenticator attribute as the first attribute
If a Message-Authenticator attribute was already added to a RADIUS
message, use that attribute instead of adding a new one when finishing
message building. This allows the Message-Authenticator attribute to be
placed as the first attribute in the message.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-09 14:58:39 +03:00
Jouni Malinen
566dc139a0 tests: Include Message-Authenticator attribute in RADIUS tests
This is in preparation for hostapd requiring this attribute for all
cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-09 14:58:39 +03:00
Jouni Malinen
2846b74f14 tests: SAE H2E and rejected groups with different APs and different config
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 12:14:34 +03:00
Jouni Malinen
d944ef1c01 SAE: Clear rejected groups list on completing authentication
The rejected groups list is valid only during each individual SAE
authentication instance and it should not be maintained between separate
instances. In particular, it should not be maintained when roaming to
another AP since the APs might use different configuration for the
allowed SAE groups.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 12:14:34 +03:00
Jouni Malinen
368aa0230b tests: SAE protocol testing - Invalid Rejected Groups element
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 12:14:33 +03:00
Jouni Malinen
0ab009db3c SAE: Clear rejected groups list on continuous failures
wpa_supplicant used to maintain the list of rejected groups for SAE over
multiple failed attempts. This could have some DoS issues, so clear this
list if SAE authentication attempts fails continuously.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 11:58:18 +03:00
Jouni Malinen
21fe042815 SAE: Clear peer_rejected_groups when no element is included
When parsing a SAE Commit message, the temporary peer_rejected_groups
parameter was left to its old value in cases where the new SAE Commit
message did not include the Rejected Groups element. This could result
in unexpected behavior if a previously processed SAE Commit message
included a Rejected Groups element that claimed one of the enabled
groups to be rejected.

Explicitly clear the peer_rejected_groups value when parsing an SAE
Commit message without a Rejected Groups element to avoid rejecting the
new message based on some previously received incorrect information.
This avoids some potential denial-of-service issues during the lifetime
of the SAE temporary data.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 11:48:35 +03:00
Jouni Malinen
364c2da874 SAE: Check for invalid Rejected Groups element length explicitly
Instead of practically ignoring an odd octet at the end of the element,
check for such invalid case explicitly. This is needed to avoid a
potential group downgrade attack.

Signed-off-by: Jouni Malinen <j@w1.fi>
2024-07-07 11:46:49 +03:00
Gururaj Pandurangi
c9db4925f6 Vendor attribute to configure STA to follow AP preference for candidates
Add a vendor attribute to configure a STA to follow AP advertised
preference values to select roam candidates with BTM.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-20 18:59:00 +03:00
Purushottam Kushwaha
0cb42655fb Vendor command extension for Responder PM Mode bit in TWT SET Request
Use the existing QCA_WLAN_VENDOR_ATTR_TWT_SETUP_RESPONDER_PM_MODE
attribute for TWT setup request to configure the Responder PM Mode bit
in the control field of the TWT element or broadcast TWT schedule.

Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
2024-06-20 18:54:51 +03:00
Purushottam Kushwaha
9832f13242 Add vendor flag to indicate unavailability mode in TWT responder mode
Add a flag attribute
QCA_WLAN_VENDOR_ATTR_TWT_SET_PARAM_UNAVAILABILITY_MODE into enum
qca_wlan_vendor_attr_twt_set_param to configure the TWT responder
unavailability outside of the SPs of its broadcast TWT schedule.

Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
2024-06-20 18:52:53 +03:00
Jouni Malinen
7cf0021267 tests: SAE protocol testing and a valid commit after a failed one
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-20 18:24:10 +03:00
Chenming Huang
761041b18a SAE: Free password identifier if SAE commit is rejected due to it
Authentication rejection was found when doing fuzz testing even with a
valid SAE commit message when it was sent after a SAE commit message
that included an incorrect password identifier. The test steps for this
are as below:

1. Peer sends an abnormal commit message with incorrect password
   identifier
2. APUT rejects as expected
3. Peer sends a valid commit message
4. APUT rejects again, which is not expected

In step 2, as the abnormal data fakes an empty password identifier
element, it passes sae_is_password_id_elem() checking. Memory is then
allocated for sae->tmp->pw_id. The authentication process then fails
due to no available password with this invalid password identifier.

In step 4, though the peer sends a valid commit message, APUT rejects
this SAE commit again due to no password identifier element (due to that
sae->tmp->pw_id being set), which is not expected.

Free the sae->tmp->pw_id field and set it to NULL when SAE commit
message processing fails due to an unknown password identifier so that
the bogus value is not used as a requirement for any consecutive SAE
commit from the same STA before the STA entry gets cleared.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-06-20 18:19:26 +03:00
Nidhi Jain
d97b5c6492 Define Link Id attribute for secure ranging context vendor command
The Link Id attribute is required for secure ranging context to identify
the link on which the command is received for an MLD.

Signed-off-by: Nidhi Jain <quic_nidhjain@quicinc.com>
2024-06-19 22:33:52 +03:00
Nidhi Jain
2097de2a6a Define Link Id attribute for QCA_NL80211_VENDOR_SUBCMD_PASN
The Link Id attribute is required for QCA_NL80211_VENDOR_SUBCMD_PASN to
identify the link on which the command is received for an MLD.

Signed-off-by: Nidhi Jain <quic_nidhjain@quicinc.com>
2024-06-19 22:31:59 +03:00
Diya Sati
c6e55fb96b Add Link ID for External ACS vendor command
The Link Id attribute is required for external ACS context to identify
the link on which the command is received for an AP MLD.

Signed-off-by: Diya Sati <quic_dsati@quicinc.com>
2024-06-19 22:28:50 +03:00
Jouni Malinen
b54ccd4129 tests: SAE with SSID protection in 4-way handshake
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-19 12:38:14 +03:00
Jouni Malinen
37a289f8bc SSID protection in 4-way handshake on AP
Add support for SSID protection in 4-way handshake based on the
mechanism added in IEEE 802.11REVme/D6.0. This is a mitigation against
CVE-2023-52424 (a.k.a. the SSID Confusion Attack).

This functionality is disabled by default and can be enabled with
ssid_protection=1. Once there has been more testing of this to confirm
there is no significant interoperability issues, the goal is to be able
to change this to be enabled by default.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-19 12:38:14 +03:00
Jouni Malinen
dab7549d68 SSID protection in 4-way handshake on STA
Add support for SSID protection in 4-way handshake based on the
mechanism added in IEEE 802.11REVme/D6.0. This is a mitigation against
CVE-2023-52424 (a.k.a. the SSID Confusion Attack).

This functionality is disabled by default and can be enabled with
ssid_protection=1 in the network profile. Once there has been more
testing of this to confirm there is no significant interoperability
issues, the goal is to be able to change this to be enabled by default.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-19 12:31:04 +03:00
Veerendranath Jakkam
9a022cdc70 STA: Update scan results when BSS entry with current SSID is not found
wpa_supplicant might use a wrong BSS entry with the SSID different from
the current SSID of the current BSS while processing a roam event from
the driver when wpa_supplicant has a stale BSS entry with the old SSID
and the driver roams to the same BSS after it is restarted with a new
SSID.

To avoid this, update scan results from the driver when a BSS entry is
not found with the current SSID and try to fetch the BSS entry again
with the current SSID after this.

Also, with this change wpa_supplicant_get_new_bss() itself will update
the BSS table and search for the current BSS entry if it is not found in
the BSS table. So, remove the BSS table update and search logic from the
callers of wpa_supplicant_get_new_bss().

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
2024-06-13 18:36:08 +03:00
Aditya Kumar Singh
cb5c4e49c7 tests: Add color change test for an AP MLD
Add the eht_mlo_color_change test case to perform color change on the
first link of an AP MLD. Performing on non-first link will be done
later.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:42:33 +03:00
Aditya Kumar Singh
72203b8fe3 tests: Add HE BSS color change test
Add the he_bss_color_change test case which brings up an HE AP and
performs color change operations and validates the result.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:38:32 +03:00
Aditya Kumar Singh
320c4c8f8d AP MLD: Send link id to the driver during color change
Send the link ID in the nl80211 command to switch color if the AP is
affiliated with an AP MLD.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:31:45 +03:00
Aditya Kumar Singh
ecfe2aa61b Update Beacon frames after color change
Once CCA is finished, Beacon frames need to be updated. The BCCA element
needs to be removed and the new color value shall be advertised in the
BSS Color Information field of the HE Operation element.

Update the Beacon frames accordingly.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:25:26 +03:00
Aditya Kumar Singh
5913d1a187 Remove double "on" from debug prints in CCA event callbacks
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:22:34 +03:00
Aditya Kumar Singh
d8e1a353a6 hostapd: Add support to change BSS color from the control interface
Add hostapd_cli command "color_change <color>" to change BSS color at
run time. hostapd_cli status can be used to check the updated color.

Usage: hostapd_cli -i <interface> color_change <color>

If 0 value is given, HE BSS color would be disabled. Same or a non-zero
value between [1-63] can be given to enable color again.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 12:21:09 +03:00
Harshitha Prem
3e52a90d34 ACS: Handle scan start request failure with error code -EBUSY
Currently, if ACS scan request fails, states are cleared and returned.
However, in case of MLO, there is a possibilty of getting return value
of -EBUSY. In this case, ACS can retry the scan request after some time
similary to the HT40 scan.

Hence, retry the scan after 5 seconds if -EBUSY is returned. Maximum of
15 re-attempts are made before giving up.

Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
Co-developed-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-12 00:25:17 +03:00
Aditya Kumar Singh
3cf7bf68f4 AP MLD: Fix deferred first link BSS's authentication server init
Currently, RADIUS client, auth server, and 802.1X are copied from the
first link's BSS into the non-first link during its setup. However,
there could be a case where the first link is not initialized fully
because of ACS/HT40 SCAN/DFS. Hence, in such cases, NULL is getting
copied and later it leads to segmentation fault.

Initialize those on behalf of the first link in such case and update it
so that the next time other non-first link can use it.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-06-11 23:41:03 +03:00
Jouni Malinen
2829f1c439 wlantest: Initial support for Multiple BSSID procedure
Parse the Multiple BSSID element in Beacon frames and create and update
all the nontransmitted BSSs.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-10 21:27:00 +03:00
Balamurugan Mahalingam
1b96745f1d Add a new QCA vendor attribute to set interface offload type
Userspace tools can use QCA_WLAN_VENDOR_ATTR_CONFIG_IF_OFFLOAD_TYPE to
configure the different below acceleration features (hardware, software)
on a per interface basis.

0 - No acceleration Packets are processed through the Linux kernel
networking stack.

1 - Software based acceleration: Packets are processed through the
shortcut forwarding engine (SFE) to bypass the Linux networking stack
for improved throughput performance. This option is applicable for AP,
STA, and Mesh mode and available for all radio designs. From the
performance aspect, this option consumes more CPU compared to the other
two options. Linux traffic control can be further applied with this
option to have more control on the traffic flows.

2 - Hybrid acceleration (software and hardware acceleration combined):
Packets are processed through both hardware and software in this case.
Packet classification is done by the hardware and then the packets are
delivered to software along with classification results as meta data.
Software can choose to do more classification/QoS based on use cases.
This is applicable for AP, STA, and Mesh modes and is available for all
radio designs. From the performance aspect, this option consumes
relatively less CPU compared to the SFE option above. Linux traffic
control rules cannot be applied with this option.

3 - Hardware based acceleration : Packets are processed through special
hardware (Direct Switch) rings which can directly forward the packets
between ethernet hardware and Wi-Fi hardware with very less software
involvement. This is applicable only for AP and STA modes; not
applicable for Mesh mode. From the performance aspect, this option
consumes very much less CPU compared to the other options. Linux traffic
control rules cannot be applied when this option is used. This option is
applicable only for specific radio designs. When this option is not
available, the default option (SFE) would be configured.

Signed-off-by: Balamurugan Mahalingam <quic_bmahalin@quicinc.com>
2024-06-07 16:21:54 +03:00
Jianmin Zhu
ffcb7392f0 Add vendor attributes to detect data stall for consecutive TX no ack
Add following vendor attributes to dynamically configure parameters to
detect data stall for consecutive TX no ack.
 - QCA_WLAN_VENDOR_ATTR_CONFIG_CONSECUTIVE_TX_NO_ACK_DURATION
 - QCA_WLAN_VENDOR_ATTR_CONFIG_CONSECUTIVE_TX_NO_ACK_THRESHOLD

Signed-off-by: Jianmin Zhu <quic_jianminz@quicinc.com>
2024-06-07 15:51:17 +03:00
Kiran Kumar Lokere
a5ee11e025 Add new traffic type values for flow report vendor attribute
Define new traffic type values for
QCA_WLAN_VENDOR_ATTR_FLOW_STATS_TRAFFIC_TYPE attribute.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-06-07 15:46:36 +03:00
Jouni Malinen
e4e91f5320 tests: WNM BSS max idle period management
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 23:46:02 +03:00
Jouni Malinen
2c89b56d64 WNM: Include BSS max idle period in STATUS command output
This makes it a bit easier to test BSS max idle period management.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 23:40:22 +03:00
Jouni Malinen
58ac46baf7 WNM: AP configuration to allow BSS max idle period requests
Add a new hostapd configuration parameter max_acceptable_idle_period to
allow the AP to accept per-STA requested BSS max idle periods.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 23:40:22 +03:00
Jouni Malinen
6594ea9ef1 WNM: Allow a specific BSS max idle period to be requested
Add a new wpa_supplicant network profile parameter max_idle that can be
used to specify a specific maximum idle period in units of 1000 TUs
(1.024 s) for associations.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 22:12:48 +03:00
Jouni Malinen
829ab90d27 tests: Use consistent indentation level for clear_regdom_state()
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 13:21:02 +03:00
Jouni Malinen
fdf23679f8 tests: More coverage for WNM BSS max idle period management
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 13:20:02 +03:00
Jouni Malinen
6cd0231112 WNM: Group rekeying skipping with BSS max idle period management
Allow hostapd to be configured to not disconnect a STA if the STA fails
to reply to a group key handshake when BSS max idle period management is
used. This might be needed for some STAs that use aggressive power
saving (e.g., battery powered IoT devices).

This is disabled by default since this can delayed group rekeying
slightly and also to maintain the previous behavior. The more relaxed
operation can be enabled with the new configuration parameter
no_disconnect_on_group_keyerror=1.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 12:57:08 +03:00
Jouni Malinen
846b1d618c WNM: Configurable BSS Max Idle Period management on AP
Allow AP's behavior for BSS Max Idle Period management to be configured.
Previously, this was automatically enabled for all CONFIG_WNM_AP=y
builds. This can now be changed with the new hostapd configuration
parameter bss_max_idle:
0 = BSS Max Idle Period management disabled
1 = BSS Max Idle Period management enabled
    (default and the previous behavior)
2 = BSS Max Idle Period management enabled with requirement for
    protected keep-alive frames

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-29 12:45:02 +03:00
Aleti Nageshwar Reddy
7566370a96 Add QCA vendor attribute to get number of TX/RX packets for each NSS
Add support to get the number of TX/RX packets for each NSS value from
the driver.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-10 19:57:55 +03:00
Aditya Kodukula
4c0ea82700 Add vendor attributes to configure TX/RX NSS and chains per band
Add attributes to QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION
vendor command to configure asymmetric TX/RX NSS and chains per band.
Also document driver's response when existing attributes to configure
TX/RX NSS and chains for all the bands 2.4 GHz and 5/6 GHz are used in
the same command.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-10 19:30:23 +03:00
Aditya Kodukula
c484a0fca4 Add kernel documentation for nss and chain configuration vendor command
Add kernel documentation to the attributes used in the vendor command
QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION to configure the NSS
and chains values used for transmitting and receiving the data.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-05-10 19:21:54 +03:00
Veerendranath Jakkam
cb40986a7e Add QCA vendor attribute for uplink delay jitter
Add uplink delay jitter attribute in responses of
QCA_NL80211_VENDOR_SUBCMD_GET_STA_INFO vendor command.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
2024-05-10 12:17:29 +03:00
mtk30479
ed56dfc339 P2P: Fix fast IP address allocation for invitation of a persistent group
Allocate static IPv4 address in EAPOL frames during 4-way handshake
instead of DHCP when using P2P invitation. wpa_s->current_bss needs to
be set for the P2P specific IP address assignment mechanism to be used
in wpa_supplicant_rsn_supp_set_config(). This worked for the initial P2P
connection, but not for some cases reinvoking a persistent group.

Since there is only one AP (P2P GO) in the P2P client case, the
conditions added in commit 4d3be9cdd1 ("Postpone updating of
wpa_s->current_bss till association event") are not needed and the
easiest approach for this is to allow current_bss to be set for
p2p_in_invitation cases. If the GO P2P Interface Address (BSSID) could
be determined for all the related cases, this could be addressed a bit
more cleanly by setting the go_bssid argument for
wpas_start_p2p_client(), but that can be left as a possible future step.

Signed-off-by: tzu-meng wang <tzu-meng.wang@mediatek.com>
2024-05-08 00:32:46 +03:00
Mukul Sharma
0ae087994c Add a new QCA vendor attribute to set reduced power scan mode
Userspace can use QCA_WLAN_VENDOR_ATTR_CONFIG_REDUCED_POWER_SCAN_MODE to
configure reduce power scan mode to the driver/firmware.

Signed-off-by: Mukul Sharma <quic_mukul@quicinc.com>
2024-05-08 00:17:43 +03:00
Jouni Malinen
bd36dc90f1 AP MLD: Remove unused get_ml_rsn_info callback definition
This is not used anymore after the previous AP MLD cleanup.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-25 11:56:23 +03:00
Aditya Kumar Singh
1dda619ed2 tests: Cohosted MLDs connectivity testing
Add a test case 'eht_mld_cohosted_connectivity' which creates two 2 link
AP MLDs and connect a 2 link MLD client to each one of them and test
data traffic.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-04-24 21:58:49 +03:00