[PATCH 21/92] wpa_supplicant: Add an API to trigger NAN pairing
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:23:12 PDT 2026
From: Avraham Stern <avraham.stern at intel.com>
Add an API to trigger NAN pairing.
Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
wpa_supplicant/nan_supplicant.c | 34 +++++++++++++++++++++++++++++++++
wpa_supplicant/nan_supplicant.h | 6 ++++++
2 files changed, 40 insertions(+)
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index c661fa2f6b..0eb134a247 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -2542,6 +2542,40 @@ void wpas_nan_next_dw(struct wpa_supplicant *wpa_s, u32 freq)
nan_de_dw_trigger(wpa_s->nan_de, freq);
}
+
+#ifdef CONFIG_PASN
+/*
+ * wpas_nan_pair - Initiate NAN pairing with a peer device
+ *
+ * @wpa_s: Pointer to wpa_supplicant data structure
+ * @peer_addr: MAC address of the peer device to pair with
+ * @auth_mode: Authentication mode to use for pairing
+ * @cipher: Cipher suite to use for the pairing session
+ * @handle: Handle of the service for which pairing is requested
+ * @peer_instance_id: Instance ID of the peer service
+ * @responder: True if the local device is the responder, false if initiator
+ * @password: Password for PASN authentication
+ * Returns: 0 on success, -1 on failure
+ */
+int wpas_nan_pair(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
+ u8 auth_mode, int cipher, int handle, u8 peer_instance_id,
+ bool responder, const char *password)
+{
+ int ret;
+
+ if (!wpas_nan_ready(wpa_s))
+ return -1;
+
+ ret = nan_pairing_initiate_pasn_auth(wpa_s->nan, peer_addr, auth_mode,
+ cipher, handle, peer_instance_id,
+ responder, password);
+ if (ret)
+ wpa_printf(MSG_DEBUG,
+ "NAN PASN: Failed to start PASN authentication");
+
+ return ret;
+}
+#endif /* CONFIG_PASN */
#endif /* CONFIG_NAN */
diff --git a/wpa_supplicant/nan_supplicant.h b/wpa_supplicant/nan_supplicant.h
index 93e163222a..3568366b83 100644
--- a/wpa_supplicant/nan_supplicant.h
+++ b/wpa_supplicant/nan_supplicant.h
@@ -35,6 +35,12 @@ int wpas_nan_peer_info(struct wpa_supplicant *wpa_s, const char *cmd,
int wpas_nan_bootstrap_request(struct wpa_supplicant *wpa_s, char *cmd);
int wpas_nan_bootstrap_reset(struct wpa_supplicant *wpa_s, char *cmd);
+#ifdef CONFIG_PASN
+int wpas_nan_pair(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
+ u8 auth_mode, int cipher, int handle, u8 peer_instance_id,
+ bool responder, const char *password);
+#endif /* CONFIG_PASN */
+
#else /* CONFIG_NAN */
static inline int wpas_nan_init(struct wpa_supplicant *wpa_s)
--
2.53.0
More information about the Hostap
mailing list