]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Add Protocol Version attribute to network introduction messages
authorJouni Malinen <jouni@codeaurora.org>
Fri, 1 May 2020 14:06:59 +0000 (17:06 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2020 21:37:44 +0000 (00:37 +0300)
This can be used to determine whether to try to negotiate PFS (only
available with version 2 or higher).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/dpp_hostapd.c
wpa_supplicant/dpp_supplicant.c

index c86f01ba76843468ebe21d97fd5f4da56c6b2326..77518cbdf53565a975d49e888d4570b665b60765 100644 (file)
@@ -1206,9 +1206,13 @@ static void hostapd_dpp_send_peer_disc_resp(struct hostapd_data *hapd,
                                            enum dpp_status_error status)
 {
        struct wpabuf *msg;
+       size_t len;
 
-       msg = dpp_alloc_msg(DPP_PA_PEER_DISCOVERY_RESP,
-                           5 + 5 + 4 + os_strlen(hapd->conf->dpp_connector));
+       len = 5 + 5 + 4 + os_strlen(hapd->conf->dpp_connector);
+#ifdef CONFIG_DPP2
+       len += 5;
+#endif /* CONFIG_DPP2 */
+       msg = dpp_alloc_msg(DPP_PA_PEER_DISCOVERY_RESP, len);
        if (!msg)
                return;
 
@@ -1281,6 +1285,13 @@ skip_status:
 skip_connector:
 #endif /* CONFIG_TESTING_OPTIONS */
 
+#ifdef CONFIG_DPP2
+       /* Protocol Version */
+       wpabuf_put_le16(msg, DPP_ATTR_PROTOCOL_VERSION);
+       wpabuf_put_le16(msg, 1);
+       wpabuf_put_u8(msg, 2);
+#endif /* CONFIG_DPP2 */
+
        wpa_printf(MSG_DEBUG, "DPP: Send Peer Discovery Response to " MACSTR
                   " status=%d", MAC2STR(src), status);
        wpa_msg(hapd->msg_ctx, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR
index 291b96b7510c8af1faab2730c4ae4d7614aefc5c..b8fd95bee7b5198b032e0983ca576bfdfb70a842 100644 (file)
@@ -2474,6 +2474,7 @@ int wpas_dpp_check_connect(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
        unsigned int wait_time;
        const u8 *rsn;
        struct wpa_ie_data ied;
+       size_t len;
 
        if (!(ssid->key_mgmt & WPA_KEY_MGMT_DPP) || !bss)
                return 0; /* Not using DPP AKM - continue */
@@ -2507,8 +2508,11 @@ int wpas_dpp_check_connect(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
                   "DPP: Starting network introduction protocol to derive PMKSA for "
                   MACSTR, MAC2STR(bss->bssid));
 
-       msg = dpp_alloc_msg(DPP_PA_PEER_DISCOVERY_REQ,
-                           5 + 4 + os_strlen(ssid->dpp_connector));
+       len = 5 + 4 + os_strlen(ssid->dpp_connector);
+#ifdef CONFIG_DPP2
+       len += 5;
+#endif /* CONFIG_DPP2 */
+       msg = dpp_alloc_msg(DPP_PA_PEER_DISCOVERY_REQ, len);
        if (!msg)
                return -1;
 
@@ -2563,6 +2567,13 @@ skip_trans_id:
 skip_connector:
 #endif /* CONFIG_TESTING_OPTIONS */
 
+#ifdef CONFIG_DPP2
+       /* Protocol Version */
+       wpabuf_put_le16(msg, DPP_ATTR_PROTOCOL_VERSION);
+       wpabuf_put_le16(msg, 1);
+       wpabuf_put_u8(msg, 2);
+#endif /* CONFIG_DPP2 */
+
        /* TODO: Timeout on AP response */
        wait_time = wpa_s->max_remain_on_chan;
        if (wait_time > 2000)