[PATCH 15/92] wpa_supplicant: Set NAN Identity Key and its lifetime to NAN module
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:23:06 PDT 2026
From: Avraham Stern <avraham.stern at intel.com>
Set the NAN Identity Key to a random value on init, and set its
default lifetime to 12 hours. The option to set the NAN Identity Key
from control interface will be added in a later patch.
Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
wpa_supplicant/nan_supplicant.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index 900b9eeb83..c661fa2f6b 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -54,6 +54,9 @@
#define DEFAULT_NAN_BOOTSTRAP_COMEBACK_TIMEOUT 1024
+/* Default NAN NIK lifetime in seconds - 12 hours */
+#define NAN_NIK_LIFETIME_DEFAULT 43200
+
#ifdef CONFIG_NAN
static int get_center(u8 channel, const u8 *center_channels,
@@ -902,6 +905,13 @@ int wpas_nan_init(struct wpa_supplicant *wpa_s)
nan.auto_accept_bootstrap_methods = DEFAULT_NAN_AUTO_ACCEPT_PBM;
nan.bootstrap_comeback_timeout = DEFAULT_NAN_BOOTSTRAP_COMEBACK_TIMEOUT;
+ if (os_get_random(nan.nik, NAN_NIK_LEN) < 0) {
+ wpa_printf(MSG_DEBUG, "NAN: Failed to get random data for NIK");
+ return -1;
+ }
+
+ nan.nik_lifetime = NAN_NIK_LIFETIME_DEFAULT;
+
wpa_s->nan = nan_init(&nan);
if (!wpa_s->nan) {
wpa_printf(MSG_INFO, "NAN: Failed to init");
--
2.53.0
More information about the Hostap
mailing list