]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
driver: Extend send_mlme() with wait option
authorIlan Peer <ilan.peer@intel.com>
Mon, 24 Feb 2020 09:14:27 +0000 (11:14 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 29 Feb 2020 21:03:20 +0000 (23:03 +0200)
PASN authentication can be performed while a station interface is
connected to an AP. To allow sending PASN frames while connected, extend
the send_mlme() driver callback to also allow a wait option. Update the
relevant drivers and wpa_supplicant accordingly.

hostapd calls for send_mlme() are left unchanged, since the wait option
is not required there.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
src/ap/ap_drv_ops.c
src/drivers/driver.h
src/drivers/driver_atheros.c
src/drivers/driver_hostap.c
src/drivers/driver_nl80211.c
wpa_supplicant/driver_i.h
wpa_supplicant/ibss_rsn.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/sme.c

index c217d9b245e746ae51964dc92c866a0c3b748e53..0f5e829ffb7200b2a281713f1c80c7ae8e45c4c6 100644 (file)
@@ -714,7 +714,7 @@ int hostapd_drv_send_mlme(struct hostapd_data *hapd,
        if (!hapd->driver || !hapd->driver->send_mlme || !hapd->drv_priv)
                return 0;
        return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
-                                      csa_offs, csa_offs_len, no_encrypt);
+                                      csa_offs, csa_offs_len, no_encrypt, 0);
 }
 
 
index cd1ec31a13bf16865f7ac83348bd989d789a0677..bb187b8bf0e7a01884eaafa586aa390b4d1b68e2 100644 (file)
@@ -2715,11 +2715,13 @@ struct wpa_driver_ops {
         * @csa_offs_len: Number of elements in csa_offs
         * @no_encrypt: Do not encrypt frame even if appropriate key exists
         *      (used only for testing purposes)
+        * @wait: Time to wait off-channel for a response (in ms), or zero
         * Returns: 0 on success, -1 on failure
         */
        int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
                         int noack, unsigned int freq, const u16 *csa_offs,
-                        size_t csa_offs_len, int no_encrypt);
+                        size_t csa_offs_len, int no_encrypt,
+                        unsigned int wait);
 
        /**
         * update_ft_ies - Update FT (IEEE 802.11r) IEs
index 2014f9db422e674d494be6e20fc4f914cf204834..d630c3dc43d484e69dc8511ef466a68cf23f11e1 100644 (file)
@@ -1965,7 +1965,7 @@ static int atheros_set_ap(void *priv, struct wpa_driver_ap_params *params)
 static int atheros_send_mgmt(void *priv, const u8 *frm, size_t data_len,
                             int noack, unsigned int freq,
                             const u16 *csa_offs, size_t csa_offs_len,
-                            int no_encrypt)
+                            int no_encrypt, unsigned int wait)
 {
        struct atheros_driver_data *drv = priv;
        u8 buf[1510];
index cfc52c7f3aa1733e3e87832fde80b573cc881c18..b9c42e4db48da734333d0e0b9943ffd87edc5f4f 100644 (file)
@@ -264,7 +264,7 @@ static int hostap_init_sockets(struct hostap_driver_data *drv, u8 *own_addr)
 static int hostap_send_mlme(void *priv, const u8 *msg, size_t len, int noack,
                            unsigned int freq,
                            const u16 *csa_offs, size_t csa_offs_len,
-                           int no_encrypt)
+                           int no_encrypt, unsigned int wait)
 {
        struct hostap_driver_data *drv = priv;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) msg;
@@ -313,7 +313,7 @@ static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data,
        pos += 2;
        memcpy(pos, data, data_len);
 
-       res = hostap_send_mlme(drv, (u8 *) hdr, len, 0, 0, NULL, 0, 0);
+       res = hostap_send_mlme(drv, (u8 *) hdr, len, 0, 0, NULL, 0, 0, 0);
        if (res < 0) {
                wpa_printf(MSG_ERROR, "hostap_send_eapol - packet len: %lu - "
                           "failed: %d (%s)",
@@ -1055,7 +1055,7 @@ static int hostap_sta_deauth(void *priv, const u8 *own_addr, const u8 *addr,
        memcpy(mgmt.bssid, own_addr, ETH_ALEN);
        mgmt.u.deauth.reason_code = host_to_le16(reason);
        return hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
-                               sizeof(mgmt.u.deauth), 0, 0, NULL, 0, 0);
+                               sizeof(mgmt.u.deauth), 0, 0, NULL, 0, 0, 0);
 }
 
 
@@ -1093,7 +1093,7 @@ static int hostap_sta_disassoc(void *priv, const u8 *own_addr, const u8 *addr,
        memcpy(mgmt.bssid, own_addr, ETH_ALEN);
        mgmt.u.disassoc.reason_code = host_to_le16(reason);
        return  hostap_send_mlme(drv, (u8 *) &mgmt, IEEE80211_HDRLEN +
-                                sizeof(mgmt.u.disassoc), 0, 0, NULL, 0, 0);
+                                sizeof(mgmt.u.disassoc), 0, 0, NULL, 0, 0, 0);
 }
 
 
@@ -1173,7 +1173,7 @@ static void wpa_driver_hostap_poll_client(void *priv, const u8 *own_addr,
        os_memcpy(hdr.IEEE80211_BSSID_FROMDS, own_addr, ETH_ALEN);
        os_memcpy(hdr.IEEE80211_SA_FROMDS, own_addr, ETH_ALEN);
 
-       hostap_send_mlme(priv, (u8 *) &hdr, sizeof(hdr), 0, 0, NULL, 0, 0);
+       hostap_send_mlme(priv, (u8 *)&hdr, sizeof(hdr), 0, 0, NULL, 0, 0, 0);
 }
 
 
index c29142f0f8b7bb782479118fa95dd89559f6e673..ecedc40f5cad0c2706be7ef52a3fb50d37ef0add 100644 (file)
@@ -8846,11 +8846,11 @@ static int driver_nl80211_send_mlme(void *priv, const u8 *data,
                                    size_t data_len, int noack,
                                    unsigned int freq,
                                    const u16 *csa_offs, size_t csa_offs_len,
-                                   int no_encrypt)
+                                   int no_encrypt, unsigned int wait)
 {
        struct i802_bss *bss = priv;
        return wpa_driver_nl80211_send_mlme(bss, data, data_len, noack,
-                                           freq, 0, 0, 0, csa_offs,
+                                           freq, 0, 0, wait, csa_offs,
                                            csa_offs_len, no_encrypt);
 }
 
index 45b62bdea28589e2dc4518ce3a1c0b5a2a4bb719..d3fb5870794cdb25e9d4f1e6aff5b77571952f63 100644 (file)
@@ -312,12 +312,12 @@ static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
 
 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
                                    const u8 *data, size_t data_len, int noack,
-                                   unsigned int freq)
+                                   unsigned int freq, unsigned int wait)
 {
        if (wpa_s->driver->send_mlme)
                return wpa_s->driver->send_mlme(wpa_s->drv_priv,
                                                data, data_len, noack,
-                                               freq, NULL, 0, 0);
+                                               freq, NULL, 0, 0, wait);
        return -1;
 }
 
index ea909a91c80fec8de87d110982de502df8eb2f57..02e63904c5d73593da10f5aeec4d88586302a09c 100644 (file)
@@ -520,7 +520,7 @@ static int ibss_rsn_send_auth(struct ibss_rsn *ibss_rsn, const u8 *da, int seq)
        wpa_printf(MSG_DEBUG, "RSN: IBSS TX Auth frame (SEQ %d) to " MACSTR,
                   seq, MAC2STR(da));
 
-       return wpa_drv_send_mlme(wpa_s, (u8 *) &auth, auth_length, 0, 0);
+       return wpa_drv_send_mlme(wpa_s, (u8 *) &auth, auth_length, 0, 0, 0);
 }
 
 
index 41d50f39796dd6d2183e71052336d312a83b4a25..e86c082b3644ceb93950e7bc87080833af67bb8d 100644 (file)
@@ -2691,7 +2691,7 @@ static int wpas_send_probe_resp(void *ctx, const struct wpabuf *buf,
 {
        struct wpa_supplicant *wpa_s = ctx;
        return wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1,
-                                freq);
+                                freq, 0);
 }
 
 
index c320c249b11f156302d90d28e1676b82e903d64f..d0088f9f4339334e022526a2d7378f44e20657c2 100644 (file)
@@ -1021,7 +1021,7 @@ static int sme_external_auth_send_sae_commit(struct wpa_supplicant *wpa_s,
                                    bssid, 1, wpa_s->sme.seq_num,
                                    use_pt ? WLAN_STATUS_SAE_HASH_TO_ELEMENT :
                                    WLAN_STATUS_SUCCESS);
-       wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0);
+       wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0, 0);
        wpabuf_free(resp);
        wpabuf_free(buf);
 
@@ -1091,7 +1091,7 @@ static void sme_external_auth_send_sae_confirm(struct wpa_supplicant *wpa_s,
        sme_external_auth_build_buf(buf, resp, wpa_s->own_addr,
                                    da, 2, wpa_s->sme.seq_num,
                                    WLAN_STATUS_SUCCESS);
-       wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0);
+       wpa_drv_send_mlme(wpa_s, wpabuf_head(buf), wpabuf_len(buf), 1, 0, 0);
        wpabuf_free(resp);
        wpabuf_free(buf);
 }