[PATCH v2 3/4] nl80211: Read a STA on an AP_VLAN interface with a get

Andrei-Alexandru Bleortu me at andrei-z.com
Fri Oct 16 16:59:55 PDT 2026


i802_read_sta_data() reads a STA as a NL80211_CMD_GET_STATION dump of
the AP interface. A kernel without NL80211_ATTR_STA_DUMP_LINK_STATS does
not filter that dump by NL80211_ATTR_MAC, and a dump lists only the STAs
of that one interface: a STA that dynamic VLAN bound to an AP_VLAN
interface is not in it. Every read of such a STA returned no data, so its
counters read zero and its inactive time stayed 0: the inactivity check
never removed it and RADIUS accounting reported no traffic.

When the dump does not have the STA, get it with a non-dump
NL80211_CMD_GET_STATION, which mac80211 resolves on the AP_VLAN
interfaces as well.

Assisted-by: LLM
Signed-off-by: Andrei-Alexandru Bleortu <me at andrei-z.com>
---
 src/drivers/driver_nl80211.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index f88594e27..25268896f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -8779,6 +8779,7 @@ static int get_link_sta_stats(struct hostap_sta_driver_data *data,
 struct get_sta_arg {
 	const u8 *addr;
 	struct hostap_sta_driver_data *data;
+	bool found;
 };
 
 static int get_sta_handler(struct nl_msg *msg, void *arg)
@@ -8837,6 +8838,7 @@ static int get_sta_handler(struct nl_msg *msg, void *arg)
 	if (!tb[NL80211_ATTR_MAC] ||
 	    !ether_addr_equal(nla_data(tb[NL80211_ATTR_MAC]), ctx->addr))
 		return NL_SKIP;
+	ctx->found = true;
 
 	if (!tb[NL80211_ATTR_STA_INFO] && !tb[NL80211_ATTR_MLO_LINKS]) {
 		wpa_printf(MSG_DEBUG, "sta stats missing!");
@@ -9106,6 +9108,7 @@ static int i802_read_sta_data(struct i802_bss *bss,
 {
 	struct get_sta_arg arg = { .addr = addr, .data = data };
 	struct nl_msg *msg;
+	int ret;
 
 	if (!(msg = nl80211_bss_msg(bss, NLM_F_DUMP,
 				    NL80211_CMD_GET_STATION)) ||
@@ -9115,6 +9118,21 @@ static int i802_read_sta_data(struct i802_bss *bss,
 		return -ENOBUFS;
 	}
 
+	ret = send_and_recv_resp(bss->drv, msg, get_sta_handler, &arg);
+	if (ret || arg.found)
+		return ret;
+
+	/*
+	 * A dump that is not filtered by NL80211_ATTR_MAC (a kernel without
+	 * NL80211_ATTR_STA_DUMP_LINK_STATS) lists only the STAs of this
+	 * interface, not those bound to one of its AP_VLAN interfaces; a get
+	 * finds those too.
+	 */
+	if (!(msg = nl80211_bss_msg(bss, 0, NL80211_CMD_GET_STATION)) ||
+	    nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) {
+		nlmsg_free(msg);
+		return -ENOBUFS;
+	}
 	return send_and_recv_resp(bss->drv, msg, get_sta_handler, &arg);
 }
 
-- 
2.47.3





More information about the Hostap mailing list