Commit Graph
72839 Commits
Author SHA1 Message Date
Felix Fietkau 6a73e0c5d3 mac80211: refuse beacon changes during an offloaded AP removal
A driver that takes the AP Removal Timer of each new beacon as a new
start keeps the beacons it had when an offloaded removal started and
drops later changes without an error, which user space does not see.

Add IEEE80211_HW_AP_REMOVAL_BEACON_HOLD. For a driver that sets it,
mac80211 refuses a beacon change, the start of a link, a channel switch
and a colour change of the AP MLD with -EBUSY until the driver reports
the expiry, so user space sees the hold in the error of the request.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau bdd7b094ac mac80211: backport the handling of missing tailroom in SW crypto
mac80211_hwsim uploads CCMP and GCMP keys with
IEEE80211_KEY_FLAG_RESERVE_TAILROOM and encrypts each frame in software
from mac80211_hwsim_tx(). __ieee80211_xmit_fast() resizes the frame
without encryption tailroom, so a frame whose tailroom is shorter than
the MIC hits the check in ccmp_encrypt_skb() or gcmp_encrypt_skb() and
is dropped:

  WARNING: net/mac80211/wpa.c:462 at ccmp_encrypt_skb.isra.0+0x298/0x2b0
   ieee80211_crypto_ccmp_encrypt+0x3b/0x60
   ieee80211_encrypt_tx_skb+0x9e/0x130
   mac80211_hwsim_tx+0x7b8/0xb40
   ...
   __ieee80211_xmit_fast+0x237/0x3c0
   ieee80211_xmit_fast+0x181/0x1c0

A locally sent IPv6 UDP datagram keeps only the slack of its allocation
as tailroom, so mDNS over an MLD backhaul station loses datagrams this
way.

Backport commit 94ae426f03b7 ("wifi: mac80211: handle missing tailroom
in SW crypto") from wireless-next: software crypto expands a short tail
instead of dropping the frame. Refresh the context of its ieee80211_i.h
hunk for 7.2, where IEEE80211_ENCRYPT_TAILROOM is 18, and the line
numbers of the later patches that change ieee80211_i.h.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 29278064eb hostapd: ubus: let del_client deauthenticate at once
del_client with deauth gives an associated station a Disassociation
first and the Deauthentication 2 s later. A caller that needs the
Deauthentication frame at once, as the DEAUTHENTICATE control command
sends it, cannot ask for it.

Add deauth_now: with deauth, it sends the Deauthentication at once from
the BSS that holds the station, also to an associated one. It replaces
a Deauthentication that an earlier call still holds back for the
address. An older hostapd ignores the attribute.

The replaced Deauthentication keeps the mark that holds the station in
the driver, since the Disassociation callback of the earlier call can
still run while the new frame waits in the driver.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau f2b27e8544 hostapd: ubus: disassociate before del_client deauthenticates
A driver can hold a Disassociation frame for a station in power save
until the station wakes, but send a Deauthentication frame at once
(mt76 sends it on the ALTX queue), so a dozing station misses the frame
of a del_client with deauth.

For a station with WLAN_STA_ASSOC, del_client with deauth now sends a
Disassociation with the reason, and the Deauthentication with the same
reason 2 s later. Where the Disassociation is not acknowledged, the
mark of patch 924 keeps the station in the driver with its keys. The
Deauthentication then goes protected, as a station with MFP drops an
unprotected one. An Authentication or (Re)Association of the address
that hostapd accepts cancels the pending Deauthentication.

Each frame of del_client now goes from the BSS that holds the station.
The first link of an AP MLD sent it before, also for a non-MLD station
of another link, which never got the frame.

Document in the README what deauth sends.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 3586d40fb1 hostapd: optionally keep a STA whose Disassociation was not acknowledged
ap_sta_disassoc_cb() removes the STA from the driver at the TX status of
the Disassociation frame, whether or not the STA acknowledged it, and
the two second timeout of the callback does the same. A caller that
sends a Deauthentication frame after the Disassociation then sends it
without the pairwise key of the STA, and a STA with MFP drops it.

Add a patch that passes the ACK of the Disassociation to
ap_sta_disassoc_cb(). For a STA whose caller sends a Deauthentication
after the Disassociation, a Disassociation without ACK and the timeout
leave the STA in the driver with its keys, and the callback of the
Deauthentication removes it. An acknowledged Disassociation removes the
STA as before. A new authentication or association ends the mark with
the other pending callbacks.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau e8e130a85f hostapd: ignore a Deauth/Disassoc TX status after its callback ended
WLAN_STA_PENDING_DEAUTH_CB and WLAN_STA_PENDING_DISASSOC_CB mark the
callback that the TX status of a Deauthentication or Disassociation
frame runs. Only ap_sta_deauth_cb() and ap_sta_disassoc_cb() clear
them, so the flag stays set where the two second timeout runs the
callback first, or where ap_sta_clear_disconnect_timeouts() cancels it
for a new authentication or association. A later TX status of the
frame, for example from a driver that holds the frame for a STA in
power save until the removal flushes it, then runs the callback again.
It removes the STA from the driver a second time, or removes the new
association of a STA that came back within the wait.

Add a patch that clears the flag where the callback runs, from the TX
status or from the timeout, and where
ap_sta_clear_disconnect_timeouts() cancels it. A later TX status of the
frame is then ignored, as that of a test frame is.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau bd6492c2a0 mac80211: keep completed airtime estimates for a deferred report
Some devices report the TX airtime of a station in batches, some time
after the TX status of its frames, for example from a firmware counter
that the driver reads at a fixed interval. ieee80211_sta_deficit()
subtracts the estimate of the pending frames from the deficit, and the
TX status of a frame drops its estimate. Between the TX status and the
next report, the airtime of a completed frame is thus in neither, and
the scheduler gives such a station more than its share.

Add a hardware flag for such a driver. With it, the TX status moves the
estimate of a frame into a counter of completed airtime per station and
AC, which the deficit also subtracts, and
ieee80211_sta_register_airtime() clears that counter when it charges the
reported airtime. The AQL limits still read the pending estimate alone,
as a completed frame holds no space in the device queue. The counter of
an AC drops only at a report, so the driver must report every station
at each interval, also with an airtime of 0.

Show the counter in the aql file of the station debugfs.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau b2ece03818 hostapd: ucode: notify the end of a link removal
A client that applies its next configuration after the AP removal of a
link cannot tell when that removal ends. The bss.remove notification
names no radio, and an AP MLD has its name on each of its links, so add
bss.link_removed with the radio of the link that stopped.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 8e3f6ad698 wifi-scripts: add mlo_emlsr and mlo_emlmr for an AP MLD
A false value writes mld_emlsr=0 or mld_emlmr=0 into the hostapd
configuration of the AP MLD, so that it does not advertise the mode.
An unset option writes no key and keeps the driver's modes.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau cfae1f57f8 hostapd: add mld_emlsr and mld_emlmr for an AP MLD
The EML Capabilities of an AP MLD come from the driver alone, so the
configuration cannot turn off EMLSR or EMLMR. Add the per-BSS keys
mld_emlsr and mld_emlmr, 1 by default: a 0 clears the support bit of
the mode. Where neither support bit remains, also for a driver without
EMLSR and EMLMR, the Basic Multi-Link element omits the EML
Capabilities, as IEEE Std 802.11be-2024 35.3.17 requires.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 0ea98a49b3 hostapd: report each refused connection attempt on ubus
The only ubus notification of a failed connection is key-mismatch, which
names neither the status the station got nor, for a wrong PSK, the frame
of the failure. A refusal for any other reason goes unreported.

Notify connect-refused at the reply of each refused Authentication and
(Re)Association Request, with the status and, where the handler has the
frame, the frame body. It names the MLD address of a client MLD.
key-mismatch now names the status of its reply, and for a wrong PSK the
EAPOL-Key message 2.

With a driver that has its own AP SME, for example brcmfmac or
mwifiex, the station gets a Disassociation frame instead. Then
connect-refused gives its Reason Code in the new reason field and no
status.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau ce7623459c hostapd: tell a CAC through the hostapd ubus object
The ubus object of a BSS does not exist while hostapd runs a CAC, and
the kernel sends no NL80211_RADAR_CAC_STARTED for a CAC that hostapd
starts, so no client can see a CAC that hostapd runs by itself.

Notify cac_start on the hostapd object when the driver takes the CAC,
and add the running CAC to the status method of that object, with the
frequency, the operating class, the primary channel, the CAC time and
the time that passed, for a client that started during the CAC. A CAC on
a background radar chain leaves the interface on its own channel and
stays out.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 87be38fd9b hostapd: ubus del_client can change a ban alone
del_client always sends a frame and disconnects the station, so a caller
cannot start or end the ban of an associated client without dropping
it.

Take an optional `ban_only` on del_client, which skips the frame and the
disconnect. An older hostapd ignores the argument and disconnects as
before.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau c181f94724 hostapd: enable external PMKSA cache commands in the full wpa_supplicant
PMKSA_GET lets a test station hand its PMK to a sniffer, which derives
the PTK from the recorded 4-way handshake.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 2d42ce83c8 hostapd, mac80211: send EAPOL with a C-Tag on a Primary VLAN link
On a Profile-2 backhaul link with a Primary VLAN ID (multi_ap_vlanid),
the EAPOL frames must carry a C-Tag of that VLAN.

mac80211 now takes ethertype 0x8100 with the control port type inside
on the control port TX, and takes tagged EAPOL frames of a station while
its port is closed. hostapd sends every EAPOL-Key frame to a Profile-2
or later backhaul station tagged where multi_ap_vlanid is set. A driver
without the control port for TX and RX refuses the send, since the
tagged reply reaches hostapd over the control port only. wpa_supplicant
answers in the form of the frame it received.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 5069f3a55f hostapd, mac80211: take EAPOL frames with a C-Tag on the control port
A Multi-AP backhaul with traffic separation can carry EAPOL frames with
a C-Tag, and the receiver must take both forms. mac80211 dropped a
tagged frame on an unauthorised port and passed it to the bridge on an
authorised one, and hostapd rejected the ethertype.

mac80211 now hands such a frame on a 4-address link to the control port
over nl80211, and nl80211_control_port_frame() removes the tag and
reports its TCI on EVENT_EAPOL_RX. Other tagged frames stay subject to
the port. The documentation of NL80211_CMD_CONTROL_PORT_FRAME describes
the tagged form of the event.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 2cf2883e4a mac80211: hwsim: simulate a radar on one channel context
mac80211_hwsim creates the debugfs file dfs_simulate_radar only for a
radio without channel contexts, so a radio with MLO or several radios
per wiphy has no radar trigger. Create it on every radio. With channel
contexts, the written value is the frequency in MHz of the primary
channel of a context, and only that context reports the radar. A value
that matches no context, or that does not fit in 32 bits, is refused
with -EINVAL. A radio without channel contexts keeps the old behaviour.

The lookup of the context, which the incumbent signal file shares,
copies the chandef of the context, since the context can go once the
iterator drops the RCU read lock. The incumbent signal write read the
chandef after that before.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau b6e59e4928 mac80211: hwsim: count the AP Removal Timer
hostapd counts the AP Removal Timer on the host and sets the beacons at
each beacon interval, so a host delay repeats a count over successive
Beacon frames and the catch-up skips counts (IEEE 802.11be-2024
35.3.6.3 requires a decrement by 1 in each subsequent Beacon frame).
Declare NL80211_EXT_FEATURE_AP_REMOVAL_TIMER_OFFLOAD and count the timer
per TBTT in mac80211_hwsim, before the driver protects the frame.

A removed link can send no Beacon frames, where user space stopped its
BSS before or during the countdown. A device counts the timer from the
template and reports the expiry from its own timer, so anchor the
removal of such a link at the Beacon frame of a partner that announces
it, and report its expiry at the TBTT of that partner (patch 510).

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau bca830d3ac mac80211: hwsim: protect the Beacon frames in the driver
Take the BIGTK of an AP interface as a hardware key and protect each
Beacon frame with ieee80211_encrypt_tx_skb() just before it is sent, so
that the driver can change a Beacon frame after ieee80211_beacon_get()
and the BIP MIC still covers it. The fields that hwsim writes now, the
Timestamp and the Power Management bit, are masked out of the MIC. The
first field that the MIC covers is the AP Removal Timer of patch 492.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau da98ca43c3 mac80211: hwsim: send Basic Trigger frames for uplink SCS streams
mac80211_hwsim accepts an SCS descriptor with an uplink traffic
description, but sends nothing that serves the stream. A device does
that in firmware (mt7996 hands the QoS Characteristics element to its
scheduler), and 802.11be 35.17 has the AP facilitate the uplink frames
within the service interval with Basic Trigger frames. Add patch 482,
which sends a Basic Trigger frame for each accepted uplink stream at its
Minimum Service Interval, on each link of the peer that the TX of other
frames to the peer can use: an active link that is not in power save and
that no TID-to-link mapping disables.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 5ab6c12c4a mac80211: hwsim: apply the negotiated TID-to-link mapping
mac80211_hwsim declares TID-To-Link Mapping Negotiation Support for its
AP interface type, but picks the link of a frame to a non-AP MLD without
regard to a negotiated mapping. Send no frame to the station on a link
to which no TID maps in either direction, and each QoS Data or
BlockAckReq frame only on a link that the downlink mapping gives for its
TID. Declare NL80211_EXT_FEATURE_AP_NEG_TTLM.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau b3b7ed3255 mac80211: hwsim: advertise a TID-to-link mapping of an AP MLD
mac80211_hwsim implements no adv_ttlm_request() operation and declares
neither NL80211_EXT_FEATURE_AP_ADV_TTLM nor
NL80211_EXT_FEATURE_BEACON_CRIT_UPDATE. hostapd thus refuses its ubus
ttlm_advertise on a simulated AP MLD.

Add the operation for the MLO radios and declare both features: a
DTIM-aligned start, the STARTED, ESTABLISHED and ENDED steps, the
countdown of the Expected Duration in the Beacon frames, and no TX on a
link outside the mapping. A request for an AP MLD with a nontransmitted
BSSID is refused.

hwsim passes the remaining Expected Duration to mac80211 with
ieee80211_adv_ttlm_duration_set() of patch 427 before it gets the
Beacon frame, so that mac80211 writes the field before it protects the
frame.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 5450cc90c9 mac80211: hwsim: report the multi-radio flag in GET_RADIO
HWSIM_CMD_GET_RADIO never reports HWSIM_ATTR_MULTI_RADIO, while the
notification of a new radio does, since commit d2601e34a102
("wifi: mac80211_hwsim: add support for multi-radio wiphy").

Add patch 430, which reports the flag when the wiphy has wiphy radios.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 9832c70a9f mac80211: hwsim: optionally register a subset of the bands
Every hwsim wiphy registers the 2.4, 5, 6 GHz and S1G bands, so a
device with one single-band wiphy per radio cannot be modelled: each
phy lists the channels of all bands, and wifi-scripts assigns every phy
its highest band, 6 GHz.

Add patch 429 with the bands module parameter and the HWSIM_ATTR_BANDS
attribute for HWSIM_CMD_NEW_RADIO, a bitmap of enum nl80211_band. Only
the bands in the bitmap are registered. Without the attribute, all
bands are registered as before.

The attribute takes the number after HWSIM_ATTR_RADIOS of patch 389.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 8244017135 mac80211: hwsim: report the airtime of each operating channel
hwsim reports survey data only for scanned channels, with a fixed busy
time of one eighth of the dwell time, so the channel utilisation of an
operating channel does not follow its traffic.

Add patch 428, which counts the airtime of each frame sent and received
per channel, and reports one in-use survey entry for each operating
channel with busy, TX and RX time. The entry replaces the scan entry of
that channel, and the other scan entries stay for ACS.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 2ac887e908 mac80211: hwsim: take the radio frequency ranges from user space
A multi-radio hwsim wiphy has one wiphy radio per band, so user space
that assigns channels to the two 5 GHz radios of tri-band hardware
cannot be tested on hwsim.

Add patch 389. HWSIM_ATTR_RADIOS of HWSIM_CMD_NEW_RADIO takes the wiphy
radios as nested frequency ranges in the format of
NL80211_ATTR_WIPHY_RADIOS. hwsim disables the channels that no radio
accepts, also after each regulatory update. GET_RADIO and the new radio
notification report the radios of every multi-radio wiphy. Without the
attribute, hwsim is unchanged.

The attribute takes the number after HWSIM_ATTR_NO_MONITOR of
wireless-next. Refresh the hwsim patches that the new patch overlaps.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau ad45d9bf37 hostapd: nl80211: keep the AP MLD address at a move of the association link
Add patch 907. With the SME in wpa_supplicant, drv->bssid is the AP MLD
address. If the AP MLD uses the BSSID of its association link as its
MLD address and removes that link, nl80211_mlo_assoc_link_move()
replaces drv->bssid with the BSSID of another link. A later scan result
then makes the driver wrapper deauthenticate. Replace drv->bssid only
where the driver does the SME.

Fixes: 1be9a8d1ba ("hostapd: move the association link of an MLD station off a removed link")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau a543c61c1d hostapd: MLD STA: restart the OBSS scan at a move of the association link
Add patch 906. After a removal of the association link, the OBSS scan
keeps the setup for the BSS of the old association link. If the new
association link is not on 2.4 GHz, each OBSS scan result makes the
station send a 20/40 BSS Coexistence frame on it.

wpas_link_reconfig() updates current_bss only where the driver BSSID
changes, and with the SME in wpa_supplicant that BSSID is the AP MLD
address. Where the association link changes, take its BSS as
current_bss and set up the OBSS scan again.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:21 +00:00
Felix Fietkau 4af6cb7e45 mac80211: report the airtime of an MLO station only once
mac80211 counts the airtime of a station per AC, not per link, but
sta_set_link_sinfo() reports that sum as the duration of each link, and
cfg80211_sta_set_mld_sinfo() adds the link durations to the station
value. nl80211 thus reports (1 + links) times the registered airtime
for an MLO station, twice for a non-MLD station of an AP MLD, and each
link claims the airtime of all links.

Leave the link durations to a driver that fills them in its
.link_sta_statistics. Such a driver had its link durations counted twice
in the same way, since sta_set_sinfo() fills the station duration with
the registered airtime, which holds every link. Where mac80211 fills
the station duration itself, take the link durations that the driver
filled out of it, so that the sum is the registered airtime.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 06820c96bf mac80211: do not resolve an MLD station by its MLD address in RX
On an MLD interface, ieee80211_rx_for_interface() resolves a frame that
no link station matches to the MLO station of its MLD address. On a link
that the station does not hold, the frame is then dropped. A non-AP MLD
that scans the channel of another link of its AP MLD sends its Probe
Requests from its MLD address, so the AP MLD does not answer them.

Resolve the station only by a link address there, as wireless-next
commit 6d531b9af16e ("wifi: mac80211: rework RX packet handling") does,
without the rest of that rework. Drop the patch with a backports release
that holds that commit.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 45b24dfa8f hostapd: match the own address of an affiliated AP on its link only
After a link removal, the frames that the driver still reports for the
removed link reach hostapd with a link that has no BSS. The lookup of
their BSS then matched the own address of the first link, which can be
the AP MLD address, and that link answered on its own channel: a
Deauthentication for a Data frame, a reply for an Authentication frame.

Match the own address of an affiliated AP on its own link only. A
received frame without a link matches an affiliated AP only where that
AP knows the sender as a station, since mt7996 reports the frames of a
non-MLO station without a link. The TX status path keeps the match.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau fc1a637f99 mac80211: skip the RCU wait on unauthorization without flush op
Since commit 06d6af4e1223 ("wifi: mac80211: flush STA queues on
unauthorization"), _sta_info_move_state() calls synchronize_net() when a
station loses AUTHORIZED on a driver with a set_key op, so that the
flush after it also covers frames that concurrent TX still queues.
NL80211_CMD_SET_STATION does not hold the RTNL, so the wait is a full
RCU grace period. Each SET_STATION that clears the authorized flag
blocks the caller for that time, once per station.

A driver without a flush or flush_sta op gets no flush, as
ieee80211_flush_queues() returns at once. The wait then protects
nothing: key removal waits for concurrent TX by itself, in
ieee80211_key_free() and in __sta_info_destroy() between the two parts
of the station destruction.

Only wait where the driver can flush.

Fixes: 06d6af4e1223 ("wifi: mac80211: flush STA queues on unauthorization")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 034eb38f48 hostapd: wait up to two beacon intervals for the frames of a removed link
The driver holds the Disassociation frame to a STA in power save or off
the channel until the STA is back, and the stop of the link dropped it
after a quarter of a beacon interval. The TX status still ends the wait.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 19ed02c950 hostapd: stop the data of a non-MLD STA at the expiry of a link removal
The call that clears the authorized flag of a STA took 12 to 62 ms at
the removal TBTT on mt7996 and held back the Disassociation frame. With
a driver that counts the AP Removal Timer, clear the flag at the expiry,
15 to 20 ms before the TBTT, and register the TBTT timeout before the
Beacon update and that call, so that neither delays it.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau f9989c02b5 hostapd: send a DPP GAS request to the AP from the link address
dpp_send_gas_req and dpp_send_gas_comeback_req of the wpa_supplicant
ucode interface send the GAS request from the MLD address. After ML
setup, a request to an AP affiliated with the AP MLD goes on the link of
that AP, and IEEE 802.11be 35.3.2 makes its TA the address of the
affiliated STA of that link. Send such a request from the link address,
as dpp_send_action does.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 655fab3f8d hostapd: put the Multi-AP element into a rejecting Association Response
hostapd adds the Multi-AP element to a (Re)Association Response only
where it accepted the STA as a backhaul STA. A backhaul STA that
multi_ap_client_disallow or an earlier check refuses thus gets a
response without the element, and does not see the bSTA Disallowed
bits.

Also add the element where the request holds a valid Multi-AP element
with the backhaul STA bit set.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau e7295e8438 hostapd: free a ubus client ban with os_free()
hostapd_bss_ban_client() allocates a ban with os_zalloc(), and
hostapd_bss_del_ban() releases it with free(). With CONFIG_WPA_TRACE,
os_zalloc() returns a pointer behind a trace header, so the free() of an
ending ban, an expired ban or the bans of a removed BSS aborts hostapd.

Release the ban with os_free().

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau fa824b9a32 hostapd: refuse a banned client MLD by its MLD address
The ubus client ban compares the source address of the frame. A client
MLD sends its Authentication frames from a link address, and its
Multi-Link element names the MLD address. A ban of the MLD address thus
misses the Authentication frame, and also a (Re)Association Request that
hostapd matches to the station by the MLD address in the Multi-Link
element.

Give the request of handle_auth() and handle_assoc() the MLD address of
a client MLD. The ban check tests the MLD address first and the link
address after it, as the ACL check of handle_auth() does, so a ban of a
link address still refuses it. The auth and assoc notifications name the
MLD address.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 45ad96f203 wpa_supplicant: report a failed reload on ubus
The reload method of wpa_supplicant.<ifname> runs RECONFIGURE and
returns 0 without reading the answer. When the configuration file cannot
be parsed, wpa_supplicant_reload_configuration() fails, the interface
keeps its old configuration, and the caller still sees a successful
reload.

Return an error when RECONFIGURE does not answer OK, like the DPP
methods do for their control commands.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau a0cdc009a5 hostapd: ucode: keep a running CAC in iface.start()
uc_hostapd_iface_start() without a frequency disables and enables an
interface in state DFS, so its CAC starts again and the kernel aborts
the first one. The setup of a radio calls it that way where
wpa_supplicant reports a station MLD as COMPLETED with no link on the
radio: iface_add() adds the AP with start_disabled, the setup starts
the CAC, and iface.start(null) then restarts it. apsta_state does the
same for a station that is INACTIVE or INTERFACE_DISABLED, and for a
station MLD that has no link on the radio.

Keep the CAC of an interface in state DFS where start() has no
frequency. The end of the CAC sets up the BSSes.

The setup after the CAC sends Beacons only for a BSS without
start_disabled. Clear start_disabled before any return, so that the
AP added with start_disabled beacons after the CAC. The early return
of a start with an unchanged channel during a CAC kept it before.

Also set conf before its first use. The path without a frequency read
conf->channel before conf was set.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau a3becb7a4c hostapd: send a DPP frame to the AP from the link address
dpp_send_action of the wpa_supplicant ucode interface sends each DPP
Public Action frame from the MLD address. After ML setup, a frame to
an AP affiliated with the AP MLD goes on the link of that AP, and IEEE
802.11be 35.3.2 makes its TA the address of the affiliated STA of that
link. Send such a frame from the link address. Between the start of an
ML authentication and the association event, a link has a BSSID and no
address yet, so send from the MLD address there.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau ebc40d094f hostapd: accept a Management frame to the AP MLD address
mac80211 gives a Management frame from an associated non-AP MLD to
hostapd with the AP MLD address as DA, but keeps a wildcard BSSID. An
AP MLD accepts the MLD address in the BSSID field alone, so it drops a
Public Action frame with the wildcard BSSID from an associated MLD,
for example a DPP Connection Status Result. Accept a DA equal to the
AP MLD address as well.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 0c815f216d hostapd: take GAS dialog token 0 in the ucode dpp_send_gas_resp
uc_hostapd_bss_dpp_send_gas_resp() refuses a dialog token of 0.
wpa_supplicant draws the token of a GAS query at random from all 256
values, and gas_serv keeps a dialog under that token, so a DPP
Configuration Response relayed for a dialog of token 0 never reaches
it. The Enrollee hears only empty comebacks until it gives up.

Take every value. 802.11 sets no nonzero condition on the token of a
GAS Initial Request.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau b06db99cef mac80211: drop a monitor-only frame after monitor delivery
With two or more monitors, or with a monitor up that does not take the
frame, ieee80211_rx_monitor() passed a frame that should_drop_frame()
rejects on to the RX path. Free it after the monitors received it, as
the branch for no monitor does.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 7423e3bd86 hostapd: keep a ubus client ban for its whole time
hostapd_bss_ban_client() passes the ban time in milliseconds as
microseconds to eloop_register_timeout(). time * 1000 wraps at 32 bits,
so a ban above 4294 s ends early, and the largest ban_time of
del_client ends after about 71.6 minutes.

Pass the seconds and the microseconds apart.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 3ae669b656 cli: use the defaults for available in the parameter name list
complete_named_params() computes the defaults and then calls the
available callback with the given parameters alone. A parameter that
is available only through a default of another parameter is missing
from the name list, in both spellings, while the command accepts it.

Show the callback the same view as the command does, with a given value
ahead of the default. Reuse the defaults that default_complete() holds.
A parameter with a default stays in the name list until it is given.

No available callback in the tree reads a default yet. Found by
inspection.

Fixes: 248b66b44f ("cli: add OpenWrt CLI")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 8176cc82d7 cli: fix completion of parameters with a list of arguments
default_complete() declares a second val in the branch for a parameter
whose args is an array, so complete_arg_list() gets null, takes the
spec of the last argument and matches nothing. Completion offers no
value for any argument of such a parameter. The same branch pads a
partial list with null, which would select the last argument too, and
complete_arg_list() empties the array that named_args holds.

Complete the argument under the cursor, and keep the arguments given so
far in named_args for the value callback, like a single value.

No module in the tree has such a parameter yet. Found by inspection.

Fixes: 248b66b44f ("cli: add OpenWrt CLI")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau 27ba5296ac hostapd: MLD STA: ignore the maximum number of links in the neighbour check
wpa_bss_get_usable_links() compares the whole MLD Capabilities And
Operations field of a neighbour link with that of the selected BSS. The
Maximum Number Of Simultaneous Links subfield of an AP MLD changes when
the AP MLD adds affiliated APs, so two scan entries of one AP MLD can
differ in it. A link whose entry dates from the start of the AP MLD is
then left out of the association, and no scan refreshes it.

Ignore that subfield in the compare, like the Recommended Max
Simultaneous Links subfield of the Extended MLD Capabilities. The kernel
needs the same change in cfg80211_mlme_check_mlo_compat(), since it
refuses the association otherwise.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau d144818f0e mac80211: allow differing max simultaneous links in assoc
cfg80211_mlme_check_mlo_compat() compares the whole MLD Capabilities And
Operations field of the association link and of each other link. The
Maximum Number Of Simultaneous Links subfield of an AP MLD changes when
the AP MLD adds affiliated APs. A Beacon does not replace the elements
of a BSS entry that came from a Probe Response, so entries of one AP MLD
can keep different values. The association then fails with "link MLD
capabilities/ops mismatch".

Ignore that subfield in the compare, like the Recommended Max
Simultaneous Links subfield of the Extended MLD Capabilities. Nothing on
the association path reads it from a BSS entry: mac80211 takes the field
from the Association Response.

Fixes: ccb964b4ab16 ("wifi: cfg80211: validate MLO connections better")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00
Felix Fietkau d61cb52517 cli: honour the available callback for empty parameters
handle_empty_param() does not call the available callback of the
parameter. "-param" is accepted while "param" is refused and completion
hides both, so "set -vxlan-id" in the unet service editor deletes the
attribute of a service that does not have this parameter.

Refuse such a parameter like its plain form, and evaluate the callback
with the same view of the defaults. An exception of the callback is
handled like one raised for the plain form.

Fixes: 248b66b44f ("cli: add OpenWrt CLI")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2026-11-15 11:17:20 +00:00