Add call backs and changes to notify Proximity Ranging negotiation result done as part of PASN. Signed-off-by: Peddolla Harshavardhan Reddy <peddolla@xxxxxxxxxxxxxxxx> --- src/common/proximity_ranging.c | 9 +++++++++ src/common/proximity_ranging.h | 2 ++ src/common/wpa_ctrl.h | 5 +++++ wpa_supplicant/notify.c | 10 ++++++++++ wpa_supplicant/notify.h | 4 +++- wpa_supplicant/pr_supplicant.c | 11 +++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c index 63bfa4f40..6fd8e7003 100644 --- a/src/common/proximity_ranging.c +++ b/src/common/proximity_ranging.c @@ -1944,6 +1944,10 @@ int pr_pasn_auth_tx_status(struct pr_data *pr, const u8 *data, size_t data_len, return pasn->send_mgmt(pasn->cb_ctx, wpabuf_head(pasn->frame), wpabuf_len(pasn->frame), 0, pasn->freq, 1000); + if (ret == 1 && acked && pr->cfg->pasn_result) + pr->cfg->pasn_result(pr->cfg->cb_ctx, dev->ranging_role, + dev->protocol_type, dev->final_op_class, + dev->final_op_channel, pr->cfg->country); wpabuf_free(pasn->frame); pasn->frame = NULL; @@ -2348,6 +2352,11 @@ static int pr_pasn_handle_auth_3(struct pr_data *pr, struct pr_device *dev, wpa_printf(MSG_ERROR, "PR PASN: Handle Auth3 failed"); goto fail; } + + if (pr->cfg->pasn_result) + pr->cfg->pasn_result(pr->cfg->cb_ctx, dev->ranging_role, + dev->protocol_type, dev->final_op_class, + dev->final_op_channel, pr->cfg->country); return 0; fail: diff --git a/src/common/proximity_ranging.h b/src/common/proximity_ranging.h index 3953a46cc..e6943355f 100644 --- a/src/common/proximity_ranging.h +++ b/src/common/proximity_ranging.h @@ -386,6 +386,8 @@ struct pr_config { int (*pasn_send_mgmt)(void *ctx, const u8 *data, size_t data_len, int noack, unsigned int freq, unsigned int wait); + void (*pasn_result)(void *ctx, u8 role, u8 protocol_type, u8 op_class, + u8 op_channel, const char *country); void (*set_keys)(void *ctx, const u8 *own_addr, const u8 *peer_addr, int cipher, int akmp, struct wpa_ptk *ptk); diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index ae5711aa6..63e2c176a 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -471,6 +471,11 @@ extern "C" { /* PASN authentication status */ #define PASN_AUTH_STATUS "PASN-AUTH-STATUS " +/* Result of PASN performed for Proximity Ranging + * <role> <protocol type> <op class> <op channel> + */ +#define PR_PASN_RESULT "PR-PASN-RESULT " + /* BSS command information masks */ #define WPA_BSS_MASK_ALL 0xFFFDFFFF diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index fd8783d25..bac25c111 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -1208,3 +1208,13 @@ void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_NAN_USD */ + + +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) +{ + wpa_msg_global(wpa_s, MSG_INFO, PR_PASN_RESULT + "SUCCESS role=%u, protocol=%u, opclass=%u, channel=%u, cc=%s", + role, protocol_type, op_class, op_channel, country); +} diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index 9e5047c81..ea27875f5 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -204,5 +204,7 @@ void wpas_notify_nan_publish_terminated(struct wpa_supplicant *wpa_s, void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s, int subscribe_id, enum nan_de_reason reason); - +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); #endif /* NOTIFY_H */ diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c index 491ca39d6..9385215b5 100644 --- a/wpa_supplicant/pr_supplicant.c +++ b/wpa_supplicant/pr_supplicant.c @@ -85,6 +85,16 @@ static int wpas_pr_pasn_send_mgmt(void *ctx, const u8 *data, size_t data_len, } +static void wpas_pr_pasn_result(void *ctx, u8 role, u8 protocol_type, + u8 op_class, u8 op_channel, const char *country) +{ + struct wpa_supplicant *wpa_s = ctx; + + wpas_notify_pr_pasn_result(wpa_s, role, protocol_type, op_class, + op_channel, country); +} + + static void wpas_pr_pasn_set_keys(void *ctx, const u8 *own_addr, const u8 *peer_addr, int cipher, int akmp, struct wpa_ptk *ptk) @@ -172,6 +182,7 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) pr.support_6ghz = wpas_is_6ghz_supported(wpa_s, true); pr.pasn_send_mgmt = wpas_pr_pasn_send_mgmt; + pr.pasn_result = wpas_pr_pasn_result; pr.set_keys = wpas_pr_pasn_set_keys; pr.clear_keys = wpas_pr_pasn_clear_keys; -- 2.34.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap