diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 4f715603d..ca2971389 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -11540,6 +11540,37 @@ static int wpas_ctrl_iface_send_dscp_query(struct wpa_supplicant *wpa_s, } +static int wpas_ctrl_iface_mlo_status(struct wpa_supplicant *wpa_s, + char *buf, size_t buflen) +{ + int ret, i; + char *pos, *end; + + if (!wpa_s->valid_links) + return -1; + + pos = buf; + end = buf + buflen; + + for (i = 0; i < MAX_NUM_MLD_LINKS; i++) { + if (!(wpa_s->valid_links & BIT(i))) + continue; + + ret = os_snprintf(pos, end - pos, "link_id=%d\nfreq=%u\n" + "ap_link_addr=" MACSTR + "\nsta_link_addr=" MACSTR "\n", + i, wpa_s->links[i].freq, + MAC2STR(wpa_s->links[i].bssid), + MAC2STR(wpa_s->links[i].addr)); + if (os_snprintf_error(end - pos, ret)) + return pos - buf; + pos += ret; + } + + return pos - buf; +} + + char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, char *buf, size_t *resp_len) { @@ -12554,6 +12585,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "DSCP_QUERY ", 11) == 0) { if (wpas_ctrl_iface_send_dscp_query(wpa_s, buf + 11)) reply_len = -1; + } else if (os_strcmp(buf, "MLO_STATUS") == 0) { + reply_len = wpas_ctrl_iface_mlo_status(wpa_s, reply, + reply_size); } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); reply_len = 16; diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 4b8d9ef1e..d4d09adc2 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -413,6 +413,12 @@ static int wpa_cli_cmd_quit(struct wpa_ctrl *ctrl, int argc, char *argv[]) } +static int wpa_cli_cmd_mlo_status(struct wpa_ctrl *ctrl, int argc, char *argv[]) +{ + return wpa_ctrl_command(ctrl, "MLO_STATUS"); +} + + static int wpa_cli_cmd_set(struct wpa_ctrl *ctrl, int argc, char *argv[]) { char cmd[256]; @@ -4037,6 +4043,9 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = { { "dscp_query", wpa_cli_cmd_dscp_query, NULL, cli_cmd_flag_none, "wildcard/domain_name= = Send DSCP Query" }, + { "mlo_status", wpa_cli_cmd_mlo_status, NULL, + cli_cmd_flag_none, + "= get MLO status" }, { NULL, NULL, NULL, cli_cmd_flag_none, NULL } };