[PATCH v2 00/11] wifi_stats: WBA Connect-Info in RADIUS
Iegor Sergieienkov
iegor at nova-labs.com
Mon Nov 23 04:50:20 PST 2026
This series adds optional per-station link statistics collection to
hostapd and uses the result to fill the RADIUS Connect-Info attribute
(RFC 2869) in the format defined in draft-ietf-radext-connectinfo-02,
"Connect-Info Attribute for Wi-Fi Networks" (2 November 2026). The draft
is the RADEXT working group adoption of draft-grayson-connectinfo, which
v1 of this series followed.
Everything is behind CONFIG_WIFI_STATS, which is not enabled by default,
and, new in v2, behind wifi_stats_wba_enabled=1 at runtime, which is not
set by default either. With both, the attribute of a station of an HT20
AP on channel 1 under mac80211_hwsim changes from
CONNECT 54Mbps 802.11g
to
CONNECT 144.44 Mbps 802.11n Channel:1 RSSI:-30(AVG-LIN 7S)
TxBitRate:6.5(MAX 7S) RxBitRate:13.0(MAX 7S) FrameLoss:0(ACC 7S)
FrameRetry:0(ACC 7S) Global-OC:81
(one line on the wire) and a station of an AP MLD reports, e.g.,
CONNECT 2752.94 Mbps 802.11be Channel:1 RSSI:-50(AVG-LIN 1S)
Global-OC:81(Link-ID:0) Global-OC:81(Link-ID:1)
Prerequisite
The series depends on "nl80211: Station reads on kernels that do not
filter the station dump" v2 by Andrei-Alexandru Bleortu, which is on the
list but not applied yet:
https://patchwork.ozlabs.org/project/hostap/list/?series=528409
Patch 2 uses get_sta_handler() with struct get_sta_arg from its first
patch, and without that series every station read returns the data of
the last station of the dump on the kernels I tested (6.8). The patches
here apply on top of main (f5eda105b) with that series applied; the
base-commit and prerequisite-patch-id trailers below say the same.
Earlier discussion
The format was discussed on this list in October 2025 ("WBA/IETF
Connect-Info Implementation under way"). Two points made there about
draft-grayson-connectinfo-04 are addressed by the current draft and by
this implementation:
- TxBitRate and RxBitRate were "the latest" rates. They are now
aggregates over the period since the previous report or over a time
window (Section 4.2 of the draft), and so are RSSI and the loss and
retry rates. hostapd reports the algorithm and the span with each
value.
- The items that do not describe the connection (noise, channel
utilization, backhaul, station count) are no longer part of the
format. What remains besides the per-station metrics is the maximum
rate and the amendment of the BSS, the channel, and the global
operating class.
The draft keeps the per-station metrics in Connect-Info instead of
defining VSAs for them, and this series implements the draft as it is.
The maximum rate, amendment, channel, and operating class are produced
by code that does not depend on the statistics collection, so if only
that part is of interest for now, I can split the series accordingly.
Changes since v1
- Follows draft-ietf-radext-connectinfo-02: MAXSPEED and the amendment
describe the BSS and MAXSPEED is computed with the formula of the
draft, RATE has five integer digits and SAMPLE four, an MLD station
reports one Global-OC for each link with its Link-ID, and its
metrics are combined over its links.
- Disabled by default at runtime (wifi_stats_wba_enabled=0).
- The default span is a sliding window instead of the period since the
previous accounting report; the latter remains available.
- The ten WIFI_STATS_SET_*/GET_* control interface commands are gone.
The settings are changed with SET and take effect immediately; only
WIFI_STATS_STATUS and WIFI_STATS_CONNECT_INFO remain.
- All stations of a BSS are read with one station dump per interval
through a new driver op instead of one request for each station
(patches 1 and 2).
- Only samples taken after frames were exchanged with the station are
aggregated, the loss and retry rates need at least 20 frames, and a
value that cannot be read is left out.
- AVG-EXP is a filter that runs for the whole association.
- The module moved from src/wifi_stats/ to src/ap/, uses the monotonic
clock, and has no #ifdef at its call sites.
- Module tests (patch 9) and 15 more hwsim test cases, including an AP
MLD.
- The build rules moved after the code, so each patch builds with
CONFIG_WIFI_STATS both set and not set.
Notes
- The Access-Request messages of RADIUS-based MAC ACL and PSK still
carry the fixed "CONNECT 11Mbps 802.11b".
- For a BSS with UHR enabled the amendment is reported as 802.11bn,
which the list of amendments in the draft does not include yet.
- Each link of an AP MLD requests its own station dump per interval.
Testing
Each patch was built from tests/hwsim/example-hostapd.config with and
without CONFIG_WIFI_STATS. On mac80211_hwsim (kernel 6.8), the 46 test
cases of patch 11 pass with one exception outside of this series:
after wifi_stats_mlo_accounting has passed its checks, hostapd crashes
when the last link of the AP MLD is removed (accounting_deinit() ->
accounting_report_state() -> radius_client_send() ->
radius_msg_finish_acct(), no wifi_stats function in the backtrace). It
looks like an issue of RADIUS accounting with an AP MLD at interface
removal; I have not analyzed it further. Without wmediumd,
mac80211_hwsim reports no TX retries, so the FrameLoss and FrameRetry
checks cover only the form of the values.
Iegor Sergieienkov (11):
nl80211: Parse per-link station statistics
nl80211: Add a driver op to read all stations
wifi_stats: Add per-STA statistics collection and aggregation module
wifi_stats: hostapd configuration parameters
wifi_stats: Integration into hostapd
wifi_stats: Use WBA Connect-Info format in RADIUS attributes
wifi_stats: hostapd control interface and hostapd_cli commands
wifi_stats: Add build rules for hostapd
wifi_stats: Add module tests
tests: Add a Connect-Info ABNF validator
tests: wifi_stats WBA Connect-Info
hostapd/Makefile | 8 +
hostapd/config_file.c | 102 ++
hostapd/ctrl_iface.c | 49 +
hostapd/defconfig | 4 +
hostapd/hapd_module_tests.c | 10 +-
hostapd/hostapd.conf | 82 +
hostapd/hostapd_cli.c | 23 +
src/ap/accounting.c | 13 +-
src/ap/ap_config.c | 7 +
src/ap/ap_config.h | 13 +
src/ap/ap_drv_ops.h | 12 +
src/ap/hostapd.c | 13 +
src/ap/hostapd.h | 4 +
src/ap/ieee802_1x.c | 5 +-
src/ap/sta_info.c | 3 +
src/ap/sta_info.h | 4 +
src/ap/wifi_stats.c | 2260 ++++++++++++++++++++++++++++
src/ap/wifi_stats.h | 118 ++
src/ap/wifi_stats_i.h | 87 ++
src/ap/wifi_stats_module_tests.c | 580 +++++++
src/drivers/driver.h | 37 +
src/drivers/driver_nl80211.c | 121 ++
src/utils/module_tests.h | 1 +
tests/hwsim/connectinfo_abnf.py | 495 ++++++
tests/hwsim/dictionary.radius | 6 +
tests/hwsim/example-hostapd.config | 2 +
tests/hwsim/test_ap_wifi_stats.py | 1961 ++++++++++++++++++++++++
27 files changed, 6014 insertions(+), 6 deletions(-)
create mode 100644 src/ap/wifi_stats.c
create mode 100644 src/ap/wifi_stats.h
create mode 100644 src/ap/wifi_stats_i.h
create mode 100644 src/ap/wifi_stats_module_tests.c
create mode 100755 tests/hwsim/connectinfo_abnf.py
create mode 100644 tests/hwsim/test_ap_wifi_stats.py
base-commit: f5eda105b5b26df4f5d0fefe1706ff6cd925af8b
prerequisite-patch-id: 4e381a58972d61c06c52064256ffe5a539e33942
prerequisite-patch-id: c7f7b3d1579bded6b0137dce93275b5d60f83f57
prerequisite-patch-id: 6858fd59892ed9ca071b863e065ad1e7f7ac4bf0
prerequisite-patch-id: 751d2c6b2e309fd73282c61257fd00ca566ed796
--
2.43.0
More information about the Hostap
mailing list