]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Update Controller parameters when it was already started
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 15 Mar 2022 19:10:31 +0000 (21:10 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 23 Mar 2022 22:56:53 +0000 (00:56 +0200)
dpp_configurator_params changes were taken into use in the
non-TCP/Controller case immediately on change, but that was not the case
for the Controller where this was updated only when explicitly starting
it. Change this to update dpp_configurator_params for the Controller as
well even if it is already running.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
hostapd/ctrl_iface.c
src/common/dpp.h
src/common/dpp_tcp.c
wpa_supplicant/ctrl_iface.c

index 29dc38aba274e641f0709c29ab8f9e8cd579cfd9..80e4dacb8966c9ba526f3cac58569821932ef491 100644 (file)
@@ -1519,6 +1519,9 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
        } else if (os_strcasecmp(cmd, "dpp_configurator_params") == 0) {
                os_free(hapd->dpp_configurator_params);
                hapd->dpp_configurator_params = os_strdup(value);
+#ifdef CONFIG_DPP2
+               dpp_controller_set_params(hapd->iface->interfaces->dpp, value);
+#endif /* CONFIG_DPP2 */
        } else if (os_strcasecmp(cmd, "dpp_init_max_tries") == 0) {
                hapd->dpp_init_max_tries = atoi(value);
        } else if (os_strcasecmp(cmd, "dpp_init_retry_time") == 0) {
index 16d3ca71fb3a1d1ebff78bf71255f319bd763513..72899f9f95ddef93bc17b1cdc78039e28bdc1375 100644 (file)
@@ -709,6 +709,8 @@ int dpp_relay_rx_gas_req(struct dpp_global *dpp, const u8 *src, const u8 *data,
                         size_t data_len);
 int dpp_controller_start(struct dpp_global *dpp,
                         struct dpp_controller_config *config);
+int dpp_controller_set_params(struct dpp_global *dpp,
+                             const char *configurator_params);
 void dpp_controller_stop(struct dpp_global *dpp);
 void dpp_controller_stop_for_ctx(struct dpp_global *dpp, void *cb_ctx);
 struct dpp_authentication * dpp_controller_get_auth(struct dpp_global *dpp,
index 5f779934fa295be3213f382894fc6eadc5c59fa3..a6cca9a137393699be0fdba9e0225ec5a88ff7d5 100644 (file)
@@ -2084,6 +2084,29 @@ fail:
 }
 
 
+int dpp_controller_set_params(struct dpp_global *dpp,
+                             const char *configurator_params)
+{
+
+       if (!dpp || !dpp->controller)
+               return -1;
+
+       if (configurator_params) {
+               char *val = os_strdup(configurator_params);
+
+               if (!val)
+                       return -1;
+               os_free(dpp->controller->configurator_params);
+               dpp->controller->configurator_params = val;
+       } else {
+               os_free(dpp->controller->configurator_params);
+               dpp->controller->configurator_params = NULL;
+       }
+
+       return 0;
+}
+
+
 void dpp_controller_stop(struct dpp_global *dpp)
 {
        if (dpp) {
index f7ca929fed40bd452a638811edb916beed1b901c..21d7ec4b0982c008851fa7992738daa3379c7234 100644 (file)
@@ -674,6 +674,9 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
        } else if (os_strcasecmp(cmd, "dpp_configurator_params") == 0) {
                os_free(wpa_s->dpp_configurator_params);
                wpa_s->dpp_configurator_params = os_strdup(value);
+#ifdef CONFIG_DPP2
+               dpp_controller_set_params(wpa_s->dpp, value);
+#endif /* CONFIG_DPP2 */
        } else if (os_strcasecmp(cmd, "dpp_init_max_tries") == 0) {
                wpa_s->dpp_init_max_tries = atoi(value);
        } else if (os_strcasecmp(cmd, "dpp_init_retry_time") == 0) {