|
@@ -5822,6 +5822,102 @@ static char * wpas_global_ctrl_iface_ifname(struct wpa_global *global,
|
|
|
}
|
|
|
|
|
|
|
|
|
+static char * wpas_global_ctrl_iface_redir_p2p(struct wpa_global *global,
|
|
|
+ char *buf, size_t *resp_len)
|
|
|
+{
|
|
|
+#ifdef CONFIG_P2P
|
|
|
+ static const char * cmd[] = {
|
|
|
+ "P2P_FIND",
|
|
|
+ "P2P_STOP_FIND",
|
|
|
+ "P2P_LISTEN",
|
|
|
+ "P2P_GROUP_ADD",
|
|
|
+ "P2P_GET_PASSPHRASE",
|
|
|
+ "P2P_SERVICE_UPDATE",
|
|
|
+ "P2P_SERVICE_FLUSH",
|
|
|
+ "P2P_FLUSH",
|
|
|
+ "P2P_CANCEL",
|
|
|
+ "P2P_PRESENCE_REQ",
|
|
|
+ "P2P_EXT_LISTEN",
|
|
|
+ NULL
|
|
|
+ };
|
|
|
+ static const char * prefix[] = {
|
|
|
+ "P2P_FIND ",
|
|
|
+ "P2P_CONNECT ",
|
|
|
+ "P2P_LISTEN ",
|
|
|
+ "P2P_GROUP_REMOVE ",
|
|
|
+ "P2P_GROUP_ADD ",
|
|
|
+ "P2P_PROV_DISC ",
|
|
|
+ "P2P_SERV_DISC_REQ ",
|
|
|
+ "P2P_SERV_DISC_CANCEL_REQ ",
|
|
|
+ "P2P_SERV_DISC_RESP ",
|
|
|
+ "P2P_SERV_DISC_EXTERNAL ",
|
|
|
+ "P2P_SERVICE_ADD ",
|
|
|
+ "P2P_SERVICE_DEL ",
|
|
|
+ "P2P_REJECT ",
|
|
|
+ "P2P_INVITE ",
|
|
|
+ "P2P_PEER ",
|
|
|
+ "P2P_SET ",
|
|
|
+ "P2P_UNAUTHORIZE ",
|
|
|
+ "P2P_PRESENCE_REQ ",
|
|
|
+ "P2P_EXT_LISTEN ",
|
|
|
+ NULL
|
|
|
+ };
|
|
|
+ int found = 0;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ if (global->p2p_init_wpa_s == NULL)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+ for (i = 0; !found && cmd[i]; i++) {
|
|
|
+ if (os_strcmp(buf, cmd[i]) == 0)
|
|
|
+ found = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = 0; !found && prefix[i]; i++) {
|
|
|
+ if (os_strncmp(buf, prefix[i], os_strlen(prefix[i])) == 0)
|
|
|
+ found = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (found)
|
|
|
+ return wpa_supplicant_ctrl_iface_process(global->p2p_init_wpa_s,
|
|
|
+ buf, resp_len);
|
|
|
+#endif /* CONFIG_P2P */
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static char * wpas_global_ctrl_iface_redir_wfd(struct wpa_global *global,
|
|
|
+ char *buf, size_t *resp_len)
|
|
|
+{
|
|
|
+#ifdef CONFIG_WIFI_DISPLAY
|
|
|
+ if (global->p2p_init_wpa_s == NULL)
|
|
|
+ return NULL;
|
|
|
+ if (os_strncmp(buf, "WFD_SUBELEM_SET ", 16) == 0 ||
|
|
|
+ os_strncmp(buf, "WFD_SUBELEM_GET ", 16) == 0)
|
|
|
+ return wpa_supplicant_ctrl_iface_process(global->p2p_init_wpa_s,
|
|
|
+ buf, resp_len);
|
|
|
+#endif /* CONFIG_WIFI_DISPLAY */
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static char * wpas_global_ctrl_iface_redir(struct wpa_global *global,
|
|
|
+ char *buf, size_t *resp_len)
|
|
|
+{
|
|
|
+ char *ret;
|
|
|
+
|
|
|
+ ret = wpas_global_ctrl_iface_redir_p2p(global, buf, resp_len);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ ret = wpas_global_ctrl_iface_redir_wfd(global, buf, resp_len);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
|
|
|
char *buf, size_t *resp_len)
|
|
|
{
|
|
@@ -5840,6 +5936,10 @@ char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ reply = wpas_global_ctrl_iface_redir(global, buf, resp_len);
|
|
|
+ if (reply)
|
|
|
+ return reply;
|
|
|
+
|
|
|
if (os_strcmp(buf, "PING") == 0)
|
|
|
level = MSG_EXCESSIVE;
|
|
|
wpa_hexdump_ascii(level, "RX global ctrl_iface",
|