]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: DPP_BOOTSTRAP_INFO for hostapd
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 4 Jul 2017 12:45:37 +0000 (15:45 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 4 Jul 2017 12:56:38 +0000 (15:56 +0300)
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>
hostapd/ctrl_iface.c
src/ap/dpp_hostapd.c
src/ap/dpp_hostapd.h

index 5503f44768f22fd47870255a1d27b63c81b97107..c2eadb5b070160daf4c19aad2d7159f85b2ad58e 100644 (file)
@@ -2690,6 +2690,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                        if (os_snprintf_error(reply_size, reply_len))
                                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) {
                if (hostapd_dpp_auth_init(hapd, buf + 13) < 0)
                        reply_len = -1;
index b5980d4c3b722962a41fd42f13de6a739a43f39f..c8b4f87b8b7906eafc44806100b03539a490894f 100644 (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,
                           const u8 *data, size_t data_len, int ok)
 {
index 9aa08305da01e38fae123c3129bce688f63bde13..d870b205118a38a856108e8b5dd1b0c62280cd79 100644 (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);
 const char * hostapd_dpp_bootstrap_get_uri(struct hostapd_data *hapd,
                                           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);
 void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src,
                           const u8 *buf, size_t len, unsigned int freq);