@@ -1975,8 +1975,15 @@ int pr_initiate_pasn_auth(struct pr_data *pr, const u8 *addr, int freq,
pasn->group, pasn->freq, NULL, 0, NULL, 0,
NULL);
}
- if (ret)
+ if (ret) {
wpa_printf(MSG_INFO, "PR PASN: Failed to start PASN");
+ } else {
+ /* M1 sent successfully — notify that negotiation has started */
+ if (pr->cfg->negotiation_started)
+ pr->cfg->negotiation_started(pr->cfg->cb_ctx, addr,
+ ranging_role,
+ ranging_type);
+ }
out:
wpabuf_free(extra_ies);
@@ -2394,6 +2401,12 @@ static int pr_pasn_handle_auth_1(struct pr_data *pr, struct pr_device *dev,
pr->cfg->set_keys(pr->cfg->cb_ctx, pr->cfg->dev_addr,
dev->pr_device_addr, dev->pasn->cipher,
dev->pasn->akmp, &dev->pasn->ptk);
+
+ /* M1 received and M2 sent — notify that negotiation has started */
+ if (pr->cfg->negotiation_started)
+ pr->cfg->negotiation_started(pr->cfg->cb_ctx, mgmt->sa,
+ dev->ranging_role,
+ dev->protocol_type);
ret = 0;
fail:
@@ -468,6 +468,19 @@ struct pr_config {
int (*pasn_send_mgmt)(void *ctx, const u8 *data, size_t data_len,
int noack, unsigned int freq, unsigned int wait);
+ /**
+ * negotiation_started - Called when PASN negotiation begins
+ * @ctx: Callback context from cb_ctx
+ * @peer_addr: MAC address of the peer
+ * @role: Ranging role (initiator or responder)
+ * @protocol_type: Ranging protocol type
+ *
+ * Fired on the initiator after Auth frame 1 (M1) is sent, and on the
+ * responder after Auth frame 1 (M1) is received and M2 is sent back.
+ */
+ void (*negotiation_started)(void *ctx, const u8 *peer_addr, u8 role,
+ u8 protocol_type);
+
void (*pasn_result)(void *ctx, u8 role, u8 protocol_type, u8 op_class,
u8 op_channel, const char *country);
@@ -494,6 +494,11 @@ extern "C" {
/* PASN authentication status */
#define PASN_AUTH_STATUS "PASN-AUTH-STATUS "
+/* Proximity Ranging PASN negotiation started
+ * peer_addr=<MAC> role=<role> protocol=<protocol type>
+ */
+#define PR_PASN_NEGOTIATION_STARTED "PR-PASN-NEGOTIATION-STARTED "
+
/* Result of PASN performed for Proximity Ranging
* <result> role=<role> protocol=<protocol type> opclass=<op class> channel=<op channel> cc=<country>
*/
@@ -1539,6 +1539,16 @@ void wpas_notify_pr_pasn_result(struct wpa_supplicant *wpa_s, u8 role,
}
+void wpas_notify_pr_negotiation_started(struct wpa_supplicant *wpa_s,
+ const u8 *peer_addr, u8 role,
+ u8 protocol_type)
+{
+ wpa_msg_global(wpa_s, MSG_INFO, PR_PASN_NEGOTIATION_STARTED
+ "peer_addr=" MACSTR " role=%u protocol=%u",
+ MAC2STR(peer_addr), role, protocol_type);
+}
+
+
void wpas_notify_pr_ranging_params(struct wpa_supplicant *wpa_s,
const u8 *dev_addr, const u8 *peer_addr,
u8 ranging_role, u8 protocol_type, int freq,
@@ -209,6 +209,9 @@ void wpas_notify_nan_nik_received(struct wpa_supplicant *wpa_s,
void wpas_notify_pr_pasn_result(struct wpa_supplicant *wpa_s, u8 role,
u8 protocol_type, u8 op_class, u8 op_channel,
const char *country);
+void wpas_notify_pr_negotiation_started(struct wpa_supplicant *wpa_s,
+ const u8 *peer_addr, u8 role,
+ u8 protocol_type);
void wpas_notify_pr_ranging_params(struct wpa_supplicant *wpa_s,
const u8 *dev_addr, const u8 *peer_addr,
u8 role, u8 protocol, int freq, int channel,
@@ -271,6 +271,16 @@ static int wpas_pr_pasn_send_mgmt(void *ctx, const u8 *data, size_t data_len,
}
+static void wpas_pr_pasn_negotiation_started(void *ctx, const u8 *peer_addr,
+ u8 role, u8 protocol_type)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ wpas_notify_pr_negotiation_started(wpa_s, peer_addr, role,
+ protocol_type);
+}
+
+
static void wpas_pr_pasn_result(void *ctx, u8 role, u8 protocol_type,
u8 op_class, u8 op_channel, const char *country)
{
@@ -433,6 +443,7 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
pr.support_6ghz = capa->support_6ghz;
pr.pasn_send_mgmt = wpas_pr_pasn_send_mgmt;
+ pr.negotiation_started = wpas_pr_pasn_negotiation_started;
pr.pasn_result = wpas_pr_pasn_result;
pr.get_ranging_params = wpas_pr_ranging_params;
pr.set_keys = wpas_pr_pasn_set_keys;