#endif /* CONFIG_DPP2 */
#ifdef CONFIG_DPP3
} else if (os_strcmp(buf, "DPP_PUSH_BUTTON") == 0) {
- if (hostapd_dpp_push_button(hapd) < 0)
+ if (hostapd_dpp_push_button(hapd, NULL) < 0)
+ reply_len = -1;
+ } else if (os_strncmp(buf, "DPP_PUSH_BUTTON ", 16) == 0) {
+ if (hostapd_dpp_push_button(hapd, buf + 15) < 0)
reply_len = -1;
#endif /* CONFIG_DPP3 */
#endif /* CONFIG_DPP */
static int hostapd_cli_cmd_dpp_push_button(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
- return wpa_ctrl_command(ctrl, "DPP_PUSH_BUTTON");
+ return hostapd_cli_cmd(ctrl, "DPP_PUSH_BUTTON", 1, argc, argv);
}
#endif /* CONFIG_DPP3 */
#endif /* CONFIG_DPP */
pkex->exch_req_wait_time = 2000;
pkex->exch_req_tries = 1;
+ if (ifaces->dpp_pb_cmd) {
+ /* Use the externally provided configuration */
+ os_free(hapd->dpp_pkex_auth_cmd);
+ hapd->dpp_pkex_auth_cmd = os_strdup(ifaces->dpp_pb_cmd);
+ if (!hapd->dpp_pkex_auth_cmd) {
+ hostapd_dpp_push_button_stop(hapd);
+ return;
+ }
+ return;
+ }
+
+ /* Build config based on the current AP configuration */
wpa_snprintf_hex(ssid_hex, sizeof(ssid_hex),
(const u8 *) hapd->conf->ssid.ssid,
hapd->conf->ssid.ssid_len);
}
-int hostapd_dpp_push_button(struct hostapd_data *hapd)
+int hostapd_dpp_push_button(struct hostapd_data *hapd, const char *cmd)
{
struct hapd_interfaces *ifaces = hapd->iface->interfaces;
os_get_reltime(&ifaces->dpp_pb_time);
ifaces->dpp_pb_announce_time.sec = 0;
ifaces->dpp_pb_announce_time.usec = 0;
+ str_clear_free(ifaces->dpp_pb_cmd);
+ ifaces->dpp_pb_cmd = NULL;
+ if (cmd) {
+ ifaces->dpp_pb_cmd = os_strdup(cmd);
+ if (!ifaces->dpp_pb_cmd)
+ return -1;
+ }
eloop_register_timeout(100, 0, hostapd_dpp_push_button_expire,
hapd, NULL);
}
ifaces->dpp_pb_result_indicated = false;
+
+ str_clear_free(ifaces->dpp_pb_cmd);
+ ifaces->dpp_pb_cmd = NULL;
}
#endif /* CONFIG_DPP3 */
int hostapd_dpp_chirp(struct hostapd_data *hapd, const char *cmd);
void hostapd_dpp_chirp_stop(struct hostapd_data *hapd);
void hostapd_dpp_remove_bi(void *ctx, struct dpp_bootstrap_info *bi);
-int hostapd_dpp_push_button(struct hostapd_data *hapd);
+int hostapd_dpp_push_button(struct hostapd_data *hapd, const char *cmd);
void hostapd_dpp_push_button_stop(struct hostapd_data *hapd);
#endif /* DPP_HOSTAPD_H */