]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
NAN: Handle cluster join notification
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Tue, 23 Dec 2025 11:46:06 +0000 (13:46 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 29 Jan 2026 10:31:55 +0000 (12:31 +0200)
Store cluster ID and send a notification over the control interface.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/common/nan_de.c
src/common/nan_de.h
src/common/wpa_ctrl.h
wpa_supplicant/nan_supplicant.c

index 9d2f6bc04a64e3e4694ec4e1064ff909d2cef679..e31ab715cd5de69c7c7d80174acaee964157c6fc 100644 (file)
@@ -73,6 +73,8 @@ struct nan_de_service {
 
 struct nan_de {
        u8 nmi[ETH_ALEN];
+       u8 cluster_id[ETH_ALEN];
+       bool cluster_id_set;
        bool offload;
        bool ap;
        unsigned int max_listen;
@@ -1748,3 +1750,14 @@ int nan_de_config(struct nan_de *de, struct nan_de_cfg *cfg)
 
        return 0;
 }
+
+
+void nan_de_set_cluster_id(struct nan_de *de, const u8 *cluster_id)
+{
+       if (cluster_id) {
+               os_memcpy(de->cluster_id, cluster_id, ETH_ALEN);
+               de->cluster_id_set = true;
+       } else {
+               de->cluster_id_set = false;
+       }
+}
index 506188edaaad98c6379596a5e3685c57ab7ee6fc..3d5d348449c95e5fb926d86a3be6195dff3e167e 100644 (file)
@@ -169,6 +169,7 @@ void nan_de_cancel_subscribe(struct nan_de *de, int subscribe_id);
 int nan_de_transmit(struct nan_de *de, int handle,
                    const struct wpabuf *ssi, const struct wpabuf *elems,
                    const u8 *peer_addr, u8 req_instance_id);
+void nan_de_set_cluster_id(struct nan_de *de, const u8 *cluster_id);
 
 int nan_de_stop_listen(struct nan_de *de, int handle);
 
index 3d1735eca58bb3c1d84f1dc9d9bb69c93955eef7..963d304213d1ec449b26107c30e731aa3305cbad 100644 (file)
@@ -240,12 +240,13 @@ extern "C" {
 #define DPP_EVENT_PB_RESULT "DPP-PB-RESULT "
 #define DPP_EVENT_RELAY_NEEDS_CONTROLLER "DPP-RELAY-NEEDS-CONTROLLER "
 
-/* Wi-Fi Aware (NAN USD) events */
+/* Wi-Fi Aware (NAN) events */
 #define NAN_DISCOVERY_RESULT "NAN-DISCOVERY-RESULT "
 #define NAN_REPLIED "NAN-REPLIED "
 #define NAN_PUBLISH_TERMINATED "NAN-PUBLISH-TERMINATED "
 #define NAN_SUBSCRIBE_TERMINATED "NAN-SUBSCRIBE-TERMINATED "
 #define NAN_RECEIVE "NAN-RECEIVE "
+#define NAN_CLUSTER_JOIN "NAN-CLUSTER-JOIN "
 
 /* MESH events */
 #define MESH_GROUP_STARTED "MESH-GROUP-STARTED "
index 4e281a2c602fa1af434fd08bca5dc8900d746e77..cfe41737350ba08323bd14b7e9486f5cf309ad5b 100644 (file)
@@ -106,6 +106,7 @@ int wpas_nan_stop(struct wpa_supplicant *wpa_s)
                return -1;
 
        nan_stop(wpa_s->nan);
+       nan_de_set_cluster_id(wpa_s->nan_de, NULL);
 
        return 0;
 }
@@ -127,9 +128,10 @@ void wpas_nan_cluster_join(struct wpa_supplicant *wpa_s,
        if (!wpas_nan_ready(wpa_s))
                return;
 
-       /* TODO: Handle cluster merge */
-       wpa_printf(MSG_DEBUG, "NAN: Joined cluster " MACSTR " (new: %d)",
-                  MAC2STR(cluster_id), new_cluster);
+       wpa_msg_global(wpa_s, MSG_INFO, NAN_CLUSTER_JOIN "cluster_id=" MACSTR
+                      " new=%d", MAC2STR(cluster_id), new_cluster);
+
+       nan_de_set_cluster_id(wpa_s->nan_de, cluster_id);
 }