[PATCH 80/92] NAN: Add handle and requestor_instance_id parameters in BOOTSTRAP events
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:24:11 PDT 2026
This is needed by upper layers.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
src/nan/nan.h | 10 ++++++++--
src/nan/nan_bootstrap.c | 29 +++++++++++++++++++++--------
wpa_supplicant/nan_supplicant.c | 15 ++++++++++-----
wpa_supplicant/notify.c | 23 ++++++++++++++---------
wpa_supplicant/notify.h | 9 ++++++---
5 files changed, 59 insertions(+), 27 deletions(-)
diff --git a/src/nan/nan.h b/src/nan/nan.h
index 78111a3426..ab89fc6599 100644
--- a/src/nan/nan.h
+++ b/src/nan/nan.h
@@ -561,8 +561,11 @@ struct nan_config {
* @peer_nmi: Peer NMI address
* @pbm: Pairing Bootstrapping Methods from the request. As defined in
* Wi-Fi Aware spec v4.0, Table 128 (NPBA format).
+ * @handle: Service handle
+ * @requestor_instance_id: Requestor instance ID
*/
- void (*bootstrap_request)(void *ctx, const u8 *peer_nmi, u16 pbm);
+ void (*bootstrap_request)(void *ctx, const u8 *peer_nmi, u16 pbm,
+ int handle, u8 requestor_instance_id);
/**
* bootstrap_completed - Notify about completed bootstrap
@@ -572,9 +575,12 @@ struct nan_config {
* spec v4.0, Table 128 (NPBA format).
* @success: Whether bootstrap was successful
* @reason_code: Reason code for failure (0 if success is true)
+ * @handle: Service handle
+ * @requestor_instance_id: Requestor instance ID
*/
void (*bootstrap_completed)(void *ctx, const u8 *peer_nmi, u16 pbm,
- bool success, u8 reason_code);
+ bool success, u8 reason_code,
+ int handle, u8 requestor_instance_id);
/**
* transmit_followup - Transmit Follow-up message to the peer
diff --git a/src/nan/nan_bootstrap.c b/src/nan/nan_bootstrap.c
index 1288ee0470..1fbae27610 100644
--- a/src/nan/nan_bootstrap.c
+++ b/src/nan/nan_bootstrap.c
@@ -163,7 +163,8 @@ static void nan_bootstrap_timeout(void *eloop_data, void *user_ctx)
nan->cfg->bootstrap_completed(nan->cfg->cb_ctx, peer->nmi_addr,
0, false,
- NAN_REASON_UNSPECIFIED_REASON);
+ NAN_REASON_UNSPECIFIED_REASON,
+ -1, 0);
return;
}
@@ -177,7 +178,9 @@ static void nan_bootstrap_timeout(void *eloop_data, void *user_ctx)
nan->cfg->bootstrap_completed(nan->cfg->cb_ctx, peer->nmi_addr,
0, false,
- NAN_REASON_UNSPECIFIED_REASON);
+ NAN_REASON_UNSPECIFIED_REASON,
+ peer->bootstrap.handle,
+ peer->bootstrap.req_instance_id);
}
wpabuf_free(attr);
@@ -309,7 +312,8 @@ static void nan_bootstrap_handle_rx_request(struct nan_data *nan,
if (nan->cfg->bootstrap_request)
nan->cfg->bootstrap_request(nan->cfg->cb_ctx, peer->nmi_addr,
- peer->bootstrap.requested_pbm);
+ peer->bootstrap.requested_pbm,
+ handle, req_instance_id);
send_response:
attr = nan_bootstrap_build_npba(nan, peer);
@@ -326,7 +330,8 @@ send_response:
nan->cfg->bootstrap_completed(nan->cfg->cb_ctx, peer->nmi_addr,
0, false,
- NAN_REASON_UNSPECIFIED_REASON);
+ NAN_REASON_UNSPECIFIED_REASON,
+ handle, req_instance_id);
goto done;
}
@@ -356,7 +361,9 @@ send_response:
peer->bootstrap.requested_pbm,
peer->bootstrap.status ==
NAN_PBA_STATUS_ACCEPTED,
- peer->bootstrap.reason_code);
+ peer->bootstrap.reason_code,
+ peer->bootstrap.handle,
+ peer->bootstrap.req_instance_id);
done:
wpabuf_free(attr);
nan_bootstrap_reset(nan, peer);
@@ -531,13 +538,17 @@ bool nan_bootstrap_handle_rx(struct nan_data *nan, const u8 *peer_nmi,
nan->cfg->bootstrap_completed(nan->cfg->cb_ctx,
peer->nmi_addr,
peer->bootstrap.requested_pbm,
- true, 0);
+ true, 0,
+ peer->bootstrap.handle,
+ peer->bootstrap.req_instance_id);
nan_bootstrap_reset(nan, peer);
} else if (status == NAN_PBA_STATUS_REJECTED) {
wpa_printf(MSG_DEBUG, "NAN: Bootstrap: Rejected. Complete");
nan->cfg->bootstrap_completed(nan->cfg->cb_ctx, peer->nmi_addr,
- 0, false, reason_code);
+ 0, false, reason_code,
+ peer->bootstrap.handle,
+ peer->bootstrap.req_instance_id);
nan_bootstrap_reset(nan, peer);
} else if (status == NAN_PBA_STATUS_COMEBACK) {
wpa_printf(MSG_DEBUG,
@@ -556,7 +567,9 @@ bool nan_bootstrap_handle_rx(struct nan_data *nan, const u8 *peer_nmi,
nan->cfg->bootstrap_completed(nan->cfg->cb_ctx, peer->nmi_addr,
0, false,
- NAN_REASON_UNSPECIFIED_REASON);
+ NAN_REASON_UNSPECIFIED_REASON,
+ peer->bootstrap.handle,
+ peer->bootstrap.req_instance_id);
nan_bootstrap_reset(nan, peer);
}
diff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c
index 15db978f2f..94b7366a8c 100644
--- a/wpa_supplicant/nan_supplicant.c
+++ b/wpa_supplicant/nan_supplicant.c
@@ -812,25 +812,30 @@ static bool wpas_nan_is_valid_publish_id_cb(void *ctx, u8 instance_id,
static void wpas_nan_bootstrap_request_cb(void *ctx, const u8 *peer_nmi,
- u16 pbm)
+ u16 pbm, int handle,
+ u8 requestor_instance_id)
{
struct wpa_supplicant *wpa_s = ctx;
- wpas_notify_nan_bootstrap_request(wpa_s, peer_nmi, pbm);
+ wpas_notify_nan_bootstrap_request(wpa_s, peer_nmi, pbm, handle,
+ requestor_instance_id);
}
static void wpas_nan_bootstrap_completed_cb(void *ctx, const u8 *peer_nmi,
u16 pbm, bool success,
- u8 reason_code)
+ u8 reason_code, int handle,
+ u8 requestor_instance_id)
{
struct wpa_supplicant *wpa_s = ctx;
if (success)
- wpas_notify_nan_bootstrap_success(wpa_s, peer_nmi, pbm);
+ wpas_notify_nan_bootstrap_success(wpa_s, peer_nmi, pbm, handle,
+ requestor_instance_id);
else
wpas_notify_nan_bootstrap_failure(wpa_s, peer_nmi, pbm,
- reason_code);
+ reason_code, handle,
+ requestor_instance_id);
}
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 36f408424b..82f05fd117 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1264,30 +1264,35 @@ void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
void wpas_notify_nan_bootstrap_request(struct wpa_supplicant *wpa_s,
- const u8 *peer_nmi, u16 pbm)
+ const u8 *peer_nmi, u16 pbm,
+ int handle,
+ u8 requestor_instance_id)
{
wpa_msg_global(wpa_s, MSG_INFO, NAN_BOOTSTRAP_REQUEST
- "peer_nmi=" MACSTR " pbm=0x%04x",
- MAC2STR(peer_nmi), pbm);
+ "peer_nmi=" MACSTR " pbm=0x%04x handle=%d requestor_instance_id=%u",
+ MAC2STR(peer_nmi), pbm, handle, requestor_instance_id);
}
void wpas_notify_nan_bootstrap_success(struct wpa_supplicant *wpa_s,
- const u8 *peer_nmi, u16 pbm)
+ const u8 *peer_nmi, u16 pbm,
+ int handle,
+ u8 requestor_instance_id)
{
wpa_msg_global(wpa_s, MSG_INFO, NAN_BOOTSTRAP_SUCCESS
- "peer_nmi=" MACSTR " pbm=0x%04x",
- MAC2STR(peer_nmi), pbm);
+ "peer_nmi=" MACSTR " pbm=0x%04x handle=%d requestor_instance_id=%u",
+ MAC2STR(peer_nmi), pbm, handle, requestor_instance_id);
}
void wpas_notify_nan_bootstrap_failure(struct wpa_supplicant *wpa_s,
const u8 *peer_nmi, u16 pbm,
- u8 reason)
+ u8 reason, int handle,
+ u8 requestor_instance_id)
{
wpa_msg_global(wpa_s, MSG_INFO, NAN_BOOTSTRAP_FAILURE
- "peer_nmi=" MACSTR " pbm=0x%04x reason=%u",
- MAC2STR(peer_nmi), pbm, reason);
+ "peer_nmi=" MACSTR " pbm=0x%04x reason=%u handle=%d requestor_instance_id=%u",
+ MAC2STR(peer_nmi), pbm, reason, handle, requestor_instance_id);
}
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 161c253a4c..3db90b780e 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -221,11 +221,14 @@ void wpas_notify_pr_ranging_params(struct wpa_supplicant *wpa_s,
u8 role, u8 protocol, int freq, int channel,
int bw, int format_bw);
void wpas_notify_nan_bootstrap_request(struct wpa_supplicant *wpa_s,
- const u8 *peer_addr, u16 pbm);
+ const u8 *peer_addr, u16 pbm,
+ int handle, u8 requestor_instance_id);
void wpas_notify_nan_bootstrap_success(struct wpa_supplicant *wpa_s,
- const u8 *peer_addr, u16 pbm);
+ const u8 *peer_addr, u16 pbm,
+ int handle, u8 requestor_instance_id);
void wpas_notify_nan_bootstrap_failure(struct wpa_supplicant *wpa_s,
const u8 *peer_addr, u16 pbm,
- u8 reason);
+ u8 reason, int handle,
+ u8 requestor_instance_id);
#endif /* NOTIFY_H */
--
2.53.0
More information about the Hostap
mailing list