[PATCH 28/58] NAN: Add an API to update the cluster ID
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Thu Feb 19 12:24:44 PST 2026
From: Ilan Peer <ilan.peer at intel.com>
Add an API to the NAN module to allow updating the cluster ID
by higher layer.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/nan/nan.c | 11 +++++++++++
src/nan/nan.h | 1 +
src/nan/nan_i.h | 3 +++
wpa_supplicant/nan_supplicant.c | 1 +
4 files changed, 16 insertions(+)
diff --git a/src/nan/nan.c b/src/nan/nan.c
index 455ba7f64f..bc0386373f 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -1024,3 +1024,14 @@ bool nan_publish_instance_id_valid(struct nan_data *nan, u8 instance_id,
"NAN: TODO: Publish instance ID validation not implemented");
return true;
}
+
+
+/*
+ * nan_set_cluster_id - Set the cluster ID
+ * @nan: NAN module context from nan_init()
+ * @cluster_id: the cluster ID (6 bytes)
+ */
+void nan_set_cluster_id(struct nan_data *nan, const u8 *cluster_id)
+{
+ os_memcpy(nan->cluster_id, cluster_id, sizeof(nan->cluster_id));
+}
diff --git a/src/nan/nan.h b/src/nan/nan.h
index 07fdb90541..0810eefb5f 100644
--- a/src/nan/nan.h
+++ b/src/nan/nan.h
@@ -401,5 +401,6 @@ int nan_add_peer(struct nan_data *nan, const u8 *addr,
bool nan_publish_instance_id_valid(struct nan_data *nan, u8 instance_id,
u8 *service_id);
+void nan_set_cluster_id(struct nan_data *nan, const u8 *cluster_id);
#endif /* NAN_H */
diff --git a/src/nan/nan_i.h b/src/nan/nan_i.h
index 39d23ffa93..42a34614c7 100644
--- a/src/nan/nan_i.h
+++ b/src/nan/nan_i.h
@@ -326,6 +326,7 @@ struct nan_peer {
* and is used to set ndp_id in &struct nan_ndp.
* @next_dialog_token: Dialog token for NDP and NDL negotiations. Incremented
* for each NDP and NDL request.
+ * @cluster_id: Current cluster ID.
*/
struct nan_data {
struct nan_config *cfg;
@@ -334,6 +335,8 @@ struct nan_data {
u8 ndp_id_counter;
u8 next_dialog_token;
+
+ u8 cluster_id[ETH_ALEN];
};
struct nan_attrs_entry {
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index b47fe97ff8..f18d7286be 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -293,6 +293,7 @@ void wpas_nan_cluster_join(struct wpa_supplicant *wpa_s,
" new=%d", MAC2STR(cluster_id), new_cluster);
nan_de_set_cluster_id(wpa_s->nan_de, cluster_id);
+ nan_set_cluster_id(wpa_s->nan, cluster_id);
}
--
2.52.0
More information about the Hostap
mailing list