]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
11 months agoDPP: Support for provisioning SAE password identifiers (Configurator)
Jouni Malinen [Sun, 1 Sep 2024 13:32:39 +0000 (16:32 +0300)] 
DPP: Support for provisioning SAE password identifiers (Configurator)

Allow SAE password identifiers to be provisioned to Enrollees that
indicate support for this capability.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoDPP: Support for provisioning SAE password identifiers (Enrollee)
Dan Harkins [Fri, 23 Aug 2024 17:50:36 +0000 (10:50 -0700)] 
DPP: Support for provisioning SAE password identifiers (Enrollee)

DPP supports provisioning of SAE password identifiers to uniquely
identify a password if the enrollee indicates support for them. Indicate
Enrollee support for that and add the received value into the network
profile.

I put everything under defines for CONFIG_DPP3 as this is a bleeding
edge feature in DPP.

This was tested against my DPP reference implementation acting as the
Configurator.

Signed-off-by: Dan Harkins <dharkins@lounge.org>
11 months agonl80211: Pass "global" events to all interfaces
Cermak Dominik [Thu, 29 Aug 2024 08:01:21 +0000 (08:01 +0000)] 
nl80211: Pass "global" events to all interfaces

We got connection failures because of outdated channel information.
That's because the NL80211_CMD_REG_CHANGE event is important for all
interfaces.

Commit f13683720239 ("nl80211: Pass wiphy events to all affected
interfaces") skips the early termination for events directed to a wiphy,
but that doesn't cover the regulatory change event because it doesn't
have a wiphy set either. Therefore the early termination still kicks in
and from three interfaces, only one got the updated channel list.

Fix this by changing the early termination logic to only apply to events
directed either to a specific interface index for wdev.

Signed-off-by: Dominik Cermak <dominik.cermak@joynext.com>
11 months agoAP MLD: Check SAE message length without depending on pointer arithemetic
Jouni Malinen [Sun, 1 Sep 2024 10:24:29 +0000 (13:24 +0300)] 
AP MLD: Check SAE message length without depending on pointer arithemetic

The way this was checked previously used pointer arithmetic could result
in undefined behavior due to the pointer ending up pointing more than
one byte beyond the end of the buffer. Avoid this by checking the buffer
length before incrementing the pointer.

Fixes: bcbe80a66a9b ("AP: MLO: Handle Multi-Link element during authentication")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoAP MLD: Work around delayed STA entry addition for SAE confirm
Jouni Malinen [Sun, 1 Sep 2024 10:14:12 +0000 (13:14 +0300)] 
AP MLD: Work around delayed STA entry addition for SAE confirm

The driver is expected to have an STA entry for a non-AP MLD ready to
translate the address fields for SAE confirm messages. However, there is
at least a theoretical race condition in a case where the peer sends the
SAE confirm message quickly enough for the driver translation mechanism
to not be available to update the SAE confirm message addresses. Work
around that by searching for the STA entry using the link address of the
non-AP MLD if no match is found based on the MLD MAC address.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: AP MLD control socket connectivity test case
Aditya Kumar Singh [Tue, 13 Aug 2024 08:38:52 +0000 (14:08 +0530)] 
tests: AP MLD control socket connectivity test case

Add a simple test case to bring up a two link AP MLD and get the status
of each link via the MLD level control socket.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Introduce MLD level control interface socket
Aditya Kumar Singh [Tue, 13 Aug 2024 08:38:48 +0000 (14:08 +0530)] 
AP MLD: Introduce MLD level control interface socket

With MLO, each link have socket created with "<ifname>_link<link id>"
under the control interface directory.

Introduce a MLD level socket "<ifname>" as well under the same control
interface directory. This socket can be used to pass the command to its
partner links directly instead of using the link level socket. Link ID
needs to be passed with the command in a prefix way. If no Link ID is
provided the first link ID is selected.

The structure of the command is -
 "LINKID <link id> <COMMAND APPLICABALE FOR THE LINK>"

Directory looks something like this -
  $ ls /var/run/hostapd/
    wlan0
    wlan0_link0
    wlan0_link1

wlan0 here is the MLD level socket. Rest are each link level sockets.

This also helps to maintain backwards compatibility with applications
which looks for <ifname> under the control interface directory.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agotests: MLO: Use link ID to access control sockets
Aditya Kumar Singh [Tue, 13 Aug 2024 08:38:51 +0000 (14:08 +0530)] 
tests: MLO: Use link ID to access control sockets

With MLO, each BSS will create sockets under the given ctrl_iface
directory with the socket name being '<ifname>_link<link_ID>'.

Make necessary changes in MLO related test cases so that it can access
the new socket and proceed further as expected.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Create link based hostapd control sockets
Karthikeyan Kathirvel [Tue, 13 Aug 2024 08:38:47 +0000 (14:08 +0530)] 
AP MLD: Create link based hostapd control sockets

Create link based control sockets to access the link based commands
through hostapd_cli. This will create the link interfaces in the name of
<ifname>_link<X>

Example:
To fetch link 0 status from wlan0, below command can be used -
    $ hostapd_cli -i wlan0 -l 0 status

On failure of link/interface selection, below error will be observed
    $ hostapd_cli -i wlan0 -l 2 status
    Failed to connect to hostapd - wpa_ctrl_open: No such file or directory

Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
Co-developed-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agotests: Clear scan cache in wifi_display_parsing
Jouni Malinen [Thu, 29 Aug 2024 17:21:31 +0000 (20:21 +0300)] 
tests: Clear scan cache in wifi_display_parsing

This is needed to avoid false failures if an old BSS entry is still
present for dev[0]. This could happen, e.g., with the following test
case sequence: wpas_mesh_max_peering wifi_display_parsing

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoAdd QCA vendor attribute to disable channel switch initiation
Shivani Baranwal [Fri, 16 Aug 2024 07:14:36 +0000 (12:44 +0530)] 
Add QCA vendor attribute to disable channel switch initiation

Add a test config u8 attribute to disable the channel switch
initiation in P2P GO mode.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agotests: Make rsn_override_mld_too_long_elems more robust
Jouni Malinen [Thu, 29 Aug 2024 13:14:43 +0000 (16:14 +0300)] 
tests: Make rsn_override_mld_too_long_elems more robust

Wait longer for the disconnection event since the previous wait was
exactly the same length as the authentication timeout in wpa_supplicant
and as such, subject to race conditions.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: More robust error handling for wifi_display_parsing
Jouni Malinen [Thu, 29 Aug 2024 13:00:10 +0000 (16:00 +0300)] 
tests: More robust error handling for wifi_display_parsing

Check explicitly that wfd_subelems is present in the dict instead of
failing on a key error when trying to fetch it.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoUSD: Move control interface events to notify.c
Lo,Chin-Ran [Mon, 15 Jul 2024 06:01:11 +0000 (14:01 +0800)] 
USD: Move control interface events to notify.c

This separates the control interface specific generation of a text event
message away from the main implementation of USD and makes it more
convenient to add support for other control interface mechanisms like
dbus.

Signed-off-by: Lo,Chin-Ran <chin-ran.lo@nxp.com>
11 months agoQCA vendor interface to set the P2P mode configuration
Vinay Gannevaram [Wed, 14 Aug 2024 15:41:53 +0000 (21:11 +0530)] 
QCA vendor interface to set the P2P mode configuration

Add the QCA_NL80211_VENDOR_SUBCMD_SET_P2P_MODE for setting the P2P mode
in which the P2P Group Owner (GO) should be brought up. These modes
include Wi-Fi Direct R1 only, Wi-Fi Direct R2 only, and P2P Connection
Compatibility Mode, which supports both R1 and R2. These modes are
defined in the enum qca_wlan_vendor_p2p_mode.

Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
11 months agoAdd QCA vendor attribute to change P2P GO beacon interval
Kiran Kumar Lokere [Mon, 12 Aug 2024 07:26:57 +0000 (00:26 -0700)] 
Add QCA vendor attribute to change P2P GO beacon interval

Add new QCA vendor attribute to configure the P2P GO beacon interval
dynamically while the BSS continues operating.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoP2P2: Add bootstrapping support with PD frames
Shivani Baranwal [Mon, 5 Aug 2024 09:33:07 +0000 (15:03 +0530)] 
P2P2: Add bootstrapping support with PD frames

Add support for P2P2 bootstrapping with comeback mechanism using
Provision Discovery frames. Extend the control interface command
P2P_CONNECT to allow P2P2 bootstrapping handshake.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Refactor provision discovery request/response processing
Shivani Baranwal [Mon, 5 Aug 2024 09:33:06 +0000 (15:03 +0530)] 
P2P2: Refactor provision discovery request/response processing

Parse the P2P IEs in functions that handle provision discovery request
and response. Process the frames based on the IEs received in the PD
frames. This makes it easier to extend PD for P2P2 cases.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Process Element container attribute from NAN SDFs
Shivani Baranwal [Mon, 5 Aug 2024 09:33:05 +0000 (15:03 +0530)] 
P2P2: Process Element container attribute from NAN SDFs

Process the Element Container attribute from NAN SDF frames and check if
P2P attributes are present. Add a P2P peer device entry if the NAN SDF
frame has matching service and P2P capabilities.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Parse P2P2 IE
Shivani Baranwal [Mon, 5 Aug 2024 09:33:05 +0000 (15:03 +0530)] 
P2P2: Parse P2P2 IE

Add parsing of the P2P2 IE similarly to the way the P2P IE is parsed.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoNAN USD: Add publishChannelList option for Subscriber
Shivani Baranwal [Mon, 5 Aug 2024 09:33:04 +0000 (15:03 +0530)] 
NAN USD: Add publishChannelList option for Subscriber

Add frequency list to active NAN USD Subscriber to search for a
Publisher on multiple channels. This is the publish channel list used by
the Subscriber to periodically search for a service on these channels.
publishChannelList was already supported in the Publisher and this
commit extends that to the Subscriber.

This is needed for a P2P2 seeker that is an active subscriber looking
for an advertiser on a list of publish channels.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Device Identity Key generation and storage in configuration
Shivani Baranwal [Mon, 5 Aug 2024 09:33:03 +0000 (15:03 +0530)] 
P2P2: Device Identity Key generation and storage in configuration

Generate a random device identity key and save it to the config file.
Use the same identity key from config to derive DIRA for NAN SDF frames.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoFT: Fix writing of ft_prepend_pmkid configuration parameter
Shivani Baranwal [Mon, 5 Aug 2024 09:33:03 +0000 (15:03 +0530)] 
FT: Fix writing of ft_prepend_pmkid configuration parameter

This was missing a newline at the end of the line.

Fixes: 8fa52a797496 ("FT: Allow wpa_supplicant to be configured to prepend PMKR1Name")
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Add DIRA attributes to P2P2 IE of NAN SDFs
Shivani Baranwal [Mon, 5 Aug 2024 09:33:02 +0000 (15:03 +0530)] 
P2P2: Add DIRA attributes to P2P2 IE of NAN SDFs

Add DIRA attribute in P2P2 IE of NAN Subscribe and Publish frames
to enable support for device identity of paired peers.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Add PCEA and PBMA attributes to P2P2 IE of NAN SDFs
Shivani Baranwal [Mon, 5 Aug 2024 09:33:01 +0000 (15:03 +0530)] 
P2P2: Add PCEA and PBMA attributes to P2P2 IE of NAN SDFs

Add PCEA and PBMA attribute in P2P2 IE of NAN Subscribe and Publish frames
to include the P2P2 capabilities and bootstrapping methods.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: Allow P2P IE to be added into NAN SDFs
Shivani Baranwal [Mon, 5 Aug 2024 09:33:00 +0000 (15:03 +0530)] 
P2P2: Allow P2P IE to be added into NAN SDFs

Extend the NAN Subscribe and Publish methods to allow p2p=1 to be
specified to include P2P attributes in a P2P IE to be added into the NAN
Element Container attribute. In addition, use the P2P Device Address for
the NAN SDFs for the P2P cases.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoP2P2: New element and attribute definitions
Shivani Baranwal [Mon, 5 Aug 2024 09:33:00 +0000 (15:03 +0530)] 
P2P2: New element and attribute definitions

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agoNAN: Option to offload NAN DE for USD into the driver
Shivani Baranwal [Mon, 5 Aug 2024 09:32:59 +0000 (15:02 +0530)] 
NAN: Option to offload NAN DE for USD into the driver

Support implementation architecture where the NAN discovery engine is
located in the driver/firmware instead of wpa_supplicant.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
11 months agotests: AP MLD and RSN overriding with too long elements
Jouni Malinen [Fri, 23 Aug 2024 15:42:55 +0000 (18:42 +0300)] 
tests: AP MLD and RSN overriding with too long elements

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoRSNO: Check that RSNOE/RSNO2E/RSNXOE fit into RSN Override Link KDE
Jouni Malinen [Fri, 23 Aug 2024 15:40:53 +0000 (18:40 +0300)] 
RSNO: Check that RSNOE/RSNO2E/RSNXOE fit into RSN Override Link KDE

While these elements fit without issue in production use cases, it is
possible to override the elements for testing purposes and if such
overridden elements are overly long, they would nto fit into the maximum
length RSN Override Link KDE. This could result in difficult to debug
failure cases, so check for this explicitly and instead of sending out
the invalid M3, report the internal issue in the debug log and do not
send M3.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: RSNXE extensibility
Jouni Malinen [Fri, 23 Aug 2024 07:09:10 +0000 (10:09 +0300)] 
tests: RSNXE extensibility

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoAllow IE overriding to use maximum element length
Jouni Malinen [Fri, 23 Aug 2024 07:07:19 +0000 (10:07 +0300)] 
Allow IE overriding to use maximum element length

Elements can actually be 257 octets long (2 octets of header followed by
255 octets of payload). The maximum length for various IE override
testing parameters had somehow ended up being one octet too short to
cover the maximum. Increase this to allow the maximum element length to
be reached for testing purposes.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: Fix EHT 320 MHz tests to clear sae_groups
Jouni Malinen [Thu, 22 Aug 2024 09:09:20 +0000 (12:09 +0300)] 
tests: Fix EHT 320 MHz tests to clear sae_groups

These test cases could fail if they happened to be executed after a test
case that set a specific SAE group.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoPASN: Add a function to configure noauth variable
Shivam Rai [Mon, 5 Aug 2024 04:50:10 +0000 (10:20 +0530)] 
PASN: Add a function to configure noauth variable

When the PASN implementation is used as a library for Wi-Fi Aware
applications there is need to allow the Responder to set the noauth
parameter to support opportunistic pairing method using PASN AKMP. Add
pasn_set_noauth() to address this.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoPASN: Add support to reject PASN auth 1 based on user input
Shivam Rai [Mon, 12 Aug 2024 06:09:46 +0000 (11:39 +0530)] 
PASN: Add support to reject PASN auth 1 based on user input

When the PASN implementation is used as a library for Wi-Fi Aware
applications there is need to reject the PASN auth 1 frame based on the
user input. Add support to send PASN auth 2 with failure status for
auth 1 frame received to address this need.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: DPP and SAE with short password
Jouni Malinen [Thu, 22 Aug 2024 08:27:00 +0000 (11:27 +0300)] 
tests: DPP and SAE with short password

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoDPP: Do not restrict SAE password length on Enrollee
Jouni Malinen [Thu, 22 Aug 2024 08:25:54 +0000 (11:25 +0300)] 
DPP: Do not restrict SAE password length on Enrollee

The restriction of the passphrase length to 8..63 characters is only
applicable for WPA2-Personal (PSK). Remove this constraint when
processing a configuration object that includes SAE without PSK.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoDPP: Do not restrict SAE password length on Configurator
Jouni Malinen [Thu, 22 Aug 2024 08:20:20 +0000 (11:20 +0300)] 
DPP: Do not restrict SAE password length on Configurator

The restriction of the passphrase length to 8..63 characters is only
applicable for WPA2-Personal (PSK). Remove this constraint when
provisioning a configuration object that includes SAE without PSK.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: RSN overriding and WPA3-Personal Compatibility Mode
Jouni Malinen [Tue, 20 Aug 2024 16:31:00 +0000 (19:31 +0300)] 
tests: RSN overriding and WPA3-Personal Compatibility Mode

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: RSN overriding enabled only on the STA
Jouni Malinen [Thu, 15 Aug 2024 17:24:34 +0000 (20:24 +0300)] 
tests: RSN overriding enabled only on the STA

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoRSNO: Always enable SNonce cookie and RSN Override elements validation
Veerendranath Jakkam [Tue, 13 Aug 2024 18:12:48 +0000 (23:42 +0530)] 
RSNO: Always enable SNonce cookie and RSN Override elements validation

Always set SNonce cookie and enable RSN Override elements validation
irrespective of the RSN Selection element usage in (Re)Association
Request frame when RSN overriding supported.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agoRSNO: Skip validating RSN Override elements with MLO when RSN overriding not used
Veerendranath Jakkam [Tue, 13 Aug 2024 17:32:55 +0000 (23:02 +0530)] 
RSNO: Skip validating RSN Override elements with MLO when RSN overriding not used

STA needs to skip validating RSN Override elements when RSN overriding
is not used since AP will not send RSN Override elements in EAPOL-Key
message 3/4. This is handled correctly in non-MLO case but in MLO case
wpa_supplicant always validates RSN Override link KDEs. Fix validating
RSN Override elements in MLO case as well.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agoRSNO: Do not enforce SNonce cookie and RSN Selection match if RSNO not used
Jouni Malinen [Thu, 15 Aug 2024 17:39:03 +0000 (20:39 +0300)] 
RSNO: Do not enforce SNonce cookie and RSN Selection match if RSNO not used

A STA that supports RSN overriding will always use the SNonce cookie. An
AP that does not advertise RSN overriding elements must not enforce that
SNonce cookie is used with RSN Selection element since a STA includes
the latter only when it sees the AP advertising RSN overriding elements.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoRSNO: Update RSN overriding capability indication to the driver
Veerendranath Jakkam [Thu, 8 Aug 2024 13:32:30 +0000 (19:02 +0530)] 
RSNO: Update RSN overriding capability indication to the driver

Modify wpa_supplicant code based on the updated driver interface for RSN
overriding capability indication.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agoMore detailed documentation for QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES
Jouni Malinen [Tue, 13 Aug 2024 21:40:50 +0000 (00:40 +0300)] 
More detailed documentation for QCA_NL80211_VENDOR_SUBCMD_GET_FEATURES

Be more specific on how the QCA_WLAN_VENDOR_ATTR_FEATURE_FLAGS attribute
is used in the response.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoQCA vendor interface for indicating supplicant support for RSN overriding
Veerendranath Jakkam [Thu, 8 Aug 2024 12:52:34 +0000 (18:22 +0530)] 
QCA vendor interface for indicating supplicant support for RSN overriding

Add QCA_NL80211_VENDOR_SUBCMD_CONNECT_EXT to send additional information
such as RSN overriding support of the supplicant for the (re)association
attempts with NL80211_CMD_CONNECT.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agoUse QCA_WLAN_VENDOR_FEATURE_RSN_OVERRIDE_STA only for indicating driver support
Veerendranath Jakkam [Thu, 8 Aug 2024 12:25:25 +0000 (17:55 +0530)] 
Use QCA_WLAN_VENDOR_FEATURE_RSN_OVERRIDE_STA only for indicating driver support

Use separate interfaces for indicating driver and supplicant RSN
overriding support. Modifying this interface is fine since this feature
is still under development.

Subsequent commit will define the interface for indicating supplicant
RSN overriding support to the driver.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agotests: Enable MLD GTK rekey test
Aditya Kumar Singh [Mon, 12 Aug 2024 09:02:53 +0000 (14:32 +0530)] 
tests: Enable MLD GTK rekey test

Now that MLO GTK rekey support is added, enable the test case fully.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Fix PN/IPN/BIPN for group rekeying
Aditya Kumar Singh [Tue, 13 Aug 2024 12:50:55 +0000 (18:20 +0530)] 
AP MLD: Fix PN/IPN/BIPN for group rekeying

wpa_auth_get_seqnum() for ML group rekeying needs to be skipped in the
same way as it is done for non-ML cases to avoid indicating old values
and resulting in group frames being dropped as replays. The simple check
for gsm->wpa_group_state != WPA_GROUP_SETKEYS (as is done for non-ML) is
not sufficient for this since the per-link Authenticator states are not
strictly synchronized and the state change happens in the middle of this
step.

Fixes: 137b85509248 ("MLO: Mechanism for fetching group key information for the links")
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Fix ML STA wpa_group update during rekey
Rameshkumar Sundaram [Mon, 12 Aug 2024 09:02:51 +0000 (14:32 +0530)] 
AP MLD: Fix ML STA wpa_group update during rekey

At present, group key update is not confined only on the association
link as originally intended. Hence, ensure now that the group key update
is only performed on the association link for non-AP MLDs.

This was missed during adding support for group rekeying for MLO.

Fixes: 12acda633b50 ("AP MLD: Support group rekeying for MLO")
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agotests: Group rekeying with VLANs
Jouni Malinen [Tue, 13 Aug 2024 09:48:25 +0000 (12:48 +0300)] 
tests: Group rekeying with VLANs

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoFix GKeyDoneStations tracking for VLAN
Jouni Malinen [Tue, 13 Aug 2024 09:55:16 +0000 (12:55 +0300)] 
Fix GKeyDoneStations tracking for VLAN

The AP MLD change to use a helper function for this broke the design
that depends on the value for sm->group (i.e., the currently assigned
VLAN) being used instead of the sm->wpa_auth->group. Restore previous
behavior to fix GKeyDoneStations tracking when VLANs are used.

Fixes: 78adbf2c08f4 ("AP MLD: Mark GKeyDone completed for STAs in a helper function")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agotests: Fix duplicate test case name
Jouni Malinen [Tue, 13 Aug 2024 08:44:09 +0000 (11:44 +0300)] 
tests: Fix duplicate test case name

The new test case for an AP MLD in a bridge was supposed to use a unique
test name to avoid hiding an existing test case.

Fixes: c4f927926765 ("tests: AP MLD with two links in a bridge")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agonl80211: Add AP_VLAN interface to bridge after interface is up
Radha Krishna Simha Jiguru [Wed, 17 Jul 2024 16:57:39 +0000 (22:27 +0530)] 
nl80211: Add AP_VLAN interface to bridge after interface is up

In the current hostapd flow, AP_VLAN net device is added to a bridge
before the interface is brought up.

Interface up event is used in mac80211 layer for setting device context
in the driver. Vendor specific datapath offload configurations for net
device might also be set up in interface up event context. Adding
AP_VLAN interface to a bridge before the UP event could cause
inconsistent state for datapath offload context setup in a vendor
driver.

Change the sequence to add AP_VLAN interface to a bridge after the
interface is set up. This makes the interface up and bridge add sequence
for AP_VLAN to be consistent with that of a regular AP interface.

Signed-off-by: Radha Krishna Simha Jiguru <quic_rjiguru@quicinc.com>
11 months agotests: AP MLD with two links in a bridge
Jouni Malinen [Mon, 12 Aug 2024 09:11:39 +0000 (12:11 +0300)] 
tests: AP MLD with two links in a bridge

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
11 months agoAP MLD: Add links to bridge FDB for FT roaming
Karthikeyan Kathirvel [Tue, 9 Apr 2024 17:23:46 +0000 (22:53 +0530)] 
AP MLD: Add links to bridge FDB for FT roaming

During FT, RRB messages are getting dropped at bridge on an AP MLD since
bridge doesn't know all the link address, so roaming gets failed.

Add AP MLD's each link address to the bridge FDB, so that RRB frames
get forwarded through bridge to hostapd.

Co-developed-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
11 months agotests: hostapd error path on driver interface initialization failure
Jouni Malinen [Sat, 10 Aug 2024 07:30:07 +0000 (10:30 +0300)] 
tests: hostapd error path on driver interface initialization failure

Signed-off-by: Jouni Malinen <j@w1.fi>
11 months agonl80211: NULL pointer check for link before use
Jintao Lin [Fri, 9 Aug 2024 18:10:34 +0000 (18:10 +0000)] 
nl80211: NULL pointer check for link before use

bss->flink could be NULL when wpa_driver_nl80211_del_beacon() is called
if wpa_driver_nl80211_drv_init() fails early through the 'failed' label
and jumps to wpa_driver_nl80211_deinit() with bss->flink unset.

Fixes: 47269be36e61 ("nl80211: Refactor i802_bss to support multiple links")
Signed-off-by: Jintao Lin <jintaolin@chromium.org>
11 months agohostapd: Avoid channel selection across underlying hardware index
Aditya Kumar Singh [Wed, 24 Jul 2024 07:08:14 +0000 (12:38 +0530)] 
hostapd: Avoid channel selection across underlying hardware index

Currently, channel is selected from the current hw_mode. However, not
all channels under current hw_mode might be available for the current
operating underlying hardware.

Add logic to check if the selected channel falls under the current
operating hardware index and only if so, continue with the selected
channel.

Co-developed-by: Harshitha Prem <quic_hprem@quicinc.com>
Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agohostapd: Fetch multiple radios information from the driver
Aditya Kumar Singh [Wed, 24 Jul 2024 07:08:13 +0000 (12:38 +0530)] 
hostapd: Fetch multiple radios information from the driver

When a driver consolidates several hardware components under a single
radio, it provides details about these components via the
NL80211_CMD_GET_WIPHY command.

Parse this information and store it. A subsequent change will use this
information for validation in certain scenarios.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoSync with wireless-next.git include/uapi/linux/nl80211.h
Jouni Malinen [Fri, 9 Aug 2024 17:26:01 +0000 (20:26 +0300)] 
Sync with wireless-next.git include/uapi/linux/nl80211.h

This brings in nl80211 definitions as of 2024-07-09.

Signed-off-by: Jouni Malinen <j@w1.fi>
11 months agonl80211: MLD: Fix is_shared_drv ops logic when num links is one
Ganesh Kariganuru Mahabalesh [Thu, 25 Apr 2024 10:15:25 +0000 (15:45 +0530)] 
nl80211: MLD: Fix is_shared_drv ops logic when num links is one

Whenever there is only one BSS left and if the number of links is one,
is_shared_drv() returns false assuming no one else is sharing the driver
interface. However, when the number of links is one, this does not
guarantee that the caller's link ID is the only active link ID. If this
is not the case and false is returned, the caller calls hapd_deinit()
which will free the driver interface. However, when the actual active
link_id reaches deinit path, this leads to dereferencing a NULL pointer
ultimately leading to segmentation fault.

To prevent this, pass the link ID into the is_drv_shared() ops and match
it with only with active link IDs. Only return false if they are same.

Signed-off-by: Ganesh Kariganuru Mahabalesh <quic_gkarigan@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agonl80211: Remove unused function argument from is_drv_shared() ops
Aditya Kumar Singh [Thu, 25 Apr 2024 10:15:24 +0000 (15:45 +0530)] 
nl80211: Remove unused function argument from is_drv_shared() ops

The bss_ctx argument was never used and can be removed.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Handle garbage pointer after MLD interface is deleted
Naveen S [Thu, 25 Apr 2024 10:15:23 +0000 (15:45 +0530)] 
AP MLD: Handle garbage pointer after MLD interface is deleted

In function driver_nl80211_link_remove(), when there is no active links,
interface is removed. This will free the BSS pointer. A copy of the BSS
pointer is also stored in each of the affiliated links' hapd->drv_priv
member.

driver_nl80211_link_remove() is called via multiple paths, e.g., via
NL80211_CMD_STOP_AP and via driver_nl80211_ops. When called when
handling an nl80211 event, links will be removed and when count reaches
zero, the interface will be removed. However, core hostapd will be
unaware of this removal. Hence, if it tries to access its drv_priv
pointer, this can lead to segmentation fault at times since the pointer
is now pointing to freed memory.

Prevent this by adding a new notification event
(EVENT_MLD_INTERFACE_FREED). Whenever the interface is freed, this
notification will be sent. hostapd will process this notification and
will set all affliated links' hapd->drv_priv to NULL.

Signed-off-by: Naveen S <quic_naves@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agonl80211: MLO: Process stop AP event on link basis
Aditya Kumar Singh [Thu, 25 Apr 2024 10:15:22 +0000 (15:45 +0530)] 
nl80211: MLO: Process stop AP event on link basis

Currently, a stop AP event is processed always on the first BSS in the
drv. However, with multi-link operation, it can come on any interface
and there is need to process it for the intended BSS. Also, the event
has a link ID attribute during MLO which is not used and still the event
is passed to the first link BSS.

Process the event for the intended BSS and for the intended link BSS
during MLO.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agonl80211: Make nl80211_remove_link() non-static
Aditya Kumar Singh [Thu, 25 Apr 2024 10:15:21 +0000 (15:45 +0530)] 
nl80211: Make nl80211_remove_link() non-static

No functionality changes.

This is needed to support STOP_AP events for MLD interface in a
subsequent change.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Handle driver events for interface enable/disable
Aditya Kumar Singh [Thu, 25 Apr 2024 10:15:20 +0000 (15:45 +0530)] 
AP MLD: Handle driver events for interface enable/disable

When an interface is enabled, keys are reconfigured, if required, and
beaconing is started again. With MLO, this needs to be done for each of
the affiliated links. Before starting the beaconing, the link needs to
be added back first.

Similarly, when the interface is disabled, hostapd removes the keys and
set the BSS state to disabled. However, for an AP MLD interface, this
needs to be done for each of the affiliated link BSS.

Handle the interface enable/disable driver event for AP MLD.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agohostapd: Refactor interface enable/disable into separate helper functions
Aditya Kumar Singh [Thu, 25 Apr 2024 10:15:19 +0000 (15:45 +0530)] 
hostapd: Refactor interface enable/disable into separate helper functions

Driver events for interface enable/disable are currently handled on
interface level with one hostapd_data instance under consideration. In
order to extend it for MLO, this needs to be done for each of the
affiliated links. Hence, refactor the code into a helper function which
can be used later.

No functionality change. Support for MLO will be added in a subsequent
change.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoRSNO: Add debug prints for RSN override elements in EAPOL frames
Veerendranath Jakkam [Wed, 7 Aug 2024 09:06:30 +0000 (14:36 +0530)] 
RSNO: Add debug prints for RSN override elements in EAPOL frames

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agoRSNO: Fix storing RSNE/RSNXE variants to wpa_sm from association event
Veerendranath Jakkam [Tue, 6 Aug 2024 13:04:40 +0000 (18:34 +0530)] 
RSNO: Fix storing RSNE/RSNXE variants to wpa_sm from association event

Store the full set of AP's RSNE/RSNXE variants to wpa_sm while
processing association event. Commit 521374b9785a did this for the cases
that were needed for SME-in-wpa_supplicant cases, but forgot to update
the cases needed for SME-in-driver. Convert those to the updated
protocol design as well.

Fixes: 521374b9785a ("RSNO: Include all RSNE/RSNXE variants in EAPOL-Key message 3/4")
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
11 months agoWNM: Extend workaround for broken AP operating class behavior
Yu Zhang(Yuriy) [Thu, 1 Aug 2024 10:37:25 +0000 (18:37 +0800)] 
WNM: Extend workaround for broken AP operating class behavior

Some APs do not advertise operating classes correctly for BSS Transition
Management. Try to determine the most likely operating frequency based
on the channel number (1..14 --> 2.4 GHz; 36..177 --> 5 GHz) if invalid
op_class == 255 is received in a BSS Transition Management Request. This
speeds up the following operating by avoiding a full scan due to an
unknown channel.

This extends the workaround that was added in commit 80ce804e8824 ("WNM:
Workaround for broken AP operating class behavior") for invalid
operating class 0 to cover another observed case with invalid operating
class 255.

Signed-off-by: Yu Zhang(Yuriy) <quic_yuzha@quicinc.com>
11 months agotests: Add CSA support on non-first link of AP MLD
Aditya Kumar Singh [Wed, 7 Aug 2024 04:18:38 +0000 (09:48 +0530)] 
tests: Add CSA support on non-first link of AP MLD

Currently MLO CSA test case supports CSA only on the first link.
However, now it can be extended to other links as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agonl80211: Sanitize link ID in mlme_event_ch_switch() for AP interface
Aditya Kumar Singh [Wed, 7 Aug 2024 04:18:37 +0000 (09:48 +0530)] 
nl80211: Sanitize link ID in mlme_event_ch_switch() for AP interface

During channel switch handling for AP MLD, if link ID is incorrect,
there is no point in proceeding till end and failing or returning from
there. Hence sanitize it in the initial time itself and return if it is
incorrect. Throw a warning print if it is not correct as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agonl80211: Add ifname and link ID debug prints in mlme_event_ch_switch()
Aditya Kumar Singh [Wed, 7 Aug 2024 04:18:36 +0000 (09:48 +0530)] 
nl80211: Add ifname and link ID debug prints in mlme_event_ch_switch()

This makes it easier to debug AP MLD behavior.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agohostapd: Enable HE when EHT is set for channel switch
Aloka Dixit [Wed, 7 Aug 2024 18:34:52 +0000 (11:34 -0700)] 
hostapd: Enable HE when EHT is set for channel switch

Channel switch operation fails if 'eht' option is given without 'he'
as hostapd_config_check() returns following error:
"Cannot set ieee80211be without ieee80211ax"

The issue is seen only when switching within/to DFS channels because
hostapd_switch_channel_fallback() does not set 'ieee80211ax' in
hostapd configuration unless 'he_enabled' is set for the new channel.

Set 'he_enabled' in struct hostapd_freq_params for channel switch
when EHT is enabled.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
11 months agoAP MLD: Use the cached per STA profile instead of forming a new one
Aditya Kumar Singh [Wed, 7 Aug 2024 06:41:45 +0000 (12:11 +0530)] 
AP MLD: Use the cached per STA profile instead of forming a new one

Now that per STA profile is cached already, there is no need to form it
dynamically on every Probe Request frame.

Use the cached one instead.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Handle Vendor Specific element inheritance in per STA profile
Arunpandi Kannan [Wed, 7 Aug 2024 06:41:46 +0000 (12:11 +0530)] 
AP MLD: Handle Vendor Specific element inheritance in per STA profile

As per IEEE P802.11be/D7.0, 35.3.3.5.1 (Inheritance in the Per-STA
Profile subelement of Basic Multi-Link element), Note 1, if there exists
one or more Vendor Specific elements carried in a Management frame that
includes the Basic Multi-Link element containing a per-STA profile for a
reported STA, and the contents of the Information field for at least one
of the Vendor Specific elements is not the same as that of at least one
Vendor Specific element that applies to the reported STA, then each
Vendor Specific element that applies to the reported STA is included in
its Per-STA Profile subelement.

Handle this.

Signed-off-by: Arunpandi Kannan <quic_arunpand@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Add non-inheritance support for per STA profile reporting
Sriram R [Wed, 7 Aug 2024 06:41:44 +0000 (12:11 +0530)] 
AP MLD: Add non-inheritance support for per STA profile reporting

There can be an element in the reporting BSS which is not there in the
reported BSS. This element should not be inherited in the per STA
profile. Hence to indicate this, the corresponding per STA profile
should include a Non-Inheritance element in the per STA profile.

Include Non-Inheritance element in the per STA profiles when needed.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Intersect per STA profile with the reporting BSS
Sriram R [Wed, 7 Aug 2024 06:41:43 +0000 (12:11 +0530)] 
AP MLD: Intersect per STA profile with the reporting BSS

If an element is present in the reporting BSS and it is also present in
the reported BSS and the contents are same, ideally, the reported BSS
need not carry such element in its per STA profile. Such elements are
assumed to be inherited from the reporting BSS.

Intersect the reported BSS profile with the reporting BSS and avoid such
element inclusion.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Ignore elements which are not meant to be included in per STA profile
Sriram R [Wed, 7 Aug 2024 06:41:42 +0000 (12:11 +0530)] 
AP MLD: Ignore elements which are not meant to be included in per STA profile

There are certain elements which should not be included in a per STA
profile.

Ignore such elements.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Generate and keep per STA profiles for each link
Sriram R [Wed, 7 Aug 2024 06:41:41 +0000 (12:11 +0530)] 
AP MLD: Generate and keep per STA profiles for each link

Currently, upon receiving a Probe Request frame, per STA profile is
generated and added to the Probe Response frame. However, the per STA
profile remains unchanged unless there’s a property change in one of the
affliated link of the AP MLD. This approach introduces unnecessary delay
in forming and sending out the Probe Response frame.

To optimize this process, generate the per STA profile for each link at
the start and store it. When needed, it can be simply copied into the
Probe Response frame. Additionally, whenever there’s a change in the
link’s properties, re-generate the per STA profiles for all affiliated
links of the AP MLD.

As an initial step, copy the complete per STA profile and store it
within the links. The intersection with reporting BSS and inheritance
will be addressed in a subsequent change. Then finally, this will be
used to generate the Probe Response frame. As of this commit, no change
in adding per STA profiles in the Probe Response frame.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Co-developed-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoMove mld_link_info structure to hostapd.h header file
Sriram R [Wed, 7 Aug 2024 06:41:40 +0000 (12:11 +0530)] 
Move mld_link_info structure to hostapd.h header file

At present, the mld_link_info structure is nested within the mld_info
structure. However, a future modification will require mld_link_info to
be outside of mld_info. To address this, move the mld_link_info
structure to hostapd.h so that it can be accessed both in the current
context and in the location needed for the upcoming change.

No functional changes.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAdd support to switch channel when CAC is in progress
Amith A [Wed, 7 Aug 2024 06:04:07 +0000 (11:34 +0530)] 
Add support to switch channel when CAC is in progress

Prior to initiating communication on a DFS channel, channel availability
check needs to be performed. During this period, the AP does not beacon.
Hence, no channel switch was allowed during this period. However, if a
user wishes to switch to a non-DFS channel during the potentially long
CAC period and start transmission immediately, there is no provision to
do that currently.

Extend the existing CHAN_SWITCH control interface command to allow
channel switch even when the AP is in CAC state. To do this, first
disable the interface to abort the CAC in progress and then configure
the interface with the new parameters and finally re-enable the
interface.

Signed-off-by: Amith A <quic_amitajit@quicinc.com>
11 months agoWNM: Fix potential NULL pointer dereference during assoc response handling
Rameshkumar Sundaram [Wed, 7 Aug 2024 04:38:23 +0000 (10:08 +0530)] 
WNM: Fix potential NULL pointer dereference during assoc response handling

In the send_assoc_resp() function, there’s a chance that the sta
argument could be NULL. Therefore, it’s crucial not to directly
dereference sta without first checking whether it’s a valid pointer.
However, commit 58ac46baf7b0 (“WNM: AP configuration to allow BSS max
idle period requests”) introduces direct dereferencing of max idle
period from sta, which might lead to a NULL pointer dereference. Fix
this now.

Fixes: 58ac46baf7b0 ("WNM: AP configuration to allow BSS max idle period requests")
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agohostapd: Add Bandwidth Indication subelement support for channel switch
Karthik M [Tue, 16 Jul 2024 10:14:06 +0000 (15:44 +0530)] 
hostapd: Add Bandwidth Indication subelement support for channel switch

The Bandwidth Indication subelement contains channel bandwidth, channel
center frequency, and optionally punctured subchannels.

As per IEEE P802.11be/D7.0, 35.15.3 (Channel switching methods for an
EHT BSS), if a Channel Switch Announcement element or an Extended
Channel Switch Announcement element is used to announce a switch to an
EHT BSS operating channel width wider than 160 MHz or to an EHT BSS
operating channel width including at least one punctured 20 MHz
subchannel, the Bandwidth Indication subelement in the Channel Switch
Wrapper element shall be present in the same frame.

Hence, add it into the Beacon and Probe Response frames under the above
mentioned conditions.

Signed-off-by: Karthik M <quic_karm@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agohostapd: Refactor Channel Switch Wrapper element generation
Karthik M [Tue, 16 Jul 2024 10:14:05 +0000 (15:44 +0530)] 
hostapd: Refactor Channel Switch Wrapper element generation

The Wide Bandwidth Channel Switch subelement was directly appended in
the Channel Switch Wrapper element function
hostapd_eid_wb_chsw_wrapper(). However, a subsequent change would add
Bandwidth Indication subelement in the Channel Switch Wrapper element.
Hence using the same function name would be confusing.

Hence, refactor the current code into two functions. The first function
hostapd_eid_chsw_wrapper() forms the channel switch wrapper element.
This calls hostapd_eid_wb_channel_switch() to add a Wide Bandwidth
Channel Switch subelement inside it.

No functionality change.

Signed-off-by: Karthik M <quic_karm@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agonl80211: Handle nl80211_cqm_event per BSS
Manish Dharanenthiran [Fri, 19 Jul 2024 04:16:38 +0000 (09:46 +0530)] 
nl80211: Handle nl80211_cqm_event per BSS

During MLO, an nl80211_cqm_event may be received by any BSS. Directing
this event to the first BSS may not be suitable as it might not
correspond to the link the event is meant for. Hence, there is a need to
handle this on per-BSS basis.

Therefore, handle nl80211_cqm_event per BSS. The event handler further
uses the address information present in the event to fetch the intended
link BSS if no matching STA entry was found based on the initial
ap_get_sta() call.

Signed-off-by: Manish Dharanenthiran <quic_mdharane@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoRelocate the declaration of the hostapd_find_by_sta() function to top
Manish Dharanenthiran [Fri, 19 Jul 2024 04:16:37 +0000 (09:46 +0530)] 
Relocate the declaration of the hostapd_find_by_sta() function to top

The hostapd_find_by_sta() function may be utilized by multiple driver
events. Therefore, it should be declared at the outset to ensure
accessibility by all event handlers.

No functional changes.

Signed-off-by: Manish Dharanenthiran <quic_mdharane@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agohostapd: Add Max Channel Switch Time element support
Aditya Kumar Singh [Tue, 16 Jul 2024 06:24:49 +0000 (11:54 +0530)] 
hostapd: Add Max Channel Switch Time element support

The Max Channel Switch Time element indicates the time delta between the
time the last beacon is transmitted by the AP in the current channel and
the expected time of the first Beacon frame transmitted by the AP in the
new channel.

IEEE P802.11be/D7.0, 35.3.11 (ML procedures for (extended) channel
switching and channel quieting) indicates that if an AP affiliated with
an AP MLD is switching channel, Max Channel Switch Time element shall be
included in every Beacon and Probe Response frame it transmits.

Add support to include the Max Channel Switch Time element in Beacon and
Probe Response frames during channel switch announcement for an AP
affiliated with an AP MLD.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoShare usec-to/from-TU conversion macros in a general location
Aditya Kumar Singh [Tue, 16 Jul 2024 06:24:49 +0000 (11:54 +0530)] 
Share usec-to/from-TU conversion macros in a general location

These can be used outside the context of FST and hostapd.c, so move the
macro definitions into a shared header file. In addition, fix the
currently unused US_TO_TU() definition and rename "US" to "USEC".

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
11 months agoAP MLD: Ensure successful addition of link item into list
Sidhanta Sahu [Tue, 30 Apr 2024 16:41:09 +0000 (09:41 -0700)] 
AP MLD: Ensure successful addition of link item into list

Currently, hapd->link is added to the MLD links list during driver
initialization and setup BSS operation. However, a call trace has been
observed where a BSS link item is not present in the list and an attempt
is made to delete it from the list. This scenario occurs during the
deinitialization operation, which calls hostapd_bss_link_deinit() and
tries to remove the hapd->link which is not present in the list.

Ensures that the link item is added to the list only after the
successful operation of link addition. Also ensure that mld->num_links
increments only when the addition is successful. Therefore, return from
hostapd_bss_link_deinit(), if mld->num_links is zero. Since the mld
object is shared among all the links, num_links has to be incremented
only when the addition is successful.

Call trace:
        dl_list_del.lto_priv.9.lto_priv ()
        hostapd_bss_link_deinit.lto_priv ()
        hostapd_bss_deinit ()
        hostapd_interface_deinit ()
        hostapd_interface_deinit_free ()
        hostapd_main ()

Signed-off-by: Sidhanta Sahu <quic_sidhanta@quicinc.com>
11 months agoSAE: Add group 20 in default groups when AP started with SAE-EXT-KEY
Veerendranath Jakkam [Mon, 5 Aug 2024 07:00:54 +0000 (12:30 +0530)] 
SAE: Add group 20 in default groups when AP started with SAE-EXT-KEY

hostapd used to always enable only the group 19 when SAE groups were not
configured explicitly in hostapd.conf. This may cause undesired
connection delay with STAs which use group 20 as the primary group with
SAE-EXT-KEY AKM during SAE authentication attempt.

To avoid this, enable group 20 in default groups when AP supports
SAE-EXT-KEY and SAE groups have not been configured explicitly in
hostapd.conf.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
12 months agonl80211: Fix simultaneous scanning failure in case of MLO
Aditya Kumar Singh [Fri, 21 Jun 2024 05:34:39 +0000 (11:04 +0530)] 
nl80211: Fix simultaneous scanning failure in case of MLO

Currently only one scan can be performed on per phy level at a time in
the driver. Due to this, if another scan request is sent via anoother
underlying phy, the kernel returns -EBUSY. This would result in hostapd
trying to set the interface into station mode if it was originally in AP
mode and retry sending a scan request. However, this behavior is
expected in case of multi link operation and hence there is no need to
switch the mode as such.

Hence, add logic to not change the NL mode if the kernel returns -EBUSY
during multi link AP operation. The caller can accordingly decide and,
if needed, it can re-schedule a scan request after some time.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
12 months agonl80211: Fix scan request and its related events handling with MLO
Aditya Kumar Singh [Fri, 21 Jun 2024 05:34:38 +0000 (11:04 +0530)] 
nl80211: Fix scan request and its related events handling with MLO

Currently, whenever a scan is started, it uses drv's first BSS only
whether it is AP or STA interface. However, with AP MLD related changes,
the same drv could be used by other BSSs as well which needs scanning.
Hence, the current logic will not work since scan needs to be handled on
a non-first BSS as well.

Move the logic of always using drv's first BSS during scan events to
using BSS on which the event arrived.

Also, for AP MLD operation, even though the BSS is same, the link BSS
also needs to be identified. Hence, add a back pointer in the BSS struct
which would be used to point to the link BSS which requested the scan on
that BSS. This will help in routing the scan events to an appropriate
BSS ctx.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
12 months agoAvoid sending DEAUTH or DISASSOC packet when using flag tx=0
Gal Savion [Wed, 1 May 2024 11:11:39 +0000 (14:11 +0300)] 
Avoid sending DEAUTH or DISASSOC packet when using flag tx=0

hostapd would send DISASSOC packet (after quiet DEAUTH) or DEAUTH packet
(after quiet DISASSOC) to the station after some inactivity timeout,
even though the command has tx=0 parameter. Fix this so that tx=0 cleans
the STA info without sending any DISASSOC or DEAUTH packets.

Signed-off-by: Gal Savion <gsavion@maxlinear.com>
12 months agobuild: Add simple compile_commands.json generation
Benjamin Berg [Wed, 8 May 2024 10:56:10 +0000 (12:56 +0200)] 
build: Add simple compile_commands.json generation

This can be used with a clangd server to get code completion and cross
references in editor. To simplify the generation, create .cmd files for
most object files while building that contains the base directory and
command that was used when compiling it.

A very simple gen_compile_commands.py is provided which will read one or
more build directories and generate the compile_commands.json file for
it.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
12 months agotests: Use newer hostapd.add_ap() argument style
Jouni Malinen [Sat, 3 Aug 2024 16:02:29 +0000 (19:02 +0300)] 
tests: Use newer hostapd.add_ap() argument style

Convert the easy cases of old hostapd.add_ap() uses to the new one.

Signed-off-by: Jouni Malinen <j@w1.fi>
12 months agotests: Use remote_cli in remote testing
Janusz Dziedzic [Thu, 30 May 2024 19:19:04 +0000 (21:19 +0200)] 
tests: Use remote_cli in remote testing

This allows to use remote wpa_cli/hostapd_cli for:
 - hwsim wrapper
 - example test case

For example,
 modprobe mac80211_hwsim radios=8
 ./run-tests.py -d hwsim0 -d hwsim1 -d hwsim2 -r hwsim3 -r hwsim4 -h ap_wpa2_psk -v

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
12 months agotests: Allow user name to be skipped in ssh connection with remotehost
Janusz Dziedzic [Thu, 30 May 2024 19:19:03 +0000 (21:19 +0200)] 
tests: Allow user name to be skipped in ssh connection with remotehost

Allow to skip user name when we run ssh user@hostname.

We can specify user name in .ssh/config and simplify using network name
spaces mapped per user.

An example .ssh/config:

 Host localhost
    HostName localhost
    User root

 Host test1
    HostName testpc
    User wlan1

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
12 months agotests: Allow to use remote hostapd_cli in Hostapd classes
Janusz Dziedzic [Thu, 30 May 2024 19:19:02 +0000 (21:19 +0200)] 
tests: Allow to use remote hostapd_cli in Hostapd classes

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>