diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index a0c6ab15b..c1732ca40 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -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 */ diff --git a/src/ap/dpp_hostapd.h b/src/ap/dpp_hostapd.h index e7276e889..d462a1a6a 100644 --- a/src/ap/dpp_hostapd.h +++ b/src/ap/dpp_hostapd.h @@ -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 */ diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 4e7c33eea..74c8d4439 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -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; diff --git a/src/common/dpp.h b/src/common/dpp.h index 8eae58d73..3b5f08967 100644 --- a/src/common/dpp.h +++ b/src/common/dpp.h @@ -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, diff --git a/src/common/dpp_tcp.c b/src/common/dpp_tcp.c index 84eab997a..6c5f3bf83 100644 --- a/src/common/dpp_tcp.c +++ b/src/common/dpp_tcp.c @@ -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;