[PATCH 56/92] wpa_supplicant: Add supported cipher suites to NAN discovery result
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:23:47 PDT 2026
From: Avraham Stern <avraham.stern at intel.com>
Add a list of supported cipher suites to the NAN discovery result
event.
Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
wpa_supplicant/nan_supplicant.c | 3 ++-
wpa_supplicant/notify.c | 33 ++++++++++++++++++++++++++++++---
wpa_supplicant/notify.h | 4 +++-
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index 495cae0e2c..a726e5e5d9 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -3148,7 +3148,8 @@ wpas_nan_de_discovery_result(void *ctx, int subscribe_id,
wpas_notify_nan_discovery_result(wpa_s, srv_proto_type, subscribe_id,
peer_publish_id, peer_addr, fsd,
fsd_gas, ssi, ssi_len,
- pmkid_list, pmkid_count);
+ pmkid_list, pmkid_count,
+ cipher_suite, n_cipher_suite);
}
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 6612b291b4..36f408424b 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1106,9 +1106,12 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
const u8 *peer_addr,
bool fsd, bool fsd_gas,
const u8 *ssi, size_t ssi_len,
- const u8 *pmkid_list, size_t pmkid_count)
+ const u8 *pmkid_list, size_t pmkid_count,
+ const u8 *cipher_suite_list,
+ size_t cipher_suite_count)
{
char *ssi_hex, *pmkid_hex = NULL;
+ char *cipher_suites_str = NULL;
size_t i;
const size_t pmkid_hex_len = 2 * PMKID_LEN + 1;
@@ -1133,15 +1136,39 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
}
}
+ if (cipher_suite_list && cipher_suite_count > 0) {
+ /* Allocate enough space for trailing space after each cipher */
+ cipher_suites_str = os_zalloc(cipher_suite_count * 2);
+ if (cipher_suites_str) {
+ char *pos = cipher_suites_str;
+
+ for (i = 0; i < cipher_suite_count; i++) {
+ int ret = os_snprintf(pos,
+ cipher_suite_count * 2 - (pos - cipher_suites_str),
+ "%s%u",
+ i > 0 ? "," : "",
+ cipher_suite_list[i]);
+
+ if (os_snprintf_error(cipher_suite_count * 2 - (pos - cipher_suites_str),
+ ret))
+ break;
+ pos += ret;
+ }
+ }
+ }
+
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",
+ " fsd=%d fsd_gas=%d srv_proto_type=%u ssi=%s%s%s%s%s",
subscribe_id, peer_publish_id, MAC2STR(peer_addr),
fsd, fsd_gas, srv_proto_type, ssi_hex,
pmkid_hex ? " pmkid=" : "",
- pmkid_hex ? pmkid_hex : "");
+ pmkid_hex ? pmkid_hex : "",
+ cipher_suites_str ? " cipher_suites=" : "",
+ cipher_suites_str ? cipher_suites_str : "");
os_free(ssi_hex);
os_free(pmkid_hex);
+ os_free(cipher_suites_str);
wpas_dbus_signal_nan_discovery_result(wpa_s, srv_proto_type,
subscribe_id, peer_publish_id,
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 8047b17d52..161c253a4c 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -191,7 +191,9 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
const u8 *peer_addr,
bool fsd, bool fsd_gas,
const u8 *ssi, size_t ssi_len,
- const u8 *pmkid_list, size_t pmkid_count);
+ const u8 *pmkid_list, size_t pmkid_count,
+ const u8 *cipher_suite_list,
+ size_t cipher_suite_count);
void wpas_notify_nan_replied(struct wpa_supplicant *wpa_s,
enum nan_service_protocol_type srv_proto_type,
int publish_id, int peer_subscribe_id,
--
2.53.0
More information about the Hostap
mailing list