]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PASN: Function handler to transmit Authentication frames
authorVinay Gannevaram <quic_vganneva@quicinc.com>
Sat, 29 Oct 2022 13:01:29 +0000 (18:31 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 3 Nov 2022 22:41:59 +0000 (00:41 +0200)
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 <quic_jouni@quicinc.com>
wpa_supplicant/pasn_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 4c5b66aca9c119e82f64e38d5e3ca8aedec6fc25..93b57a8f0aaff93a3c954447e786f69f03d10fe0 100644 (file)
@@ -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");
index f149368dae9d0d1f16fc95cae6c7d25d68a278ce..294097033821e71073368a96a1234e953e113cac 100644 (file)
@@ -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 */