Improve one case that hostapd DPP AP needs user to manually save DPP csign, connector and net access key in hostapd config and rerun hostapd to perform DPP connection as AP. When device does not have command line, or cannot rerun hostapd, IE. when it's flashed rather than a binary, it gives another option to directly save the DPP conf info to hostapd config when they are sent by configurator. Signed-off-by: Fengming Ye mailto:frank.ye@xxxxxxx --- src/ap/dpp_hostapd.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index 3725a294d..b957458b9 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -1135,6 +1135,40 @@ static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src, wpabuf_len(hapd->dpp_auth->resp_msg)); } +#ifdef CONFIG_HOSTAPD_DPP_CONF_LOCAL_STORAGE +static void hostapd_dpp_add_network(struct hostapd_data *hapd, + struct dpp_authentication *auth, + struct dpp_config_obj *dpp_conf) +{ + struct hostapd_bss_config *conf = hapd->conf; + + if (conf == NULL || !(conf->wpa_key_mgmt & WPA_KEY_MGMT_DPP)) { + return; + } + + if (dpp_conf->connector) { + if (conf->dpp_connector) + os_free(conf->dpp_connector); + + conf->dpp_connector = os_strdup(dpp_conf->connector); + } + + if (dpp_conf->c_sign_key) { + if (conf->dpp_csign) + wpabuf_free(conf->dpp_csign); + + conf->dpp_csign = wpabuf_dup(dpp_conf->c_sign_key); + } + + if (auth->net_access_key) { + if (conf->dpp_netaccesskey) + wpabuf_free(conf->dpp_netaccesskey); + + conf->dpp_netaccesskey = wpabuf_dup(auth->net_access_key); + conf->dpp_netaccesskey_expiry = auth->net_access_key_expiry; + } +} +#endif /* CONFIG_HOSTAPD_DPP_CONF_LOCAL_STORAGE */ static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd, struct dpp_authentication *auth, @@ -1206,6 +1240,10 @@ static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd, os_free(hex); } } + +#ifdef CONFIG_HOSTAPD_DPP_CONF_LOCAL_STORAGE + hostapd_dpp_add_network(hapd, auth, conf); +#endif } -- 2.35.1.windows.2 Best regards Fengming Ye _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap