[PATCH 4/6] hostapd_cli: MLO: add status command for MLD socket

Aditya Kumar Singh quic_adisi at quicinc.com
Mon Apr 22 22:31:26 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 4654766b4014..a825bfb6711c 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -4587,6 +4587,49 @@ static int hostapd_mld_ctrl_iface_detach(struct hostapd_mld *mld,
 }
 
 
+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,
@@ -4653,6 +4696,9 @@ static int hostapd_mld_ctrl_iface_receive_process(struct hostapd_mld *mld,
 	} else if (os_strcmp(buf, "DETACH") == 0) {
 		if (hostapd_mld_ctrl_iface_detach(mld, 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, "Link ID not provided, using first link BSS (if available)");
-- 
2.34.1




More information about the Hostap mailing list