[PATCH 16/97] NAN: Add definitions and parsing for NDPE
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Apr 28 13:05:17 PDT 2026
From: Ilan Peer <ilan.peer at intel.com>
Add definitions and parsing for NAN Data Path Extension
attribute.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/common/nan_defs.h | 19 +++++++++++++++++--
src/nan/nan_i.h | 2 ++
src/nan/nan_util.c | 14 +++++++++++++-
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/src/common/nan_defs.h b/src/common/nan_defs.h
index d528414ef8..dfc602a42a 100644
--- a/src/common/nan_defs.h
+++ b/src/common/nan_defs.h
@@ -254,14 +254,21 @@ enum nan_ndp_status {
NAN_NDP_STATUS_REJECTED = 2,
};
-/* Wi-Fi Aware spec v4.0, Table 84 (NDP Control field) */
+/* Wi-Fi Aware spec v4.0, Table 84 (NDP Control field) and Table 87 (NDPE
+ * Control Field).
+ * Bits 0-4 are identical for NDP and NDPE the only differences are in
+ * Bit 5
+ */
#define NAN_NDP_CTRL_CONFIRM_REQUIRED BIT(0)
#define NAN_NDP_CTRL_SECURITY_PRESENT BIT(2)
#define NAN_NDP_CTRL_PUBLISH_ID_PRESENT BIT(3)
#define NAN_NDP_CTRL_RESPONDER_NDI_PRESENT BIT(4)
+
#define NAN_NDP_CTRL_SPEC_INFO_PRESENT BIT(5)
+#define NAN_NDPE_CTRL_GTK_REQUIRED BIT(5)
-/* Wi-Fi Aware spec v4.0, Table 82 (NDP attribute format)
+/* Wi-Fi Aware spec v4.0, Table 82 (NDP attribute format) and
+ * Table 86 (NDP Extension attribute format)
* Note: The structure does not include the Attribute ID and Length fields. */
struct ieee80211_ndp {
u8 dialog_token; /* Dialog Token */
@@ -275,6 +282,14 @@ struct ieee80211_ndp {
u8 optional[0];
} STRUCT_PACKED;
+/* TLV types for NDPE attribute: See Table 89 */
+enum nan_ndpe_tlv_type {
+ NAN_NDPE_TLV_IPV6_LINK_LOCAL = 0,
+ NAN_NDPE_TLV_SRV_INFO = 1,
+};
+
+#define NAN_NDPE_TLV_IPV6_LINK_LOCAL_LEN 8
+
/* Wi-Fi Aware spec v4.0, Table 97 (Time Bitmap Control field format for the
* NAN Availability attribute) */
#define NAN_TIME_BM_CTRL_BIT_DURATION_POS 0
diff --git a/src/nan/nan_i.h b/src/nan/nan_i.h
index 026c4ea0a3..8adae9476d 100644
--- a/src/nan/nan_i.h
+++ b/src/nan/nan_i.h
@@ -588,6 +588,7 @@ struct nan_attrs {
const u8 *dev_capa_ext;
const u8 *npba;
const u8 *nira;
+ const u8 *ndpe;
u16 ndp_len;
u16 ndl_len;
@@ -598,6 +599,7 @@ struct nan_attrs {
u16 dev_capa_ext_len;
u16 npba_len;
u16 nira_len;
+ u16 ndpe_len;
};
struct nan_msg {
diff --git a/src/nan/nan_util.c b/src/nan/nan_util.c
index 9e96a933fa..c0bd91aae5 100644
--- a/src/nan/nan_util.c
+++ b/src/nan/nan_util.c
@@ -216,6 +216,19 @@ int nan_parse_attrs(struct nan_data *nan, const u8 *data, size_t len,
attrs->nira = pos;
attrs->nira_len = attr_len;
break;
+ case NAN_ATTR_NDP_EXT:
+ /*
+ * Validate minimal NDPE attribute length. NDP and NDPE
+ * attributes have the common structure and thus the
+ * same minimal length requirement based on the common
+ * fields (see struct ieee80211_ndp).
+ */
+ if (attr_len < sizeof(struct ieee80211_ndp))
+ break;
+
+ attrs->ndpe = pos;
+ attrs->ndpe_len = attr_len;
+ break;
case NAN_ATTR_MASTER_INDICATION:
case NAN_ATTR_CLUSTER:
case NAN_ATTR_NAN_ATTR_SERVICE_ID_LIST:
@@ -240,7 +253,6 @@ int nan_parse_attrs(struct nan_data *nan, const u8 *data, size_t len,
case NAN_ATTR_EXT_MESH:
case NAN_ATTR_PUBLIC_AVAILABILITY:
case NAN_ATTR_SUBSC_SERVICE_ID_LIST:
- case NAN_ATTR_NDP_EXT:
case NAN_ATTR_S3:
case NAN_ATTR_TPEA:
case NAN_ATTR_VENDOR_SPECIFIC:
--
2.53.0
More information about the Hostap
mailing list