[RFC v2 77/99] NAN_DE: Add a callback for additional attributes

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Dec 23 03:52:21 PST 2025


This will be used to publish device capabilities and availability maps
in SDFs.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/common/nan_de.c | 7 +++++++
 src/common/nan_de.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/common/nan_de.c b/src/common/nan_de.c
index 55cf60545c..562cf73f71 100644
--- a/src/common/nan_de.c
+++ b/src/common/nan_de.c
@@ -293,6 +293,10 @@ static void nan_de_tx_sdf(struct nan_de *de, struct nan_de_service *srv,
 	if (srv->elems)
 		len += NAN_ATTR_HDR_LEN + 1 + wpabuf_len(srv->elems);
 
+	/* Reserve some additional space for extra attributes */
+	if (de->cb.add_extra_attrs)
+		len += 256;
+
 	buf = nan_de_alloc_sdf(len);
 	if (!buf)
 		return;
@@ -354,6 +358,9 @@ static void nan_de_tx_sdf(struct nan_de *de, struct nan_de_service *srv,
 		wpabuf_put_buf(buf, srv->elems);
 	}
 
+	if (de->cb.add_extra_attrs)
+		de->cb.add_extra_attrs(de->cb.ctx, buf);
+
 	nan_de_tx(de, srv->sync ? 0 : srv->freq, srv->sync ? 0 : wait_time,
 		  dst, de->nmi, a3, buf);
 	wpabuf_free(buf);
diff --git a/src/common/nan_de.h b/src/common/nan_de.h
index 8129264c56..f21fe8c506 100644
--- a/src/common/nan_de.h
+++ b/src/common/nan_de.h
@@ -64,6 +64,7 @@ struct nan_callbacks {
 	void (*process_pr_usd_elems)(void *ctx, const u8 *buf,
 				     u16 buf_len, const u8 *peer_addr,
 				     unsigned int freq);
+	void (*add_extra_attrs)(void *ctx, struct wpabuf *buf);
 };
 
 bool nan_de_is_nan_network_id(const u8 *addr);
-- 
2.49.0




More information about the Hostap mailing list