]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PR: Process 11az NTB Capability Attribute from USD PR element
authorPeddolla Harshavardhan Reddy <peddolla@qti.qualcomm.com>
Sat, 26 Apr 2025 19:55:46 +0000 (01:25 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 17 Oct 2025 10:22:51 +0000 (13:22 +0300)
Parse part of Proximity Ranging element corresponding to the Proximity
Ranging 11az NTB Capability Attribute and store the corresponding data
in a structure. This attribute contains capabilities that tell if the
device can act as an NTB ranging initiator or NTB ranging responder, a
list of channels on which the device supports NTB ranging, and other
device specific capabilities.

Signed-off-by: Peddolla Harshavardhan Reddy <peddolla@qti.qualcomm.com>
src/common/proximity_ranging.c
src/common/proximity_ranging.h

index 6664c32ef5ea7e7c0826128a9ff0b8aff83dfbb7..334c59dad328386faa4c0f63922490ff7fde77db 100644 (file)
@@ -856,6 +856,49 @@ static void pr_process_edca_capabilities(const u8 *caps, size_t caps_len,
 }
 
 
+static void pr_process_ntb_capabilities(const u8 *caps, size_t caps_len,
+                                       struct ntb_capabilities *ntb_caps,
+                                       bool secure_ltf)
+{
+       const u8 *pos, *end;
+
+       if (caps_len < 9)
+               return;
+
+       pos = caps;
+       end = caps + caps_len;
+
+       /* Ranging Role */
+       if (*pos & PR_ISTA_SUPPORT)
+               ntb_caps->ista_support = true;
+       if (*pos & PR_RSTA_SUPPORT)
+               ntb_caps->rsta_support = true;
+       if (secure_ltf)
+               ntb_caps->secure_he_ltf = true;
+       pos++;
+
+       /* Ranging Parameter */
+       ntb_caps->ntb_hw_caps = WPA_GET_LE32(pos);
+       pos += 4;
+
+       /* Country String */
+       os_memcpy(ntb_caps->country, pos, 3);
+       pos += 3;
+
+       pr_process_channels(pos, end - pos, &ntb_caps->channels);
+
+       wpa_printf(MSG_DEBUG,
+                  "PR: NTB ISTA support=%u, NTB RSTA support=%u, op classes count=%lu, secure HE-LTF=%u, country=%c%c",
+                  ntb_caps->ista_support, ntb_caps->rsta_support,
+                  ntb_caps->channels.op_classes,
+                  ntb_caps->secure_he_ltf,
+                  valid_country_ch(ntb_caps->country[0]) ?
+                  ntb_caps->country[0] : '_',
+                  valid_country_ch(ntb_caps->country[1]) ?
+                  ntb_caps->country[1] : '_');
+}
+
+
 void pr_process_usd_elems(struct pr_data *pr, const u8 *ies, u16 ies_len,
                          const u8 *peer_addr, unsigned int freq)
 {
@@ -880,6 +923,14 @@ void pr_process_usd_elems(struct pr_data *pr, const u8 *ies, u16 ies_len,
                return;
        }
 
+       if (!msg.edca_capability && !msg.ntb_capability) {
+               wpa_printf(MSG_DEBUG,
+                          "PR: Neither EDCA nor NTB capabilities are present, ignoring proximity device "
+                          MACSTR, MAC2STR(peer_addr));
+               pr_parse_free(&msg);
+               return;
+       }
+
        dev = pr_create_device(pr, peer_addr);
        if (!dev) {
                pr_parse_free(&msg);
@@ -898,5 +949,11 @@ void pr_process_usd_elems(struct pr_data *pr, const u8 *ies, u16 ies_len,
                                             msg.edca_capability_len,
                                             &dev->edca_caps);
 
+       if (dev->pr_caps.ntb_support && msg.ntb_capability)
+               pr_process_ntb_capabilities(msg.ntb_capability,
+                                           msg.ntb_capability_len,
+                                           &dev->ntb_caps,
+                                           dev->pr_caps.secure_he_ltf);
+
        pr_parse_free(&msg);
 }
index 12bf90d9fd037a6ce89335f5ebb41dcfaf28f5fc..5eedcd674f2a8cc3c59a36a8fc8c9a178cad5923 100644 (file)
@@ -250,6 +250,7 @@ struct pr_device {
 
        struct pr_capabilities pr_caps;
        struct edca_capabilities edca_caps;
+       struct ntb_capabilities ntb_caps;
 
        /* Password to be used in PASN-SAE by the Seeker.
         * This is updated with valid password if DIRA matches for the peer.