[PATCH 88/92] NAN: Indicate the service supported bootstrap and pairing methods
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:24:19 PDT 2026
From: Ilan Peer <ilan.peer at intel.com>
Extend the NAN DE discovery result callback to also indicate
the supported bootstrap and pairing methods.
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 | 28 ++++++++++++++++++++++++++++
src/common/nan_de.h | 1 +
wpa_supplicant/notify.c | 6 ++++--
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/common/nan_de.c b/src/common/nan_de.c
index 7cf7cb9662..ba0524da75 100644
--- a/src/common/nan_de.c
+++ b/src/common/nan_de.c
@@ -1322,6 +1322,31 @@ static void nan_de_parse_dcea(const u8 *buf, size_t len, bool *pairing_setup,
}
+static u16 nan_de_get_advertise_pbm(const u8 *buf, size_t len)
+{
+ const u8 *npba;
+ u16 npba_len;
+
+ npba = nan_de_get_attr(buf, len, NAN_ATTR_NPBA, 0);
+ if (!npba)
+ return 0;
+
+ npba_len = WPA_GET_LE16(npba + 1);
+ if (npba_len < 5) {
+ wpa_printf(MSG_DEBUG, "NAN: Invalid NPBA length %u",
+ npba_len);
+ return 0;
+ }
+
+ /* Skip the attribute ID and length */
+ npba += NAN_ATTR_HDR_LEN;
+ if ((npba[1] & NAN_PBA_TYPE_MASK) != NAN_PBA_TYPE_ADVERTISE)
+ return 0;
+
+ return WPA_GET_LE16(npba + 3);
+}
+
+
static bool nan_de_filter_match(struct nan_de_service *srv,
const u8 *matching_filter,
size_t matching_filter_len)
@@ -1503,6 +1528,9 @@ send_event:
nan_de_parse_dcea(buf, buf_len,
&res.pairing_setup_supp,
&res.npk_nik_caching_supp);
+
+ /* Get the bootstrapping methods */
+ res.pbm = nan_de_get_advertise_pbm(buf, buf_len);
}
res.subscribe_id = srv->id;
diff --git a/src/common/nan_de.h b/src/common/nan_de.h
index 7d8af9453b..24b6fcb028 100644
--- a/src/common/nan_de.h
+++ b/src/common/nan_de.h
@@ -39,6 +39,7 @@ struct nan_discovery_result {
size_t n_cipher_suites;
bool pairing_setup_supp;
bool npk_nik_caching_supp;
+ u16 pbm;
};
struct nan_callbacks {
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 648d467201..5cfe1020bc 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1154,7 +1154,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"
- " pairing_setup_supp=%d npk_nik_caching_supp=%d",
+ " pairing_setup_supp=%d npk_nik_caching_supp=%d"
+ " pbm=0x%04x",
res->subscribe_id,
res->peer_publish_id,
MAC2STR(res->peer_addr),
@@ -1163,7 +1164,8 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
pmkid_hex ? pmkid_hex : "",
cipher_suites_str ? " cipher_suites=" : "",
cipher_suites_str ? cipher_suites_str : "",
- res->pairing_setup_supp, res->npk_nik_caching_supp);
+ res->pairing_setup_supp, res->npk_nik_caching_supp,
+ res->pbm);
os_free(ssi_hex);
os_free(pmkid_hex);
os_free(cipher_suites_str);
--
2.53.0
More information about the Hostap
mailing list