[PATCH v2 3/3] NAN: Pass peer NIRA nonce and tag in pairing request notifications

Junyu Lai junyulai at google.com
Mon Nov 2 22:38:05 PST 2026


When a peer initiates a PASN pairing request, upper-layer notification
handlers need the peer's NAN Identity Resolution Attribute (NIRA) nonce
and tag to perform identity resolution and pairing verification.

- Retrieve the peer's NIRA nonce and tag via nan_peer_get_pairing_cfg()
  in wpas_nan_pasn_pairing_request_cb().
- Pass the nonce and tag to wpas_notify_nan_pairing_request().

Signed-off-by: Junyu Lai <junyulai at google.com>
---
v2:
  - Rebase onto latest main and resolve conflict in wpa_supplicant/notify.h
    after commit ae95402b2d2e ("NAN-PKBST: Accept Public Key Record updates
    over Protected Transport").
---
 wpa_supplicant/nan_supplicant.c | 15 ++++++++++++++-
 wpa_supplicant/notify.c         |  3 ++-
 wpa_supplicant/notify.h         |  3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index cc4d1a678..9f03b2485 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -1345,10 +1345,23 @@ wpas_nan_pasn_pairing_request_cb(void *ctx, const u8 *peer_nmi, u8 csid,
 				 const struct wpa_ie_data *rsn_data)
 {
 	struct wpa_supplicant *wpa_s = ctx;
+	const struct nan_pairing_cfg *pairing_cfg;
+	const u8 *nonce = NULL;
+	const u8 *tag = NULL;
+
+	pairing_cfg = nan_peer_get_pairing_cfg(wpa_s->nan, peer_nmi,
+					       &nonce, &tag);
+	if (!pairing_cfg) {
+		wpa_printf(MSG_DEBUG,
+			   "NAN: No pairing config found for peer " MACSTR,
+			   MAC2STR(peer_nmi));
+		return;
+	}
 
 	wpas_notify_nan_pairing_request(wpa_s, peer_nmi, csid, instance_id,
 					rsn_data->key_mgmt,
-					!!rsn_data->num_pmkid);
+					!!rsn_data->num_pmkid,
+					nonce, tag);
 }
 
 #endif /* CONFIG_PASN */
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index f4daba6b9..adda8f49e 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1388,7 +1388,8 @@ out:
 void wpas_notify_nan_pairing_request(struct wpa_supplicant *wpa_s,
 				     const u8 *peer_nmi, u8 csid,
 				     u8 instance_id, int key_mgmt,
-				     bool verify)
+				     bool verify, const u8 *nonce,
+				     const u8 *tag)
 {
 	wpa_msg_global(wpa_s, MSG_INFO, NAN_PAIRING_REQUEST
 		       "peer_nmi=" MACSTR
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index b2e1c8c26..9057da133 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -249,7 +249,8 @@ void wpas_notify_nan_bootstrap_failure(struct wpa_supplicant *wpa_s,
 void wpas_notify_nan_pairing_request(struct wpa_supplicant *wpa_s,
 				     const u8 *peer_nmi, u8 csid,
 				     u8 instance_id, int key_mgmt,
-				     bool verify);
+				     bool verify, const u8 *nonce,
+				     const u8 *tag);
 void wpas_notify_nan_pkr_update(struct wpa_supplicant *wpa_s,
 				const u8 *peer_nmi, const u8 *iik,
 				bool revoked);
-- 
2.56.0.385.gac671c819a-goog




More information about the Hostap mailing list