From 665a3007fb2a5bb022b0a0fafc8e4a5383c6525c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 3 Jan 2020 13:48:33 +0200 Subject: [PATCH] driver: Add no_encrypt argument to send_mlme() This is in preparation of being able to remove the separate send_frame() callback. Signed-off-by: Jouni Malinen --- src/ap/ap_drv_ops.c | 2 +- src/drivers/driver.h | 4 +++- src/drivers/driver_atheros.c | 3 ++- src/drivers/driver_hostap.c | 11 ++++++----- src/drivers/driver_nl80211.c | 3 ++- wpa_supplicant/driver_i.h | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index ec1d970ea..35ecf4102 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -700,7 +700,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); + csa_offs, csa_offs_len, no_encrypt); } diff --git a/src/drivers/driver.h b/src/drivers/driver.h index ce64f341c..d793cc8fe 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2609,11 +2609,13 @@ struct wpa_driver_ops { * driver decide * @csa_offs: Array of CSA offsets or %NULL * @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) * 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); + size_t csa_offs_len, int no_encrypt); /** * update_ft_ies - Update FT (IEEE 802.11r) IEs diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c index eac3ae8af..de25e4e4e 100644 --- a/src/drivers/driver_atheros.c +++ b/src/drivers/driver_atheros.c @@ -1960,7 +1960,8 @@ 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) + const u16 *csa_offs, size_t csa_offs_len, + int no_encrypt) { struct atheros_driver_data *drv = priv; u8 buf[1510]; diff --git a/src/drivers/driver_hostap.c b/src/drivers/driver_hostap.c index 186eccbf2..dbe7fafc8 100644 --- a/src/drivers/driver_hostap.c +++ b/src/drivers/driver_hostap.c @@ -263,7 +263,8 @@ 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) + const u16 *csa_offs, size_t csa_offs_len, + int no_encrypt) { struct hostap_driver_data *drv = priv; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) msg; @@ -312,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); + res = hostap_send_mlme(drv, (u8 *) hdr, len, 0, 0, NULL, 0, 0); if (res < 0) { wpa_printf(MSG_ERROR, "hostap_send_eapol - packet len: %lu - " "failed: %d (%s)", @@ -1051,7 +1052,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); + sizeof(mgmt.u.deauth), 0, 0, NULL, 0, 0); } @@ -1089,7 +1090,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); + sizeof(mgmt.u.disassoc), 0, 0, NULL, 0, 0); } @@ -1169,7 +1170,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); + hostap_send_mlme(priv, (u8 *) &hdr, sizeof(hdr), 0, 0, NULL, 0, 0); } diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 87656147b..0809e4d9a 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -8751,7 +8751,8 @@ static int driver_nl80211_if_remove(void *priv, enum wpa_driver_if_type type, 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) + const u16 *csa_offs, size_t csa_offs_len, + int no_encrypt) { struct i802_bss *bss = priv; return wpa_driver_nl80211_send_mlme(bss, data, data_len, noack, diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 8743d5668..f8d63a07b 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -304,7 +304,7 @@ static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s, if (wpa_s->driver->send_mlme) return wpa_s->driver->send_mlme(wpa_s->drv_priv, data, data_len, noack, - freq, NULL, 0); + freq, NULL, 0, 0); return -1; }