DPP2: Allow iteration count to be configured for DPP_RECONFIG

Add an optional iter=# parameter to DPP_RECONFIG similarly to the way
this was handled with DPP_CHIRP.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-08-07 23:22:31 +03:00 committed by Jouni Malinen
parent c6d0e5a93d
commit 6d0217119e
3 changed files with 21 additions and 9 deletions

View file

@ -11217,10 +11217,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
} else if (os_strcmp(buf, "DPP_STOP_CHIRP") == 0) {
wpas_dpp_chirp_stop(wpa_s);
} else if (os_strncmp(buf, "DPP_RECONFIG ", 13) == 0) {
struct wpa_ssid *ssid;
ssid = wpa_config_get_network(wpa_s->conf, atoi(buf + 13));
if (!ssid || wpas_dpp_reconfig(wpa_s, ssid) < 0)
if (wpas_dpp_reconfig(wpa_s, buf + 13) < 0)
reply_len = -1;
} else if (os_strncmp(buf, "DPP_CA_SET ", 11) == 0) {
if (wpas_dpp_ca_set(wpa_s, buf + 10) < 0)

View file

@ -3636,11 +3636,26 @@ void wpas_dpp_chirp_stop(struct wpa_supplicant *wpa_s)
}
int wpas_dpp_reconfig(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
int wpas_dpp_reconfig(struct wpa_supplicant *wpa_s, const char *cmd)
{
if (!ssid->dpp_connector || !ssid->dpp_netaccesskey ||
!ssid->dpp_csign)
struct wpa_ssid *ssid;
int iter = 1;
const char *pos;
ssid = wpa_config_get_network(wpa_s->conf, atoi(cmd));
if (!ssid || !ssid->dpp_connector || !ssid->dpp_netaccesskey ||
!ssid->dpp_csign) {
wpa_printf(MSG_DEBUG,
"DPP: Not a valid network profile for reconfiguration");
return -1;
}
pos = os_strstr(cmd, " iter=");
if (pos) {
iter = atoi(pos + 6);
if (iter <= 0)
return -1;
}
if (wpa_s->dpp_auth) {
wpa_printf(MSG_DEBUG,
@ -3671,7 +3686,7 @@ int wpas_dpp_reconfig(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
return -1;
wpa_s->dpp_reconfig_ssid = ssid;
wpa_s->dpp_reconfig_ssid_id = ssid->id;
wpa_s->dpp_chirp_iter = 1;
wpa_s->dpp_chirp_iter = iter;
wpa_s->dpp_chirp_round = 0;
wpa_s->dpp_chirp_scan_done = 0;
wpa_s->dpp_chirp_listen = 0;

View file

@ -39,7 +39,7 @@ void wpas_dpp_send_conn_status_result(struct wpa_supplicant *wpa_s,
enum dpp_status_error result);
int wpas_dpp_chirp(struct wpa_supplicant *wpa_s, const char *cmd);
void wpas_dpp_chirp_stop(struct wpa_supplicant *wpa_s);
int wpas_dpp_reconfig(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
int wpas_dpp_reconfig(struct wpa_supplicant *wpa_s, const char *cmd);
int wpas_dpp_ca_set(struct wpa_supplicant *wpa_s, const char *cmd);
#endif /* DPP_SUPPLICANT_H */