[PATCH 23/97] NAN: Add and implement get_seqnum() callback

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Apr 28 13:05:24 PDT 2026


From: Avraham Stern <avraham.stern at intel.com>

Add a callback for getting the current PN for an installed group key.
The callback will be used to update a new peer with the current
GTK/IGTK/BIGTK PN when sending the key KDE.

Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
 src/nan/nan.h                   | 10 ++++++++++
 wpa_supplicant/nan_supplicant.c |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/src/nan/nan.h b/src/nan/nan.h
index f4e839aa4d..ead37c53fc 100644
--- a/src/nan/nan.h
+++ b/src/nan/nan.h
@@ -719,6 +719,16 @@ struct nan_config {
 			     int key_idx, const u8 *seq,
 			     const u8 *key, size_t key_len,
 			     enum key_flag key_flags);
+
+	/**
+	 * get_seqnum - Get current PN for a group key
+	 *
+	 * @ctx: Callback context from cb_ctx
+	 * @key_idx: Key index
+	 * @seq: Buffer for returning the latest used PN value
+	 * Returns: 0 on success, -1 on failure
+	 */
+	int (*get_seqnum)(void *ctx, int key_idx, u8 *seq);
 };
 
 struct nan_data * nan_init(const struct nan_config *cfg);
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index 5e612dd73c..3a004abd24 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -928,6 +928,14 @@ static int wpas_nan_set_group_key_cb(void *ctx, enum wpa_alg alg,
 }
 
 
+static int wpas_nan_get_seqnum_cb(void *ctx, int key_idx, u8 *seq)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+
+	return wpa_drv_get_seqnum(wpa_s, NULL, key_idx, seq);
+}
+
+
 static int wpas_nan_update_pairing_credentials_cb(void *ctx, const u8 *nik,
 						  size_t nik_len,
 						  int cipher_ver,
@@ -1141,6 +1149,7 @@ int wpas_nan_init(struct wpa_supplicant *wpa_s)
 		nan.is_valid_publish_id = wpas_nan_is_valid_publish_id_cb;
 		nan.set_peer_schedule = wpas_nan_set_peer_schedule_cb;
 		nan.set_group_key = wpas_nan_set_group_key_cb;
+		nan.get_seqnum = wpas_nan_get_seqnum_cb;
 
 		wpa_printf(MSG_DEBUG, "NAN: Bootstrap support enabled");
 		nan.bootstrap_request = wpas_nan_bootstrap_request_cb;
-- 
2.53.0




More information about the Hostap mailing list