From af5eec3b3731103a304647bc871db0249a11a065 Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Sat, 29 Oct 2022 18:31:29 +0530 Subject: [PATCH] PASN: Function handler to transmit Authentication frames Introduce a function handler to transmit PASN Authentication frames to the driver. This removes the wpa_s dependency from PASN functionality for sending the frames. Signed-off-by: Jouni Malinen --- wpa_supplicant/pasn_supplicant.c | 22 ++++++++++++++++------ wpa_supplicant/wpa_supplicant_i.h | 12 ++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/pasn_supplicant.c b/wpa_supplicant/pasn_supplicant.c index 4c5b66aca..93b57a8f0 100644 --- a/wpa_supplicant/pasn_supplicant.c +++ b/wpa_supplicant/pasn_supplicant.c @@ -39,6 +39,15 @@ struct wpa_pasn_auth_work { }; +static int wpas_pasn_send_mlme(void *ctx, const u8 *data, size_t data_len, + int noack, unsigned int freq, unsigned int wait) +{ + struct wpa_supplicant *wpa_s = ctx; + + return wpa_drv_send_mlme(wpa_s, data, data_len, noack, freq, wait); +} + + static void wpas_pasn_free_auth_work(struct wpa_pasn_auth_work *awork) { wpabuf_free(awork->comeback); @@ -1333,9 +1342,9 @@ static int wpas_pasn_start(struct wpas_pasn *pasn, const u8 *own_addr, goto fail; } - ret = wpa_drv_send_mlme(pasn->cb_ctx, - wpabuf_head(frame), wpabuf_len(frame), 0, - pasn->freq, 1000); + ret = pasn->send_mgmt(pasn->cb_ctx, + wpabuf_head(frame), wpabuf_len(frame), 0, + pasn->freq, 1000); wpabuf_free(frame); if (ret) { @@ -1471,6 +1480,7 @@ static void wpas_pasn_auth_start_cb(struct wpa_radio_work *work, int deinit) if (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_PROT_RANGE_NEG_STA) capab |= BIT(WLAN_RSNX_CAPAB_PROT_RANGE_NEG); pasn->rsnxe_capab = capab; + pasn->send_mgmt = wpas_pasn_send_mlme; ssid = wpa_config_get_network(wpa_s->conf, awork->network_id); @@ -1913,9 +1923,9 @@ static int wpa_pasn_auth_rx(struct wpas_pasn *pasn, const u8 *data, size_t len, goto fail; } - ret = wpa_drv_send_mlme(pasn->cb_ctx, - wpabuf_head(frame), wpabuf_len(frame), 0, - pasn->freq, 100); + ret = pasn->send_mgmt(pasn->cb_ctx, + wpabuf_head(frame), wpabuf_len(frame), 0, + pasn->freq, 100); wpabuf_free(frame); if (ret) { wpa_printf(MSG_DEBUG, "PASN: Failed sending 3st auth frame"); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index f149368da..294097033 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -600,6 +600,18 @@ struct wpas_pasn { void *cb_ctx; u16 rsnxe_capab; int network_id; + + /** + * send_mgmt - Function handler to transmit a Management frame + * @ctx: Callback context from cb_ctx + * @frame_buf : Frame to transmit + * @frame_len: Length of frame to transmit + * @freq: Frequency in MHz for the channel on which to transmit + * @wait_dur: How many milliseconds to wait for a response frame + * Returns: 0 on success, -1 on failure + */ + int (*send_mgmt)(void *ctx, const u8 *data, size_t data_len, int noack, + unsigned int freq, unsigned int wait); }; #endif /* CONFIG_PASN */