]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Configurator Connectivity indication
authorJouni Malinen <jouni@codeaurora.org>
Fri, 27 Mar 2020 12:03:04 +0000 (14:03 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 27 Mar 2020 18:05:25 +0000 (20:05 +0200)
Add a new hostapd configuration parameter
dpp_configurator_connectivity=1 to request Configurator connectivity to
be advertised for chirping Enrollees.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/beacon.c
src/ap/ieee802_11.h
src/ap/ieee802_11_shared.c

index bdae3be79030377ae0f4297d9b73293f5c72b3a9..1e640c790174ad0d8eb8a5163954b090e6674b40 100644 (file)
@@ -4408,6 +4408,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "dpp_controller") == 0) {
                if (hostapd_dpp_controller_parse(bss, pos))
                        return 1;
+       } else if (os_strcmp(buf, "dpp_configurator_connectivity") == 0) {
+               bss->dpp_configurator_connectivity = atoi(pos);
 #endif /* CONFIG_DPP2 */
 #endif /* CONFIG_DPP */
 #ifdef CONFIG_OWE
index 6a8c2c5cfbfca0ad3bf037d03399ca61b0f93a08..bcddc6b303c9e83a50af4514786f25b66c94efc2 100644 (file)
@@ -2304,6 +2304,11 @@ own_ip_addr=127.0.0.1
 #dpp_csign
 #dpp_controller
 
+# Configurator Connectivity indication
+# 0: no Configurator is currently connected (default)
+# 1: advertise that a Configurator is available
+#dpp_configurator_connectivity=0
+
 #### TDLS (IEEE 802.11z-2010) #################################################
 
 # Prohibit use of TDLS in this BSS
index f24257091a9a911095bbde657ec3a1100f67e48d..e0f645f7b93a9c3dd0f1eb8ff84b54c073ca0759 100644 (file)
@@ -740,6 +740,7 @@ struct hostapd_bss_config {
        struct wpabuf *dpp_csign;
 #ifdef CONFIG_DPP2
        struct dpp_controller_conf *dpp_controller;
+       int dpp_configurator_connectivity;
 #endif /* CONFIG_DPP2 */
 #endif /* CONFIG_DPP */
 
index ff760a0d1a9e772ace6f4da02f7f9b99ea96634c..47ced9a166de7c0c5909dca915d0ac8502de8382 100644 (file)
@@ -468,6 +468,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
        buflen += hostapd_mbo_ie_len(hapd);
        buflen += hostapd_eid_owe_trans_len(hapd);
+       buflen += hostapd_eid_dpp_cc_len(hapd);
 
        resp = os_zalloc(buflen);
        if (resp == NULL)
@@ -612,6 +613,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
        pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos);
        pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos);
+       pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) resp + buflen - pos);
 
        if (hapd->conf->vendor_elements) {
                os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements),
@@ -1164,6 +1166,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 
        tail_len += hostapd_mbo_ie_len(hapd);
        tail_len += hostapd_eid_owe_trans_len(hapd);
+       tail_len += hostapd_eid_dpp_cc_len(hapd);
 
        tailpos = tail = os_malloc(tail_len);
        if (head == NULL || tail == NULL) {
@@ -1328,6 +1331,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
        tailpos = hostapd_eid_mbo(hapd, tailpos, tail + tail_len - tailpos);
        tailpos = hostapd_eid_owe_trans(hapd, tailpos,
                                        tail + tail_len - tailpos);
+       tailpos = hostapd_eid_dpp_cc(hapd, tailpos, tail + tail_len - tailpos);
 
        if (hapd->conf->vendor_elements) {
                os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements),
index 181cfaf0aef38bfaa35129deec7e90bfb109b061..c7bdb4b2b113099070c5d221978a0090900bf082 100644 (file)
@@ -183,6 +183,9 @@ void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta,
 size_t hostapd_eid_owe_trans_len(struct hostapd_data *hapd);
 u8 * hostapd_eid_owe_trans(struct hostapd_data *hapd, u8 *eid, size_t len);
 
+size_t hostapd_eid_dpp_cc_len(struct hostapd_data *hapd);
+u8 * hostapd_eid_dpp_cc(struct hostapd_data *hapd, u8 *eid, size_t len);
+
 int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
                      int ap_seg1_idx, int *bandwidth, int *seg1_idx);
 
index a225639a91e9f831b0f2b85f1933d158c40b30e5..113b4ef042758b0e2e1eba2668d773c962a41741 100644 (file)
@@ -874,6 +874,36 @@ 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)
+               return 6;
+#endif /* CONFIG_DPP2 */
+       return 0;
+}
+
+
+u8 * hostapd_eid_dpp_cc(struct hostapd_data *hapd, u8 *eid, size_t len)
+{
+#ifdef CONFIG_DPP2
+       u8 *pos = eid;
+
+       if (!hapd->conf->dpp_configurator_connectivity || len < 6)
+               return pos;
+
+       *pos++ = WLAN_EID_VENDOR_SPECIFIC;
+       *pos++ = 4;
+       WPA_PUT_BE24(pos, OUI_WFA);
+       pos += 3;
+       *pos++ = DPP_CC_OUI_TYPE;
+
+       return pos;
+#endif /* CONFIG_DPP2 */
+       return eid;
+}
+
+
 void ap_copy_sta_supp_op_classes(struct sta_info *sta,
                                 const u8 *supp_op_classes,
                                 size_t supp_op_classes_len)