[PATCH 76/97] NAN: Add Unaligned Schedule attribute to the list of parsed attributes
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Apr 28 13:06:17 PDT 2026
From: Avraham Stern <avraham.stern at intel.com>
Parse Unaligned Schedule attributes in nan_parse_attrs(). Save them
as a list since a frame may contain more than one Unaligned Schedule
attribute.
Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
src/common/nan_defs.h | 37 +++++++++++++++++++++++++++++++++++++
src/nan/nan_i.h | 1 +
src/nan/nan_util.c | 15 ++++++++++++++-
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/src/common/nan_defs.h b/src/common/nan_defs.h
index dfc602a42a..1ecc8bd2f7 100644
--- a/src/common/nan_defs.h
+++ b/src/common/nan_defs.h
@@ -406,6 +406,43 @@ struct nan_avail {
u8 optional[0];
} STRUCT_PACKED;
+/* See Table 110 (Attribute Control field format for the Unaligned Schedule
+ * attribute)
+ */
+#define NAN_UNALIGNED_SCHED_CTRL_SCHED_ID_MASK (BIT(0) | BIT(1) | BIT(2) | \
+ BIT(3))
+
+/* See Table 111 (ULW Overwrite field format) */
+#define NAN_ULW_OVERWRITE_ALL BIT(0)
+#define NAN_ULW_OVERWRITE_MAP_ID_POS 1
+#define NAN_ULW_OVERWRITE_MAP_ID_MASK (BIT(1) | BIT(2) | BIT(3) | BIT(4))
+
+/* See Table 112 (ULW Control field format) */
+#define NAN_ULW_CTRL_TYPE_POS 0
+#define NAN_ULW_CTRL_TYPE_MASK (BIT(0) | BIT(1))
+#define NAN_ULW_CTRL_TYPE_BAND_ID 0
+#define NAN_ULW_CTRL_TYPE_CHAN_ENTRY 1
+#define NAN_ULW_CTRL_TYPE_CHAN_ENTRY_WITH_AUX 2
+#define NAN_ULW_CTRL_CHAN_AVAIL BIT(2)
+#define NAN_ULW_CTRL_RX_NSS_POS 3
+#define NAN_ULW_CTRL_RX_NSS_MASK (BIT(3) | BIT(4) | BIT(5) | BIT(6))
+
+/* See Table 109 (Unaligned Schedule attribute format). ID and length are not
+ * included.
+ */
+struct nan_unaligned_sched {
+ u8 sched_id;
+ u8 seq_id;
+ le32 start_time;
+ le32 duration;
+ le32 period;
+ u8 count_down;
+ u8 ulw_overwrite;
+
+ /* followed by optional fields (ulw control and band/channel entry) */
+ u8 optional[0];
+} STRUCT_PACKED;
+
#define NAN_SCHED_ENTRY_MAP_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
/* Wi-Fi Aware spec v4.0, Table 104 (Schedule Entry format for the NDC
diff --git a/src/nan/nan_i.h b/src/nan/nan_i.h
index 3c8e94958c..264eaa0131 100644
--- a/src/nan/nan_i.h
+++ b/src/nan/nan_i.h
@@ -620,6 +620,7 @@ struct nan_attrs {
struct dl_list serv_desc_ext;
struct dl_list avail;
struct dl_list ndc;
+ struct dl_list ulw;
struct dl_list dev_capa;
struct dl_list element_container;
diff --git a/src/nan/nan_util.c b/src/nan/nan_util.c
index da9337092a..4283b2a6cf 100644
--- a/src/nan/nan_util.c
+++ b/src/nan/nan_util.c
@@ -37,6 +37,7 @@ void nan_attrs_clear(struct nan_data *nan, struct nan_attrs *attrs)
nan_attrs_clear_list(nan, &attrs->serv_desc_ext);
nan_attrs_clear_list(nan, &attrs->avail);
nan_attrs_clear_list(nan, &attrs->ndc);
+ nan_attrs_clear_list(nan, &attrs->ulw);
nan_attrs_clear_list(nan, &attrs->dev_capa);
nan_attrs_clear_list(nan, &attrs->element_container);
@@ -67,6 +68,7 @@ int nan_parse_attrs(struct nan_data *nan, const u8 *data, size_t len,
dl_list_init(&attrs->serv_desc_ext);
dl_list_init(&attrs->avail);
dl_list_init(&attrs->ndc);
+ dl_list_init(&attrs->ulw);
dl_list_init(&attrs->dev_capa);
dl_list_init(&attrs->element_container);
@@ -135,6 +137,18 @@ int nan_parse_attrs(struct nan_data *nan, const u8 *data, size_t len,
entry->len = attr_len;
dl_list_add_tail(&attrs->ndc, &entry->list);
break;
+ case NAN_ATTR_UNALIGNED_SCHEDULE:
+ if (attr_len < sizeof(struct nan_unaligned_sched))
+ break;
+
+ entry = os_malloc(sizeof(*entry));
+ if (!entry)
+ goto fail;
+
+ entry->ptr = pos;
+ entry->len = attr_len;
+ dl_list_add_tail(&attrs->ulw, &entry->list);
+ break;
case NAN_ATTR_NDL:
/* Validate minimal NDL attribute length */
if (attr_len < sizeof(struct ieee80211_ndl))
@@ -243,7 +257,6 @@ int nan_parse_attrs(struct nan_data *nan, const u8 *data, size_t len,
case NAN_ATTR_COUNTRY_CODE:
case NAN_ATTR_RANGING:
case NAN_ATTR_CLUSTER_DISCOVERY:
- case NAN_ATTR_UNALIGNED_SCHEDULE:
case NAN_ATTR_RANGING_INFO:
case NAN_ATTR_RANGING_SETUP:
case NAN_ATTR_FTM_RANGING_REPORT:
--
2.53.0
More information about the Hostap
mailing list