]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
NAN: Handle cluster join and next DW events
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Tue, 23 Dec 2025 11:46:00 +0000 (13:46 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 29 Jan 2026 10:31:55 +0000 (12:31 +0200)
To support synchronized NAN Discovery Engine (DE) in wpa_supplicant, the
driver will report two new events:

NAN_CLUSTER_JOIN: This event is sent whenever a new NAN cluster is
started or joined. This event carries the new cluster id, which will be
used to construct SDFs.

NAN_NEXT_DW: A notification about an upcoming Discovery Window (DW).
This event is optional and may be turned on and off. It is used to
trigger multicast SDF transmissions during the upcoming DW.

Define these events and add the functions needed for delivering thenm to
nan_supplicant.c

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/drivers/driver.h
src/drivers/driver_common.c
wpa_supplicant/events.c
wpa_supplicant/nan_supplicant.c
wpa_supplicant/nan_supplicant.h

index 018c9792ff19ba8c4193f369fd745f7b3f724ed8..b91d4fc6efad6bfa599bfb13f0d8eb172f770036 100644 (file)
@@ -6221,6 +6221,30 @@ enum wpa_event_type {
         * EVENT_SETUP_LINK_RECONFIG - Notification that new AP links added
         */
        EVENT_SETUP_LINK_RECONFIG,
+
+       /**
+        * EVENT_NAN_CLUSTER_JOIN - Notification of a new cluster having been
+        * joined or started.
+        *
+        * This event is used to notify wpa_supplicant that a NAN cluster has
+        * been joined or started. The event data includes the NAN cluster ID
+        * and a boolean indicating whether a new cluster was started or an
+        * existing cluster was joined.
+        *
+        * Described in wpa_event_data.nan_cluster_join_info.
+        */
+       EVENT_NAN_CLUSTER_JOIN,
+
+       /**
+        * EVENT_NAN_NEXT_DW - Notification of NAN next Discovery Window
+        *
+        * This event is used to notify wpa_supplicant that the device/driver
+        * is ready for the next Discovery Window (DW) frames. It may be used
+        * to trigger transmission of multicast SDFs (active subscribe and
+        * unsolicited publish).
+        * The event data includes the DW frequency.
+        */
+       EVENT_NAN_NEXT_DW,
 };
 
 
@@ -7220,6 +7244,15 @@ union wpa_event_data {
                const u8 *resp_ie; /* Starting from Group Key Data */
                size_t resp_ie_len;
        } reconfig_info;
+
+       struct nan_cluster_join_info {
+               const u8 *bssid;
+               bool new_cluster;
+       } nan_cluster_join_info;
+
+       struct nan_next_dw_info {
+               int freq;
+       } nan_next_dw_info;
 };
 
 /**
index 045c82967f5a155e64ffb81c7d23d7507fada59c..cff25b446a90184b77172584f02e9df660c441b4 100644 (file)
@@ -102,6 +102,8 @@ const char * event_to_string(enum wpa_event_type event)
        E2S(LINK_RECONFIG);
        E2S(MLD_INTERFACE_FREED);
        E2S(SETUP_LINK_RECONFIG);
+       E2S(NAN_CLUSTER_JOIN);
+       E2S(NAN_NEXT_DW);
        }
 
        return "UNKNOWN";
index b9ae7fa5c5d09f47f9d6297debaff11894e6dbd6..016f601530ac456b4af7d5352b3720cfc5e21411 100644 (file)
@@ -7352,6 +7352,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                if (data)
                        wpas_setup_link_reconfig(wpa_s, &data->reconfig_info);
                break;
+#ifdef CONFIG_NAN
+       case EVENT_NAN_CLUSTER_JOIN:
+               wpas_nan_cluster_join(wpa_s, data->nan_cluster_join_info.bssid,
+                                     data->nan_cluster_join_info.new_cluster);
+               break;
+       case EVENT_NAN_NEXT_DW:
+               wpas_nan_next_dw(wpa_s, data->nan_next_dw_info.freq);
+               break;
+#endif /* CONFIG_NAN */
        default:
                wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event);
                break;
index dc37e4c442a05beefff1b0a772a752033e7c6dc6..f25e0bf962a7b4641db555b8410393092382bf5a 100644 (file)
@@ -109,3 +109,26 @@ void wpas_nan_flush(struct wpa_supplicant *wpa_s)
 
        nan_flush(wpa_s->nan);
 }
+
+
+void wpas_nan_cluster_join(struct wpa_supplicant *wpa_s,
+                          const u8 *cluster_id,
+                          bool new_cluster)
+{
+       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);
+}
+
+
+void wpas_nan_next_dw(struct wpa_supplicant *wpa_s, u32 freq)
+{
+       if (!wpas_nan_ready(wpa_s))
+               return;
+
+       /* TODO: Handle DW notification */
+       wpa_printf(MSG_DEBUG, "NAN: Next DW notification freq=%d", freq);
+}
index 615c6f64aae64f63621fc7f7b00eb6c18260cd24..2c2d7ff7aa233046575d6d1d6406ed15eb2645c2 100644 (file)
@@ -16,6 +16,10 @@ void wpas_nan_deinit(struct wpa_supplicant *wpa_s);
 int wpas_nan_start(struct wpa_supplicant *wpa_s);
 int wpas_nan_stop(struct wpa_supplicant *wpa_s);
 void wpas_nan_flush(struct wpa_supplicant *wpa_s);
+void wpas_nan_cluster_join(struct wpa_supplicant *wpa_s,
+                          const u8 *cluster_id,
+                          bool new_cluster);
+void wpas_nan_next_dw(struct wpa_supplicant *wpa_s, u32 freq);
 
 #else /* CONFIG_NAN */