]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Add DPP_BOOTSTRAP_INFO command
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 22 Jun 2017 11:51:21 +0000 (14:51 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 22 Jun 2017 11:51:21 +0000 (14:51 +0300)
This can be used to fetch parsed details on bootstrapping information.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/dpp_supplicant.c
wpa_supplicant/dpp_supplicant.h
wpa_supplicant/wpa_cli.c

index 61ea6392eb90603edf0110aa4dcba08e923c6829..c088aa2816f2a983aace123b3d9950e09dfe8885 100644 (file)
@@ -10226,6 +10226,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                        if (os_snprintf_error(reply_size, reply_len))
                                reply_len = -1;
                }
+       } else if (os_strncmp(buf, "DPP_BOOTSTRAP_INFO ", 19) == 0) {
+               reply_len = wpas_dpp_bootstrap_info(wpa_s, atoi(buf + 19),
+                                                   reply, reply_size);
        } else if (os_strncmp(buf, "DPP_AUTH_INIT ", 14) == 0) {
                if (wpas_dpp_auth_init(wpa_s, buf + 13) < 0)
                        reply_len = -1;
index edc61baf7ab954d0aca85878273e780254374236..66cbb796d75a4e3df96852746a982b397f696d8e 100644 (file)
@@ -276,6 +276,37 @@ const char * wpas_dpp_bootstrap_get_uri(struct wpa_supplicant *wpa_s,
 }
 
 
+static const char * wpas_dpp_bootstrap_type(enum dpp_bootstrap_type type)
+{
+       switch (type) {
+       case DPP_BOOTSTRAP_QR_CODE:
+               return "QRCODE";
+       }
+       return "??";
+}
+
+
+int wpas_dpp_bootstrap_info(struct wpa_supplicant *wpa_s, int id,
+                           char *reply, int reply_size)
+{
+       struct dpp_bootstrap_info *bi;
+
+       bi = dpp_bootstrap_get_id(wpa_s, id);
+       if (!bi)
+               return -1;
+       return os_snprintf(reply, reply_size, "type=%s\n"
+                          "mac_addr=" MACSTR "\n"
+                          "info=%s\n"
+                          "num_freq=%u\n"
+                          "curve=%s\n",
+                          wpas_dpp_bootstrap_type(bi->type),
+                          MAC2STR(bi->mac_addr),
+                          bi->info ? bi->info : "",
+                          bi->num_freq,
+                          bi->curve->name);
+}
+
+
 static void wpas_dpp_tx_status(struct wpa_supplicant *wpa_s,
                               unsigned int freq, const u8 *dst,
                               const u8 *src, const u8 *bssid,
index 6748f7c01fdb2c2b6a13e6d530fd91fde40b9047..537cdef0e9e24a71114a24e48424818c68d73d72 100644 (file)
@@ -14,6 +14,8 @@ int wpas_dpp_bootstrap_gen(struct wpa_supplicant *wpa_s, const char *cmd);
 int wpas_dpp_bootstrap_remove(struct wpa_supplicant *wpa_s, const char *id);
 const char * wpas_dpp_bootstrap_get_uri(struct wpa_supplicant *wpa_s,
                                        unsigned int id);
+int wpas_dpp_bootstrap_info(struct wpa_supplicant *wpa_s, int id,
+                           char *reply, int reply_size);
 int wpas_dpp_auth_init(struct wpa_supplicant *wpa_s, const char *cmd);
 int wpas_dpp_listen(struct wpa_supplicant *wpa_s, const char *cmd);
 void wpas_dpp_listen_stop(struct wpa_supplicant *wpa_s);
index f640547fd12cf3037b4a22ae6021197d25e8dc03..40cc662f3489973062722587f309345f4b284a29 100644 (file)
@@ -2863,6 +2863,13 @@ static int wpa_cli_cmd_dpp_bootstrap_get_uri(struct wpa_ctrl *ctrl, int argc,
 }
 
 
+static int wpa_cli_cmd_dpp_bootstrap_info(struct wpa_ctrl *ctrl, int argc,
+                                         char *argv[])
+{
+       return wpa_cli_cmd(ctrl, "DPP_BOOTSTRAP_INFO", 1, argc, argv);
+}
+
+
 static int wpa_cli_cmd_dpp_auth_init(struct wpa_ctrl *ctrl, int argc,
                                     char *argv[])
 {
@@ -3527,6 +3534,9 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
        { "dpp_bootstrap_get_uri", wpa_cli_cmd_dpp_bootstrap_get_uri, NULL,
          cli_cmd_flag_none,
          "<id> = get DPP bootstrap URI" },
+       { "dpp_bootstrap_info", wpa_cli_cmd_dpp_bootstrap_info, NULL,
+         cli_cmd_flag_none,
+         "<id> = show DPP bootstrap information" },
        { "dpp_auth_init", wpa_cli_cmd_dpp_auth_init, NULL, cli_cmd_flag_none,
          "peer=<id> [own=<id>] = initiate DPP bootstrapping" },
        { "dpp_listen", wpa_cli_cmd_dpp_listen, NULL, cli_cmd_flag_none,