DPP: Add DPP_BOOTSTRAP_INFO command

This can be used to fetch parsed details on bootstrapping information.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-06-22 14:51:21 +03:00 committed by Jouni Malinen
parent cd29045bb2
commit 6a7182a9c3
4 changed files with 46 additions and 0 deletions

View file

@ -10226,6 +10226,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
if (os_snprintf_error(reply_size, reply_len)) if (os_snprintf_error(reply_size, reply_len))
reply_len = -1; 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) { } else if (os_strncmp(buf, "DPP_AUTH_INIT ", 14) == 0) {
if (wpas_dpp_auth_init(wpa_s, buf + 13) < 0) if (wpas_dpp_auth_init(wpa_s, buf + 13) < 0)
reply_len = -1; reply_len = -1;

View 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, static void wpas_dpp_tx_status(struct wpa_supplicant *wpa_s,
unsigned int freq, const u8 *dst, unsigned int freq, const u8 *dst,
const u8 *src, const u8 *bssid, const u8 *src, const u8 *bssid,

View 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); 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, const char * wpas_dpp_bootstrap_get_uri(struct wpa_supplicant *wpa_s,
unsigned int id); 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_auth_init(struct wpa_supplicant *wpa_s, const char *cmd);
int wpas_dpp_listen(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); void wpas_dpp_listen_stop(struct wpa_supplicant *wpa_s);

View 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, static int wpa_cli_cmd_dpp_auth_init(struct wpa_ctrl *ctrl, int argc,
char *argv[]) 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, { "dpp_bootstrap_get_uri", wpa_cli_cmd_dpp_bootstrap_get_uri, NULL,
cli_cmd_flag_none, cli_cmd_flag_none,
"<id> = get DPP bootstrap URI" }, "<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, { "dpp_auth_init", wpa_cli_cmd_dpp_auth_init, NULL, cli_cmd_flag_none,
"peer=<id> [own=<id>] = initiate DPP bootstrapping" }, "peer=<id> [own=<id>] = initiate DPP bootstrapping" },
{ "dpp_listen", wpa_cli_cmd_dpp_listen, NULL, cli_cmd_flag_none, { "dpp_listen", wpa_cli_cmd_dpp_listen, NULL, cli_cmd_flag_none,