diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 198ac562d..c1664d043 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -10745,6 +10745,16 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strncmp(buf, "DPP_PKEX_REMOVE ", 16) == 0) { if (wpas_dpp_pkex_remove(wpa_s, buf + 16) < 0) reply_len = -1; +#ifdef CONFIG_DPP2 + } else if (os_strncmp(buf, "DPP_CONTROLLER_START ", 21) == 0) { + if (wpas_dpp_controller_start(wpa_s, buf + 20) < 0) + reply_len = -1; + } else if (os_strcmp(buf, "DPP_CONTROLLER_START") == 0) { + if (wpas_dpp_controller_start(wpa_s, NULL) < 0) + reply_len = -1; + } else if (os_strcmp(buf, "DPP_CONTROLLER_STOP") == 0) { + dpp_controller_stop(wpa_s->dpp); +#endif /* CONFIG_DPP2 */ #endif /* CONFIG_DPP */ } else { os_memcpy(reply, "UNKNOWN COMMAND\n", 16); diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index 4cfbbcba7..c808f2ce4 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -11,6 +11,7 @@ #include "utils/common.h" #include "utils/eloop.h" +#include "utils/ip_addr.h" #include "common/dpp.h" #include "common/gas.h" #include "common/gas_server.h" @@ -2248,3 +2249,23 @@ void wpas_dpp_deinit(struct wpa_supplicant *wpa_s) os_free(wpa_s->dpp_configurator_params); wpa_s->dpp_configurator_params = NULL; } + + +#ifdef CONFIG_DPP2 +int wpas_dpp_controller_start(struct wpa_supplicant *wpa_s, const char *cmd) +{ + struct dpp_controller_config config; + const char *pos; + + os_memset(&config, 0, sizeof(config)); + if (cmd) { + pos = os_strstr(cmd, " tcp_port="); + if (pos) { + pos += 10; + config.tcp_port = atoi(pos); + } + } + config.configurator_params = wpa_s->dpp_configurator_params; + return dpp_controller_start(wpa_s->dpp, &config); +} +#endif /* CONFIG_DPP2 */ diff --git a/wpa_supplicant/dpp_supplicant.h b/wpa_supplicant/dpp_supplicant.h index ecb7a7d68..9ba315f55 100644 --- a/wpa_supplicant/dpp_supplicant.h +++ b/wpa_supplicant/dpp_supplicant.h @@ -25,5 +25,6 @@ int wpas_dpp_init(struct wpa_supplicant *wpa_s); void wpas_dpp_deinit(struct wpa_supplicant *wpa_s); int wpas_dpp_check_connect(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct wpa_bss *bss); +int wpas_dpp_controller_start(struct wpa_supplicant *wpa_s, const char *cmd); #endif /* DPP_SUPPLICANT_H */