Commit graph

19471 commits

Author SHA1 Message Date
Aditya Kumar Singh
16aea07e50 AP MLD: Simplify for_each_mld_link() macro
for_each_mld_link() macro used three nested for loops. Since now the
affliated links are linked together via a linked list, the logic can be
improved by using dl_list_for_each() macro instead which uses one for
loop.

Modify for_each_mld_link() macro to use dl_list_for_each() instead.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-04-16 10:51:24 +03:00
Johannes Berg
ae1a9909e0 tests: Add test with stuck ECSA in Probe Response frames
Add a test behaving like an Asus RT-AC53 with firmware
3.0.0.4.380_10760-g21a5898, which (in some cases?) can have an ECSA
element stuck in the probe response, when the channel switch is long
finished.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-04-16 10:46:15 +03:00
Johannes Berg
41fd49958d tests: Add connecting-while-CSA tests
Add a few tests to validate what happens with connections
while an AP is doing CSA:
 - quiet to diff channel (shouldn't connect)
 - quiet to same channel (shouldn't connect)
 - non-quiet to diff channel (shouldn't connect)
 - non-quiet to same channel (should connect)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-04-16 10:46:13 +03:00
Johannes Berg
d43eb71da7 hostapd: Add support for testing Probe Response frame elements
Add support for additional (vendor) elements to be added
to only Probe Response frames, for testing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-04-16 10:38:00 +03:00
Jouni Malinen
a6062568ab tests: Fix he_6ghz_reg to clear sae_groups
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-15 23:35:29 +03:00
Felix Fietkau
4b755c9672 build: De-duplicate _DIRS before calling mkdir
If the build path is long, the contents of the _DIRS variable can be
very long, since it repeats the same directories very often. In some
cases, this has triggered an "Argument list too long" build error.

Reported-by: Robert Marko <robimarko@gmail.com>
Suggested-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:19:42 +03:00
Felix Fietkau
9a44236452 hostapd: Only attempt to set QoS map if supported by the driver
This fixes issues with full-MAC drivers like brcmfmac.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:19:05 +03:00
Felix Fietkau
dec6fccf17 Support qos_map_set without CONFIG_INTERWORKING
This feature is useful on its own even without full interworking
support.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:18:24 +03:00
Felix Fietkau
8634e7343d mesh: Allow processing authentication frames in blocked state
If authentication fails repeatedly, e.g., because of a weak signal, the
link can end up in blocked state. If one of the nodes tries to establish
a link again before it is unblocked on the other side, it will block the
link to that other side. The same happens on the other side when it
unblocks the link. In that scenario, the link never recovers on its own.

To fix this, allow restarting authentication even if the link is in
blocked state, but don't initiate the attempt until the blocked period
is over. This reverts commit 09d96de09e ("mesh: Drop Authentication
frames from BLOCKED STA").

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:14:33 +03:00
Felix Fietkau
a210fdb1c7 nl80211: Rewrite neigh code to not depend on libnl3-route
This removes an unnecessary dependency and also makes the code smaller.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:12:51 +03:00
Felix Fietkau
3ef0579013 ndisc_snoop: Call dl_list_del() before freeing IPv6 addresses
This fixes a segmentation fault on STA disconnect in case IPv6 addresses
where learned for the STA based on snooped neighbor solicication.

Fixes: bd00c4311c ("AP: Add Neighbor Discovery snooping mechanism for Proxy ARP")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:05:00 +03:00
Felix Fietkau
e1cd3fe3cd Cancel channel_list_update_timeout() in hostapd_cleanup_iface_partial()
This fixes a crash when disabling an interface during channel list
update.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:02:03 +03:00
Felix Fietkau
47d7f31693 nl80211: Update drv->ifindex on removing the first BSS
Otherwise it will point at the ifindex of the just removed BSS.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-15 23:00:58 +03:00
Raj Kumar Bhagat
1be706e862 hostapd: Add RRM link measurement request support
RRM link measurement request/report management frames are used to get
the radio link information between the connected stations.

Add new hostapd_cli command req_link_measurement to send an RRM link
measurement request to an associated station. Add support to handle the
link measurement report in hostapd.

RRM link measurement support can be enabled with the following new
configuration parameter:
rrm_link_measurement_report=1

Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Signed-off-by: Yuvarani V <quic_yuvarani@quicinc.com>
2024-04-15 22:28:55 +03:00
Karthikeyan Kathirvel
92fdb49b2e AP MLD: Set DTIM information properly in per-STA profile
The DTIM information in the per-STA profile is set incorrectly. The DTIM
period is set in the LSB octet of the DTIM Info subfield (2 octets),
which is intended for the DTIM count.

Fix this by setting the DTIM period and DTIM count information properly
to the MSB and LSB octets of the DTIM Info subfield, respectively.

Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
Signed-off-by: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
2024-04-15 12:04:01 +03:00
Rajat Soni
36bd75dfd2 hostapd: Fix channel switch to a DFS channel
When we are configuring automatic channel selection, we are not able to
switch to a given DFS channel because when we are trying to move to a
DFS channel, the interface is disabled and enabled again. When the
interface is disabled and enabled we are setting iface's freq and
channel to 0 in setup_interface2() in case ACS is enabled, and now we
don't know to which channel we were trying to move. Now ACS will run and
the interface will be up in the channel that is suitable.

To fix this issue add a flag named is_ch_switch_dfs to check if the
channel switch request is for a DFS channel and we can use this in
setup_interface2() to decide whther we have to set iface's freq and
channel to 0 or not. This way iface's freq and channel will retain the
values while channel switching to a DFS channel when ACS is enabled.

Signed-off-by: Rajat Soni <quic_rajson@quicinc.com>
2024-04-15 11:56:41 +03:00
Chenming Huang
f4b84ecaf7 AP MLD: Track radar detection in offloaded DFS case
Add a new flag radar_detected which is used in the following cases
when setting up a link on a DFS channel while the interface is not yet
enabled:
    1. DFS link received CAC start event
    2. If no radar detected, link setup succeeeds after CAC end
       event is received. Else go to 3.
    3. Radar detected on this link -> set radar_detected bit
    4. CAC end received for the current freq -> Do not setup interface
       as radar already detected. Clear radar_detected bit.
    5. The driver sends channel switch event to switch to another channel
        a. Switch to another DFS channel -> go to 1
        b. Switch to non-DFS channel -> proceed to set up interface

Or when receiving a CAC start event when the interface is already set up:
    1. DFS link already set up successfully
    2. Radar detected on this link -> set radar_detected bit
       a. Switch to DFS channel
           a.1. CAC start -> clear radar_detected bit and partner RNR
           a.2. If radar detected, go to 2.
           a.3. CAC end -> clear radar_detected bit
           a.4. Link enabled successfully
       b. Switch to non-DFS channel
           b.1  No op and the driver handles this

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-15 11:38:56 +03:00
Chenming Huang
aaf879ef20 AP MLD: Do not update other links' RNR element if not enabled yet
When one link is still under CAC or disabled, peer links should not
carry the information of this link in the RNR elements.

With this change, the RNR element will be included only if a peer link
is in HAPD_IFACE_ENABLED state.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-15 11:38:49 +03:00
Chenming Huang
32261721e1 nl80211: AP MLD: Parse link ID to determine the BSS for radar event
Link ID is more accurate to specify the BSS for a radar event in some
corner cases, e.g., when there is a radar detection event and the driver
then switches to another DFS channel. There will then be two events
coming from the driver (CAC start and channel switch complete). In case
the CAC-start event comes first, hostapd still stores the previous
frequency and cannot find the correct link by calling
nl80211_get_mld_link_by_freq() with the new frequency.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-15 11:38:42 +03:00
Chenming Huang
216cfd708d AP MLD: Fix missing check for legacy client case
The AP MLD case missed the "else" branch which handles legacy STA's
disassociation. So this STA's sta_info will not be cleared ever.

Add the "else" check to make sure the sta_info gets cleared.

Fixes: 7ceafb6e9f ("AP MLD: Handle disassociation notification with SME offload to driver")
Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-15 11:38:42 +03:00
Chenming Huang
d5e6f79988 AP MLD: Request Handle OBSS scan for a specific link
OBSS scan can be required in different links if operating as an AP MLD.
When triggering scan, specify the link ID for the driver to find the
correct link to scan.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-12 10:52:19 +03:00
Chenming Huang
c9ad16870b AP MLD: Allow scan processing link to match the request
If the driver provides an identifying cookie value for scan operations,
use that to select which link processes the scan result. This is needed
for OBSS scans that can be required in different links if operating as
an AP MLD.  Distinguish the scans using scan_cookie for QCA vendor scan
events.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-12 10:52:19 +03:00
Chenming Huang
9b682e72d9 AP MLD: Find the link that is waiting for scan events
In AP MLD case, HT scan results need to be handled in the link that
triggered this scan. So find the link that has a valid scan_cb to handle
EVENT_SCAN_RESULTS.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-12 10:23:27 +03:00
Vinay Gannevaram
147f836924 PASN: Add set and get API for PASN data context
Modules that use libpasn for PASN authentication need the context of
PASN data. PASN data is a common context for the library and the modules
using it. Hence, initialize the context through init and deinit
functions. Also use set and get functions to update the parameters.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-06 00:12:54 +03:00
Vinay Gannevaram
ab37a57314 Replace PMKSA cache inline stubs with wrapper function stubs
PMKSA cache API is included in libpasn.so used by external modules,
e.g., Wi-Fi Aware. To avoid dependency on IEEE8021X_EAPOL define for the
external modules at compile time, remove PMKSA cache static inline
functions from the header file and add wrapper function stubs.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-06 00:12:52 +03:00
Vinay Gannevaram
ba55088a73 Replace PTKSA cache inline stubs with wrapper function stubs
PTKSA cache API is included in libpasn.so used by external modules,
e.g., Wi-Fi Aware. To avoid dependency on CONFIG_PTKSA_CACHE define for
the external modules at compile time, remove PTKSA cache static inline
functions from the header file and add wrapper function stubs.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-05 20:07:32 +03:00
Jouni Malinen
e2ae53e1db tests: MBSSID and beacon protection disabled/enabled
Verify that the Extended Capabilities element for the TX BSS shows
beacon protection disabled and the Extended Capabilities element for the
non-TX BSS (within the Multiple BSSID element) shows it enabled.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-04 20:44:22 +03:00
Jouni Malinen
1f230a497a MBSSID: Include Extended Capabilities element in non-TX BSSID profile
Add the Extended Capabilities element for a non-TX BSS into the non-TX
BSSID profile subelement in the Multiple BSSID element if the non-TX BSS
has different extended capabilities than the TX BSS.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-04-04 20:42:59 +03:00
Chenming Huang
37c00c3c5d AP MLD: Provide link addresses for non-AP MLDs in control interface
Add affiliated link addresses for non-AP MLDs in the STA* control
interface commands.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
2024-04-04 18:54:42 +03:00
Purushottam Kushwaha
b818a1be14 Add a QCA vendor attribute to set avoid frequencies per netdev
Add a new attribute QCA_WLAN_VENDOR_ATTR_AVOID_FREQUENCY_IFINDEX
for QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_EXT subcommand to
apply rules for avoid frequencies on a specific netdev. This is a
32-bit unsigned optional attribute.

Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
2024-04-04 18:39:18 +03:00
Jouni Malinen
07c9f183ea tests: Avoid control interface throttling in various test cases
These can cause unexpected test failures, so dump the pending monitor
socket events more frequently in some cases where event throttling is
seen.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 23:48:39 +02:00
Hu Wang
9ac0e785c3 Revert "nl80211: Skip interface down/up when setting MAC address"
This reverts commit bffd2b3994.

Revert this commit to fix a regression when setting up P2P Group Owner
on some old device.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 23:01:14 +02:00
Jouni Malinen
94506e8ed8 Use the latest updated BSS entry for sending ANQP requests
Try to find the BSS entry that contains the most likely current
information for the target BSS. This is mainly needed to avoid some
unusual behavior with APs changing their Beacon frame information in a
manner that shows up in automated testing, but this might help with some
more dynamic real world uses as well, so better do the BSS entry search
for the newest entry.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 22:37:18 +02:00
Jouni Malinen
0e4bff095b tests: Flush scan cache to make dbus_anqp_get more reliable
This test could have failed if scan results from a previously executed
test case were still the in the driver cache.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 22:33:38 +02:00
Jouni Malinen
a9bc6e89df OpenSSL: Fix a memory leak in CMAC
The OpenSSL 3.0 (or newer) version of omac1_aes_vector() did not free
the EVP_MAC. This resulted in a memory leak that shows up in a bit
strange way in valgrind reports and because of that, was not caught
during automated testing.

Fixes: 0c61f6234f ("OpenSSL: Implement CMAC using the EVP_MAC API")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 20:35:25 +02:00
Aditya Kumar Singh
4bc61b6577 AP MLD: Remove restriction of having to disable the first link BSS last
The first link BSS was always disabled last. However, now the first BSS
can be dynamically adjusted. Hence, remove such restriction.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
a6d92da9aa AP MLD: Support removal of link station from AP
Whenever ap_free_sta() was called, it deleted the whole station entry
from the kernel as well. However, with MLD stations, there is a
requirement to delete only the link station.

Add support to remove the link station alone from an MLD station. If the
link going to be removed is the association link, the whole station
entry will be removed.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
1f88b3daf0 nl80211: Add callback function for removing link STAs
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
19e50f8627 Export hostapd_sta_is_link_sta()
This functionality can be shared with other files as well.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
df34c2ced3 AP MLD: De-initialize/disable link BSS properly
When the first link BSS of an interface was de-initialized/disabled, the
whole MLD was brought down. All other links were stopped beaconing and
links were removed. And if the non-first link BSS was
de-initialized/disabled, nothing happened. Even beaconing was not
stopped which is wrong.

Fix this by properly bringing down the intended link alone from the
interface.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
63982fd094 nl80211: Print the MLD capabilities in debug
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
9fdbaf2ed6 AP MLD: Fix advertisement of MLD capabilities
Previously, hostapd directly advertised the MLD capabilities received
from the driver. Since this information is exchanged during
initialization time only, the driver will advertise the maximum
supported values. hostapd should parse it and then based on the current
situation fill the values accordingly.

For example, the maximum number of simultaneous links is supposed to be
a value between 0 and 14, which is the number of affiliated APs minus 1.
The driver advertises this value as 5 and hostapd, irrespective of the
current active links, puts 5 in the frames.

Fix this by parsing the value from the driver capabilities and then
using the values as per the current situation of the links. The
advertised values will be used as the upper limit.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
7a0501d20d AP MLD: Refresh beacons for other links when one gets disabled/enabled
If one or more BSS from the interface is partnering with BSSs from
another interface and if this interface gets disabled, the Beacon frames
need to be refreshed for other interfaces. Similar thing should happen
when it gets enabled.

Add logic to refresh other interface Beacon frames when one of the
interfaces is disabled or enabled.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
d2b62b3fe5 AP MLD: Support link removal before removing interface
Previously, whenever if_remove() was called, the whole interface was
deleted. In an AP MLD, all partner BSS use the same driver private
context and hence removing the interface when only one of the links goes
down should be avoided.

Add a helper function to remove a link first whenever if_remove() is
called. Later while handling it, if the number of active links goes to
0, if_remove() would be called to clean up the interface.

This helper function will be used later when co-hosted AP MLD support is
added and as well later during ML reconfiguration support.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
55c30e8aba nl80211: Remove AP MLD links while removing the interface
When the interface was removed, the added links were not removed. While
removing the interface, kernel has removed the stale links but hostapd
has not. This is wrong since hostapd should remove and do the clean ups
properly while removing the interface.

Hence, remove the links when interface is removed.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
a576180cd8 nl80211: Use per-BSS command for remove link
Construct the nl80211 remove link command using the per-BSS approach
instead of per-driver (drv->first_bss).

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
b162886fd0 nl80211: Re-factor nl80211_remove_links() function
nl80211_remove_links() iterated over all active links in the given BSS
and removed all of them. However, at times it is required to remove only
one link and not all links.

Add a helper function nl80211_remove_link() which will remove just the
given link_id from the passed BSS. nl80211_remove_links() will use this
and will call this for each of the active links to be removed.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
b810426eaa nl80211: Remove redundant put_freq call in set_ap() for AP MLD
wpa_driver_nl80211_set_ap() called nl80211_put_freq_params() twice if AP
is an AP MLD. It called once while putting the MLO link ID and the other
time in the normal flow if frequency info is present. Doing this twice
is not required.

Call put_freq once during the normal flow only and separately of that,
add the link ID for AP MLD.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00
Jouni Malinen
4200657338 nl80211: Fix set_ap() to add frequency without CONFIG_IEEE80211AX
This call was added within a conditional CONFIG_IEEE80211AX block even
though this can apply without that build option. Move this outside that
conditional block.

Fixes: b3921db426 ("nl80211: Add frequency info in start AP command")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
2024-03-27 18:12:39 +02:00
Aditya Kumar Singh
f2f0dd354f nl80211: Cache hostapd_data context in per link BSS struct for AP MLD
Cache the corresponding hostapd_data struct context into the link entry
within the driver wrapper. This will be useful for driver events
callback processing.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
2024-03-27 18:12:39 +02:00