]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Add DIRA to PASN-M1 during pairing verification
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 27 Dec 2024 14:00:59 +0000 (19:30 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 23 Jan 2025 10:30:45 +0000 (12:30 +0200)
This is needed to be able to recognize a peer device and its PMKSA entry
when a random PMKID is used with MAC address randomization.

Signed-off-by: Vinay Gannevaram <quic_vganneva@quicinc.com>
src/p2p/p2p.c

index e2806d6272e8f9fc091235402f7a10904df275a7..18c8b2eb56a0b9dfc2e91bd7406da0b75eb1bfdd 100644 (file)
@@ -6192,7 +6192,7 @@ int p2p_config_sae_password(struct p2p_data *p2p, const char *pw)
 
 static int p2p_prepare_pasn_extra_ie(struct p2p_data *p2p,
                                     struct wpabuf *extra_ies,
-                                    const struct wpabuf *frame)
+                                    const struct wpabuf *frame, bool add_dira)
 {
        struct wpabuf *buf, *buf2;
        size_t len;
@@ -6207,6 +6207,11 @@ static int p2p_prepare_pasn_extra_ie(struct p2p_data *p2p,
        /* P2P Capability Extension attribute */
        p2p_buf_add_pcea(buf, p2p);
 
+       if (add_dira) {
+               /* Device Identity Resolution attribute */
+               p2p_buf_add_dira(buf, p2p);
+       }
+
        if (frame) {
                p2p_dbg(p2p, "Add Action frame wrapper for PASN");
                wpabuf_put_u8(buf, P2P_ATTR_ACTION_FRAME_WRAPPER);
@@ -6458,7 +6463,7 @@ int p2p_initiate_pasn_verify(struct p2p_data *p2p, const u8 *peer_addr,
                return -1;
        }
 
-       if (p2p_prepare_pasn_extra_ie(p2p, extra_ies, req)) {
+       if (p2p_prepare_pasn_extra_ie(p2p, extra_ies, req, true)) {
                p2p_dbg(p2p, "Prepare PASN extra IEs failed");
                ret = -1;
                goto out;
@@ -6533,7 +6538,7 @@ int p2p_initiate_pasn_auth(struct p2p_data *p2p, const u8 *addr, int freq)
                return -1;
        }
 
-       if (p2p_prepare_pasn_extra_ie(p2p, extra_ies, req)) {
+       if (p2p_prepare_pasn_extra_ie(p2p, extra_ies, req, false)) {
                p2p_dbg(p2p, "Failed to prepare PASN extra elements");
                ret = -1;
                goto out;
@@ -6780,7 +6785,7 @@ int p2p_prepare_data_element(struct p2p_data *p2p, const u8 *peer_addr)
        extra_ies = wpabuf_alloc(1500);
        if (!extra_ies ||
            p2p_prepare_pasn_extra_ie(p2p, extra_ies,
-                                     dev->action_frame_wrapper)) {
+                                     dev->action_frame_wrapper, false)) {
                p2p_dbg(p2p, "Failed to prepare PASN extra elements");
                goto out;
        }