[PATCH v4 4/6] hostapd_cli: MLO: add status command for MLD socket
Aditya Kumar Singh
quic_adisi at quicinc.com
Mon Aug 12 21:41:37 PDT 2024
Add MLD level 'status' command. Currently each link level socket has got
'status' command. When the same is passed on MLD level socket without any
link id, it routes it to first BSS of the MLD if available. Handle this
now properly.
If link id is not passed then it will be treated as MLD level status
command.
$ hostapd_cli -i wlan0
....
Interactive mode
> status
name=wlan0
mld_address=AA:BB:CC:DD:EE:FF
num_links=2
LINK INFORMATION
link_id=0
link_addr=AA:BB:CC:DD:EE:EE
link_id=1
link_addr=AA:BB:CC:DD:FF:FF
Signed-off-by: Aditya Kumar Singh <quic_adisi at quicinc.com>
---
hostapd/ctrl_iface.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index fe46c37a7930..e868b826d040 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -4724,6 +4724,49 @@ done:
#ifdef CONFIG_IEEE80211BE
#ifndef CONFIG_CTRL_IFACE_UDP
+int hostapd_ctrl_mld_iface_status(struct hostapd_mld *mld, char *buf,
+ size_t buflen)
+{
+ struct hostapd_data *link_hapd;
+ int len = 0, ret;
+
+ ret = os_snprintf(buf + len, buflen - len,
+ "name=%s\n"
+ "mld_address=" MACSTR "\n"
+ "num_links=%d\n",
+ mld->name, MAC2STR(mld->mld_addr), mld->num_links);
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+
+ if (!mld->fbss) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "\n No Link information present\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
+
+ ret = os_snprintf(buf + len, buflen - len,
+ "LINK INFORMATION\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+
+ dl_list_for_each(link_hapd, &mld->links, struct hostapd_data, link) {
+ ret = os_snprintf(buf + len, buflen - len,
+ "link_id=%d\n"
+ "link_addr=" MACSTR "\n",
+ link_hapd->mld_link_id, MAC2STR(link_hapd->own_addr));
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ }
+
+ return len;
+}
+
+
static int hostapd_mld_ctrl_iface_receive_process(struct hostapd_mld *mld,
char *buf, char *reply,
int reply_size,
@@ -4784,6 +4827,9 @@ static int hostapd_mld_ctrl_iface_receive_process(struct hostapd_mld *mld,
} else if (os_strcmp(cmd, "DETACH") == 0) {
if (ctrl_iface_detach(&mld->ctrl_dst, from, fromlen))
reply_len = -1;
+ } else if (os_strcmp(buf, "STATUS") == 0 && link_id == -1){
+ reply_len = hostapd_ctrl_mld_iface_status(mld, reply,
+ reply_size);
} else {
if (link_id == -1)
wpa_printf(MSG_DEBUG,
--
2.34.1
More information about the Hostap
mailing list