[PATCH 3/3] NAN: Pass peer NIRA nonce and tag in pairing request notifications
Junyu Lai
junyulai at google.com
Mon Oct 12 23:08:17 PDT 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() and pass them to
wpas_notify_nan_pairing_request().
This is safe because nan_peer_get_pairing_cfg() validates the peer
context and initializes nonce and tag to NULL when no NIRA was received
from the peer.
Signed-off-by: Junyu Lai <junyulai at google.com>
---
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 fae80fb21..900a392b1 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -1334,10 +1334,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 9c638ddbc..3aa967fed 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 15c9ca56c..6e5864ba2 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_ndp_request(struct wpa_supplicant *wpa_s,
const u8 *peer_nmi, const u8 *init_ndi,
u32 ndp_id, u8 publish_inst_id,
--
2.56.0.385.gd3acb90ef8-goog
More information about the Hostap
mailing list