]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Advertise Configurator connectivity on Relay automatically
authorJouni Malinen <quic_jouni@quicinc.com>
Sat, 23 Jul 2022 13:54:47 +0000 (16:54 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 24 Jul 2022 21:23:31 +0000 (00:23 +0300)
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>
src/ap/dpp_hostapd.c
src/ap/dpp_hostapd.h
src/ap/ieee802_11_shared.c
src/common/dpp.h
src/common/dpp_tcp.c

index a0c6ab15b1a00b3b9b89d1d39e7204dc141960e2..c1732ca4040ed670707742aee5b01c9666b72aff 100644 (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 */
index e7276e889e62877d96e887c0407f39b464feff26..d462a1a6a39080eeefa070f78b80427631f8a992 100644 (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 */
index 4e7c33eea9a34dba2ae9923655f4c9c1c6b94f42..74c8d4439f1bd826ec19c239913c13f0caf4fe4b 100644 (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;
index 8eae58d732e038de7ca64325558f034131ebe9ae..3b5f08967b4c08e0210e978bbec96d1646258919 100644 (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,
index 84eab997a14525520e0d5cf15d1a73ce872790d9..6c5f3bf8381d5b45840db4ee0ddb48bcfb0cc6ed 100644 (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;