]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
MLD STA: Add MLO_STATUS control interface command
authorShivani Baranwal <quic_shivbara@quicinc.com>
Thu, 8 Sep 2022 14:44:20 +0000 (20:14 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 15 Sep 2022 13:00:51 +0000 (16:00 +0300)
Add support for MLO_STATUS control interface command to indicate
per-link information.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_cli.c

index 4f715603dfd17a801adf947472c2b1e7337bf58f..ca2971389ae3161021631f0aeeacbefa81f2454c 100644 (file)
@@ -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;
index 4b8d9ef1eeccfad630a3d056bf7dfb1ef444ab0e..d4d09adc2e0d44423bb45d4383e617866f0bbc69 100644 (file)
@@ -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=<string> = 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 }
 };