]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Add DPP_BOOTSTRAP_SET command
authorJouni Malinen <jouni@codeaurora.org>
Fri, 27 Mar 2020 15:28:59 +0000 (17:28 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 27 Mar 2020 15:44:06 +0000 (17:44 +0200)
"DPP_BOOTSTRAP_SET <ID> <configurator parameters..>" can now be used to
set peer specific configurator parameters which will override any global
parameters from dpp_configurator_params.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/ctrl_iface.c
src/common/dpp.c
src/common/dpp.h
wpa_supplicant/ctrl_iface.c

index 1a369ed2aedabe0c1c99fdb4884550373fdd54dc..aaf00c2db301f29835aa8ec07f4432f0bd52124a 100644 (file)
@@ -3463,6 +3463,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
                reply_len = dpp_bootstrap_info(hapd->iface->interfaces->dpp,
                                               atoi(buf + 19),
                        reply, reply_size);
+       } else if (os_strncmp(buf, "DPP_BOOTSTRAP_SET ", 18) == 0) {
+               if (dpp_bootstrap_set(hapd->iface->interfaces->dpp,
+                                     atoi(buf + 18),
+                                     os_strchr(buf + 18, ' ')) < 0)
+                       reply_len = -1;
        } else if (os_strncmp(buf, "DPP_AUTH_INIT ", 14) == 0) {
                if (hostapd_dpp_auth_init(hapd, buf + 13) < 0)
                        reply_len = -1;
index 7f0f0b6ea2e91887c357087e244e772c8c84b63e..6bb1311833bb9a4ef46a32f25bcf8b9ed2d54a3f 100644 (file)
@@ -10532,6 +10532,26 @@ int dpp_bootstrap_info(struct dpp_global *dpp, int id,
 }
 
 
+int dpp_bootstrap_set(struct dpp_global *dpp, int id, const char *params)
+{
+       struct dpp_bootstrap_info *bi;
+
+       bi = dpp_bootstrap_get_id(dpp, id);
+       if (!bi)
+               return -1;
+
+       str_clear_free(bi->configurator_params);
+
+       if (params) {
+               bi->configurator_params = os_strdup(params);
+               return bi->configurator_params ? 0 : -1;
+       }
+
+       bi->configurator_params = NULL;
+       return 0;
+}
+
+
 void dpp_bootstrap_find_pair(struct dpp_global *dpp, const u8 *i_bootstrap,
                             const u8 *r_bootstrap,
                             struct dpp_bootstrap_info **own_bi,
index 0ec0024cd86f61d10088ca7958d7405184f7e4c8..bab83a8a4ee0e82cd85938ff424101b61604c2e3 100644 (file)
@@ -562,6 +562,7 @@ dpp_pkex_finish(struct dpp_global *dpp, struct dpp_pkex *pkex, const u8 *peer,
 const char * dpp_bootstrap_get_uri(struct dpp_global *dpp, unsigned int id);
 int dpp_bootstrap_info(struct dpp_global *dpp, int id,
                       char *reply, int reply_size);
+int dpp_bootstrap_set(struct dpp_global *dpp, int id, const char *params);
 void dpp_bootstrap_find_pair(struct dpp_global *dpp, const u8 *i_bootstrap,
                             const u8 *r_bootstrap,
                             struct dpp_bootstrap_info **own_bi,
index e140a3e382a5283a0d02cade6ba1f1755d5a38de..ebcb60e5a742f92fd7cb53504b682a053aa48087 100644 (file)
@@ -10890,6 +10890,10 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
        } else if (os_strncmp(buf, "DPP_BOOTSTRAP_INFO ", 19) == 0) {
                reply_len = dpp_bootstrap_info(wpa_s->dpp, atoi(buf + 19),
                                               reply, reply_size);
+       } else if (os_strncmp(buf, "DPP_BOOTSTRAP_SET ", 18) == 0) {
+               if (dpp_bootstrap_set(wpa_s->dpp, atoi(buf + 18),
+                                     os_strchr(buf + 18, ' ')) < 0)
+                       reply_len = -1;
        } else if (os_strncmp(buf, "DPP_AUTH_INIT ", 14) == 0) {
                if (wpas_dpp_auth_init(wpa_s, buf + 13) < 0)
                        reply_len = -1;