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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 hostapd/ctrl_iface.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 5fe29147fa38..a584d370edfe 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -4700,6 +4700,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,
@@ -4766,6 +4809,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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux