DPP: Update Controller parameters when it was already started

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>
This commit is contained in:
Jouni Malinen 2022-03-15 21:10:31 +02:00 committed by Jouni Malinen
parent b93d1083ee
commit 30ecf0181d
4 changed files with 31 additions and 0 deletions

View 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) {

View 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,

View 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) {

View 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) {