DPP: DPP_BOOTSTRAP_INFO for hostapd

This extends the hostapd control interface to support the
DPP_BOOTSTRAP_INFO command that was recently added for wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2017-07-04 15:45:37 +03:00 committed by Jouni Malinen
parent 484788b875
commit a86fb43ca3
3 changed files with 26 additions and 0 deletions

View file

@ -2690,6 +2690,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
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 = hostapd_dpp_bootstrap_info(hapd, 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 (hostapd_dpp_auth_init(hapd, buf + 13) < 0) if (hostapd_dpp_auth_init(hapd, buf + 13) < 0)
reply_len = -1; reply_len = -1;

View file

@ -262,6 +262,27 @@ const char * hostapd_dpp_bootstrap_get_uri(struct hostapd_data *hapd,
} }
int hostapd_dpp_bootstrap_info(struct hostapd_data *hapd, int id,
char *reply, int reply_size)
{
struct dpp_bootstrap_info *bi;
bi = dpp_bootstrap_get_id(hapd, 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",
dpp_bootstrap_type_txt(bi->type),
MAC2STR(bi->mac_addr),
bi->info ? bi->info : "",
bi->num_freq,
bi->curve->name);
}
void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst, void hostapd_dpp_tx_status(struct hostapd_data *hapd, const u8 *dst,
const u8 *data, size_t data_len, int ok) const u8 *data, size_t data_len, int ok)
{ {

View file

@ -14,6 +14,8 @@ int hostapd_dpp_bootstrap_gen(struct hostapd_data *hapd, const char *cmd);
int hostapd_dpp_bootstrap_remove(struct hostapd_data *hapd, const char *id); int hostapd_dpp_bootstrap_remove(struct hostapd_data *hapd, const char *id);
const char * hostapd_dpp_bootstrap_get_uri(struct hostapd_data *hapd, const char * hostapd_dpp_bootstrap_get_uri(struct hostapd_data *hapd,
unsigned int id); unsigned int id);
int hostapd_dpp_bootstrap_info(struct hostapd_data *hapd, int id,
char *reply, int reply_size);
int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd); int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd);
void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src, void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src,
const u8 *buf, size_t len, unsigned int freq); const u8 *buf, size_t len, unsigned int freq);