[PATCH 87/92] NAN: Indicate if a service supports pairing and/or NPK/NIK caching
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:24:18 PDT 2026
From: Ilan Peer <ilan.peer at intel.com>
Extend the NAN DE discovery result callback to also indicate
support for pairing and NPK/NIK caching.
In addition, extend the discovery result notification to include
this information.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/common/nan_de.c | 36 ++++++++++++++++++++++++++++++++++++
src/common/nan_de.h | 2 ++
wpa_supplicant/notify.c | 6 ++++--
3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/common/nan_de.c b/src/common/nan_de.c
index 10ffcabce4..7cf7cb9662 100644
--- a/src/common/nan_de.c
+++ b/src/common/nan_de.c
@@ -1294,6 +1294,34 @@ static void nan_de_process_elem_container(struct nan_de *de, const u8 *buf,
}
+static void nan_de_parse_dcea(const u8 *buf, size_t len, bool *pairing_setup,
+ bool *npk_nik_caching)
+{
+ const u8 *dcea;
+ u16 dcea_len;
+
+ *pairing_setup = false;
+ *npk_nik_caching = false;
+
+ dcea = nan_de_get_attr(buf, len, NAN_ATTR_DCEA, 0);
+ if (!dcea)
+ return;
+
+ dcea_len = WPA_GET_LE16(dcea + 1);
+ if (dcea_len < 2) {
+ wpa_printf(MSG_DEBUG,
+ "NAN: DCEA length=%u too short",
+ dcea_len);
+ return;
+ }
+
+ *pairing_setup = !!(dcea[4] &
+ NAN_DEV_CAPA_EXT_INFO_1_PAIRING_SETUP);
+ *npk_nik_caching = !!(dcea[4] &
+ NAN_DEV_CAPA_EXT_INFO_1_NPK_NIK_CACHING);
+}
+
+
static bool nan_de_filter_match(struct nan_de_service *srv,
const u8 *matching_filter,
size_t matching_filter_len)
@@ -1467,6 +1495,14 @@ send_event:
nan_de_parse_scia(buf, buf_len, instance_id,
pmkid_list,
sizeof(pmkid_list) / PMKID_LEN);
+
+ /*
+ * Parse Device Capability Extension Attribute for pairing
+ * setup and NPK/NIK caching support
+ */
+ nan_de_parse_dcea(buf, buf_len,
+ &res.pairing_setup_supp,
+ &res.npk_nik_caching_supp);
}
res.subscribe_id = srv->id;
diff --git a/src/common/nan_de.h b/src/common/nan_de.h
index cfba430bc6..7d8af9453b 100644
--- a/src/common/nan_de.h
+++ b/src/common/nan_de.h
@@ -37,6 +37,8 @@ struct nan_discovery_result {
size_t pmkid_count;
const u8 *cipher_suites;
size_t n_cipher_suites;
+ bool pairing_setup_supp;
+ bool npk_nik_caching_supp;
};
struct nan_callbacks {
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index d2b9c66c33..648d467201 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1153,7 +1153,8 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
wpa_msg_global(wpa_s, MSG_INFO, NAN_DISCOVERY_RESULT
"subscribe_id=%d publish_id=%d address=" MACSTR
- " fsd=%d fsd_gas=%d srv_proto_type=%u ssi=%s%s%s%s%s",
+ " fsd=%d fsd_gas=%d srv_proto_type=%u ssi=%s%s%s%s%s"
+ " pairing_setup_supp=%d npk_nik_caching_supp=%d",
res->subscribe_id,
res->peer_publish_id,
MAC2STR(res->peer_addr),
@@ -1161,7 +1162,8 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
pmkid_hex ? " pmkid=" : "",
pmkid_hex ? pmkid_hex : "",
cipher_suites_str ? " cipher_suites=" : "",
- cipher_suites_str ? cipher_suites_str : "");
+ cipher_suites_str ? cipher_suites_str : "",
+ res->pairing_setup_supp, res->npk_nik_caching_supp);
os_free(ssi_hex);
os_free(pmkid_hex);
os_free(cipher_suites_str);
--
2.53.0
More information about the Hostap
mailing list