[PATCH 2/3] hostapd: ctrl_iface: add LINK_STA command

Johannes Berg johannes at sipsolutions.net
Fri Sep 11 07:21:57 PDT 2026


From: Johannes Berg <johannes.berg at intel.com>

This can be used to look up a station by link address.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 hostapd/ctrl_iface.c   |  5 +++++
 src/ap/ctrl_iface_ap.c | 19 +++++++++++++++++++
 src/ap/ctrl_iface_ap.h |  4 ++++
 3 files changed, 28 insertions(+)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index dc36b302de57..49b163aaf4a5 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -4310,6 +4310,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
 	} else if (os_strncmp(buf, "STA ", 4) == 0) {
 		reply_len = hostapd_ctrl_iface_sta(hapd, buf + 4, reply,
 						   reply_size);
+#ifdef CONFIG_IEEE80211BE
+	} else if (os_strncmp(buf, "LINK_STA ", 9) == 0) {
+		reply_len = hostapd_ctrl_iface_link_sta(hapd, buf + 9, reply,
+							reply_size);
+#endif /* CONFIG_IEEE80211BE */
 	} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
 		reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
 							reply_size);
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 57ec4f6ec12d..223f9601623a 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -587,6 +587,25 @@ int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr,
 }
 
 
+#ifdef CONFIG_IEEE80211BE
+int hostapd_ctrl_iface_link_sta(struct hostapd_data *hapd,
+				const char *txtaddr, char *buf, size_t buflen)
+{
+	u8 addr[ETH_ALEN];
+	struct sta_info *sta;
+
+	if (hwaddr_aton(txtaddr, addr))
+		return -1;
+
+	sta = ap_get_link_sta(hapd, addr);
+	if (!sta)
+		return -1;
+
+	return hostapd_ctrl_iface_sta_mib(hapd, sta, buf, buflen);
+}
+#endif /* CONFIG_IEEE80211BE */
+
+
 #ifdef CONFIG_P2P_MANAGER
 static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
 				  u8 minor_reason_code, const u8 *addr)
diff --git a/src/ap/ctrl_iface_ap.h b/src/ap/ctrl_iface_ap.h
index 4de140844f0b..e2add32570c6 100644
--- a/src/ap/ctrl_iface_ap.h
+++ b/src/ap/ctrl_iface_ap.h
@@ -15,6 +15,10 @@ int hostapd_ctrl_iface_sta(struct hostapd_data *hapd, const char *txtaddr,
 			   char *buf, size_t buflen);
 int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr,
 				char *buf, size_t buflen);
+#ifdef CONFIG_IEEE80211BE
+int hostapd_ctrl_iface_link_sta(struct hostapd_data *hapd,
+				const char *txtaddr, char *buf, size_t buflen);
+#endif /* CONFIG_IEEE80211BE */
 int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd,
 				      const char *txtaddr);
 int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd,
-- 
2.55.0




More information about the Hostap mailing list