[PATCH 60/97] wpa_supplicant: NAN: Add support for max NDL idle period
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Apr 28 13:06:01 PDT 2026
From: Ilan Peer <ilan.peer at intel.com>
- By default, configure the local max NDL idle period to be
25 seconds.
- Allow setting the local max NDL idle period using:
"NAN_SET max_ndl_idle_period=<val>"
- Add a callback to get the inactive time for a
peer NDI station on a given local NDI interface.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
wpa_supplicant/driver_i.h | 9 +++++++++
wpa_supplicant/nan_supplicant.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 0f0db5bd6a..2166d86e32 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -1329,6 +1329,15 @@ wpa_drv_nan_config_peer_schedule(struct wpa_supplicant *wpa_s, const u8 *peer,
ulw, sched);
}
+static inline int wpa_drv_get_inact_sec(struct wpa_supplicant *wpa_s,
+ const u8 *addr)
+{
+ if (!wpa_s->driver->get_inact_sec)
+ return -1;
+
+ return wpa_s->driver->get_inact_sec(wpa_s->drv_priv, addr);
+}
+
#endif /* CONFIG_NAN */
#endif /* DRIVER_I_H */
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index e2f49f24b6..1640441c38 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -57,6 +57,9 @@
/* Default NAN NIK lifetime in seconds - 12 hours */
#define NAN_NIK_LIFETIME_DEFAULT 43200
+/* Default NAN idle period in seconds */
+#define DEFAULT_NAN_MAX_NDL_IDLE_PERIOD 25
+
#ifdef CONFIG_NAN
static int get_center(u8 channel, const u8 *center_channels,
@@ -1247,6 +1250,22 @@ wpas_nan_pasn_pairing_request_cb(void *ctx, const u8 *peer_nmi, u8 csid,
#endif /* CONFIG_PASN */
+static int wpas_nan_get_peer_inactivity(void *ctx, const u8 *local_ndi, const u8 *peer_ndi)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ wpa_s = wpas_nan_get_ndi_iface(wpa_s, local_ndi);
+ if (!wpa_s) {
+ wpa_printf(MSG_DEBUG,
+ "NAN: No NDI interface found for addr " MACSTR,
+ MAC2STR(local_ndi));
+ return -1;
+ }
+
+ return wpa_drv_get_inact_sec(wpa_s, peer_ndi);
+}
+
+
int wpas_nan_init(struct wpa_supplicant *wpa_s)
{
struct nan_config nan;
@@ -1301,6 +1320,13 @@ int wpas_nan_init(struct wpa_supplicant *wpa_s)
nan.transmit_followup = wpas_nan_transmit_followup_cb;
nan.get_supported_bootstrap_methods =
wpas_nan_get_service_bootstrap_methods;
+
+ if (wpa_s->driver->get_inact_sec)
+ nan.get_peer_inactivity = wpas_nan_get_peer_inactivity;
+ else
+ wpa_printf(MSG_DEBUG,
+ "NAN: Driver does not support getting peer inactivity");
+
/*
* Set the group security capabilities based on driver
* support
@@ -1362,6 +1388,7 @@ int wpas_nan_init(struct wpa_supplicant *wpa_s)
}
nan.nik_lifetime = NAN_NIK_LIFETIME_DEFAULT;
+ nan.max_ndl_idle_period = DEFAULT_NAN_MAX_NDL_IDLE_PERIOD;
wpa_s->nan = nan_init(&nan);
if (!wpa_s->nan) {
@@ -1704,6 +1731,12 @@ int wpas_nan_set(struct wpa_supplicant *wpa_s, char *cmd)
}
#endif /* CONFIG_TESTING_OPTIONS */
+ if (os_strcmp("max_ndl_idle_period", cmd) == 0) {
+ u16 max_ndl_idle_period = atoi(param) & 0xffff;
+
+ return nan_set_max_ndl_idle_period(wpa_s->nan, max_ndl_idle_period);
+ }
+
wpa_printf(MSG_INFO, "NAN: Unknown NAN_SET cmd='%s'", cmd);
return -1;
}
--
2.53.0
More information about the Hostap
mailing list