DPP: Advertise Configurator connectivity on Relay automatically

Instead of requiring explicit configuration through
dpp_configurator_connectivity=1, advertise Configurator connectivity
automatically if a Relay is configured with a Controller that can
operate as a Responder.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-07-23 16:54:47 +03:00 committed by Jouni Malinen
parent ff7cc1d490
commit f7763880bd
5 changed files with 21 additions and 2 deletions

View file

@ -3869,3 +3869,13 @@ void hostapd_dpp_push_button_stop(struct hostapd_data *hapd)
}
#endif /* CONFIG_DPP3 */
#ifdef CONFIG_DPP2
bool hostapd_dpp_configurator_connectivity(struct hostapd_data *hapd)
{
return hapd->conf->dpp_configurator_connectivity ||
(hapd->iface->interfaces &&
dpp_relay_controller_available(hapd->iface->interfaces->dpp));
}
#endif /* CONFIG_DPP2 */

View file

@ -47,5 +47,6 @@ 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, const char *cmd);
void hostapd_dpp_push_button_stop(struct hostapd_data *hapd);
bool hostapd_dpp_configurator_connectivity(struct hostapd_data *hapd);
#endif /* DPP_HOSTAPD_H */

View file

@ -17,6 +17,7 @@
#include "ap_config.h"
#include "ap_drv_ops.h"
#include "wpa_auth.h"
#include "dpp_hostapd.h"
#include "ieee802_11.h"
@ -873,7 +874,7 @@ u8 * hostapd_eid_owe_trans(struct hostapd_data *hapd, u8 *eid,
size_t hostapd_eid_dpp_cc_len(struct hostapd_data *hapd)
{
#ifdef CONFIG_DPP2
if (hapd->conf->dpp_configurator_connectivity)
if (hostapd_dpp_configurator_connectivity(hapd))
return 6;
#endif /* CONFIG_DPP2 */
return 0;
@ -885,7 +886,7 @@ u8 * hostapd_eid_dpp_cc(struct hostapd_data *hapd, u8 *eid, size_t len)
u8 *pos = eid;
#ifdef CONFIG_DPP2
if (!hapd->conf->dpp_configurator_connectivity || len < 6)
if (!hostapd_dpp_configurator_connectivity(hapd) || len < 6)
return pos;
*pos++ = WLAN_EID_VENDOR_SPECIFIC;

View file

@ -758,6 +758,7 @@ int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr,
void *cb_ctx);
int dpp_relay_rx_gas_req(struct dpp_global *dpp, const u8 *src, const u8 *data,
size_t data_len);
bool dpp_relay_controller_available(struct dpp_global *dpp);
int dpp_controller_start(struct dpp_global *dpp,
struct dpp_controller_config *config);
int dpp_controller_set_params(struct dpp_global *dpp,

View file

@ -694,6 +694,12 @@ int dpp_relay_rx_gas_req(struct dpp_global *dpp, const u8 *src, const u8 *data,
}
bool dpp_relay_controller_available(struct dpp_global *dpp)
{
return dpp && dl_list_len(&dpp->controllers) > 0;
}
static void dpp_controller_free(struct dpp_controller *ctrl)
{
struct dpp_connection *conn, *tmp;