@@ -1962,6 +1962,45 @@ static void wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[])
} else if (count == 0) {
printf("Unknown command '%s'\n", argv[0]);
} else {
+#ifdef CONFIG_IEEE80211BE
+ char *pos, *end;
+ int i, j, link_id;
+ bool link_found = false;
+
+ wpa_ctrl_reset_mld_link(ctrl);
+ i = 0;
+
+ while (i < argc) {
+ pos = os_strstr(argv[i], "link_id=");
+ if (!pos) {
+ i++;
+ continue;
+ }
+
+ pos = pos + 8;
+ link_id = strtol(pos, &end, 10);
+
+ if (link_id < 0 || link_id >= 15) {
+ printf("Invalid link ID '%d'\n", link_id);
+ return;
+ }
+
+ link_found = true;
+
+ /* remove this link_id= from the arguements */
+ for (j = i + 1; j < argc; j++)
+ argv[j - 1] = argv[j];
+
+ argc--;
+ i = 0;
+ }
+
+ if (link_found) {
+ wpa_ctrl_set_mld_link(ctrl, link_id);
+ printf("Command for '%s'\n",
+ wpa_ctrl_get_mld_link(ctrl));
+ }
+#endif /* CONFIG_IEEE80211BE */
match->handler(ctrl, argc - 1, &argv[1]);
}
}
@@ -72,6 +72,13 @@ struct wpa_ctrl {
#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
HANDLE pipe;
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+#ifdef CONFIG_IEEE80211BE
+ /* 'LINKID ' - 7 chars including space
+ * 'XX' - Two chars max for link id
+ * Total required 10 chars at least
+ */
+ char link_id_str[10];
+#endif /* CONFIG_IEEE80211BE */
};
@@ -488,6 +495,7 @@ int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
fd_set rfds;
const char *_cmd;
char *cmd_buf = NULL;
+ char *link_cmd_buf = NULL;
size_t _cmd_len;
#ifdef CONFIG_CTRL_IFACE_UDP
@@ -510,6 +518,28 @@ int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
_cmd_len = cmd_len;
}
+#ifdef CONFIG_IEEE80211BE
+ if (os_strlen(ctrl->link_id_str)) {
+ char *pos;
+
+ _cmd_len = _cmd_len + 1 + os_strlen(ctrl->link_id_str);
+ link_cmd_buf = os_malloc(_cmd_len);
+ if (link_cmd_buf == NULL) {
+ if (cmd_buf)
+ os_free(cmd_buf);
+ return -1;
+ }
+
+ pos = link_cmd_buf;
+ os_strlcpy(pos, _cmd, _cmd_len);
+ pos += os_strlen(_cmd);
+ *pos++ = ' ';
+ os_memcpy(pos, ctrl->link_id_str, os_strlen(ctrl->link_id_str));
+ _cmd = link_cmd_buf;
+ wpa_ctrl_reset_mld_link(ctrl);
+ }
+#endif /* CONFIG_IEEE80211BE */
+
errno = 0;
started_at.sec = 0;
started_at.usec = 0;
@@ -535,9 +565,11 @@ retry_send:
}
send_err:
os_free(cmd_buf);
+ os_free(link_cmd_buf);
return -1;
}
os_free(cmd_buf);
+ os_free(link_cmd_buf);
os_get_reltime(&ending_at);
ending_at.sec += 10;
@@ -773,4 +805,26 @@ int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl)
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+
+#ifdef CONFIG_IEEE80211BE
+void wpa_ctrl_reset_mld_link(struct wpa_ctrl *ctrl)
+{
+ os_memset(ctrl->link_id_str, '\0', sizeof(ctrl->link_id_str));
+}
+
+
+void wpa_ctrl_set_mld_link(struct wpa_ctrl *ctrl, int link_id)
+{
+ os_snprintf(ctrl->link_id_str, sizeof(ctrl->link_id_str),
+ "LINKID %d", link_id);
+}
+
+
+char *wpa_ctrl_get_mld_link(struct wpa_ctrl *ctrl)
+{
+ return ctrl->link_id_str;
+}
+#endif /* CONFIG_IEEE80211BE */
+
+
#endif /* CONFIG_CTRL_IFACE */
@@ -676,6 +676,9 @@ char * wpa_ctrl_get_remote_ifname(struct wpa_ctrl *ctrl);
#ifdef CONFIG_IEEE80211BE
#define WPA_CTRL_IFACE_LINK_NAME "link"
+void wpa_ctrl_reset_mld_link(struct wpa_ctrl *ctrl);
+void wpa_ctrl_set_mld_link(struct wpa_ctrl *ctrl, int link_id);
+char *wpa_ctrl_get_mld_link(struct wpa_ctrl *ctrl);
#endif /* CONFIG_IEEE80211BE */
#endif /* WPA_CTRL_H */