]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: wpa_supplicant as Controller over TCP
authorJouni Malinen <jouni@codeaurora.org>
Sun, 24 Mar 2019 20:17:49 +0000 (22:17 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 22 Apr 2019 18:08:59 +0000 (21:08 +0300)
New wpa_supplicant control interface commands "DPP_CONTROLLER_START
[tcp_port=<port>]" and "DPP_CONTROLLER_STOP" can be used to start and
stop listening to DPP requests over TCP in the Responder role. The TCP
connections are processed similarly to the ones that would have been
received over DPP Public Action frames.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/dpp_supplicant.c
wpa_supplicant/dpp_supplicant.h

index 198ac562d8b6afdbfa949aa7ef19dc179bac514f..c1664d043673e7b502ebc4ef149ff2114ce3a10b 100644 (file)
@@ -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);
index 4cfbbcba7a0ae6aa828ae43365e021337d296075..c808f2ce4a7117625f253a3b11503f8ef8d7014e 100644 (file)
@@ -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 */
index ecb7a7d684fa338b65eaf1523d228e816f0085f7..9ba315f55254b80f122df614577d41ba80b67df8 100644 (file)
@@ -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 */