From 8d434bf65ca4e19b86c3d19a1287a3f4631e0fe5 Mon Sep 17 00:00:00 2001 From: Harshitha Prem Date: Thu, 28 Mar 2024 23:46:49 +0530 Subject: [PATCH] AP MLD: Add link details in STATUS command Include link ID and partner link details in the STATUS command output for AP MLDs. The details would be seen as below for an AP MLD interface: $ hostapd_cli -i wlan0 status | grep link num_links=1 link_id=0 link_addr=AA:BB:CC:DD:EE:FF $ hostapd_cli -i wlan1 status | grep link num_links=2 link_id=0 link_addr=AA:BB:CC:DD:EE:FF partner_link[1]=AA:BB:CC:DD:EE:AA Signed-off-by: Harshitha Prem Co-developed-by: Manish Dharanenthiran Signed-off-by: Manish Dharanenthiran Signed-off-by: Aditya Kumar Singh --- src/ap/ctrl_iface_ap.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index eac060654..1acb97f9b 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -902,6 +902,42 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, return len; len += ret; } + + if (hapd->conf->mld_ap) { + struct hostapd_data *link_bss; + + ret = os_snprintf(buf + len, buflen - len, + "num_links=%d\n", + hapd->mld->num_links); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + + /* Self BSS */ + ret = os_snprintf(buf + len, buflen - len, + "link_id=%d\n" + "link_addr=" MACSTR "\n", + hapd->mld_link_id, + MAC2STR(hapd->own_addr)); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + + /* Partner BSSs */ + for_each_mld_link(link_bss, hapd) { + if (link_bss == hapd) + continue; + + ret = os_snprintf(buf + len, buflen - len, + "partner_link[%d]=" MACSTR + "\n", + link_bss->mld_link_id, + MAC2STR(link_bss->own_addr)); + if (os_snprintf_error(buflen - len, ret)) + return len; + len += ret; + } + } } #endif /* CONFIG_IEEE80211BE */