mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
Replace wpa_supplicant_sta_rx() call with driver event
Get rid of wpa_supplicant_sta_rx() and add a new driver event that is marked to be used only with driver_test.c. In addition, remove this functionality from privsep wrapper. This is only use for client mode MLME testing with driver_test.c.
This commit is contained in:
parent
7d7d57b2dc
commit
245519e0cd
@ -70,7 +70,6 @@ enum privsep_event {
|
||||
PRIVSEP_EVENT_STKSTART,
|
||||
PRIVSEP_EVENT_FT_RESPONSE,
|
||||
PRIVSEP_EVENT_RX_EAPOL,
|
||||
PRIVSEP_EVENT_STA_RX,
|
||||
};
|
||||
|
||||
#endif /* PRIVSEP_COMMANDS_H */
|
||||
|
@ -404,12 +404,6 @@ struct wpa_driver_capa {
|
||||
};
|
||||
|
||||
|
||||
struct ieee80211_rx_status {
|
||||
int channel;
|
||||
int ssi;
|
||||
};
|
||||
|
||||
|
||||
struct hostapd_data;
|
||||
|
||||
struct hostap_sta_driver_data {
|
||||
@ -1724,7 +1718,14 @@ typedef enum wpa_event_type {
|
||||
/**
|
||||
* EVENT_RX_MGMT - Report RX of a management frame
|
||||
*/
|
||||
EVENT_RX_MGMT
|
||||
EVENT_RX_MGMT,
|
||||
|
||||
/**
|
||||
* EVENT_MLME_RX - Report reception of frame for MLME (test use only)
|
||||
*
|
||||
* This event is used only by driver_test.c and userspace MLME.
|
||||
*/
|
||||
EVENT_MLME_RX
|
||||
} wpa_event_type;
|
||||
|
||||
|
||||
@ -1966,6 +1967,17 @@ union wpa_event_data {
|
||||
struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
|
||||
size_t num_ssids;
|
||||
} scan_info;
|
||||
|
||||
/**
|
||||
* struct mlme_rx - Data for EVENT_MLME_RX events
|
||||
*/
|
||||
struct mlme_rx {
|
||||
const u8 *buf;
|
||||
size_t len;
|
||||
int freq;
|
||||
int channel;
|
||||
int ssi;
|
||||
} mlme_rx;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1998,9 +2010,6 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
|
||||
void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
|
||||
const u8 *buf, size_t len);
|
||||
|
||||
void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
|
||||
struct ieee80211_rx_status *rx_status);
|
||||
|
||||
const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
|
||||
const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
|
||||
u32 vendor_type);
|
||||
|
@ -438,22 +438,6 @@ static void wpa_driver_privsep_event_rx_eapol(void *ctx, u8 *buf, size_t len)
|
||||
}
|
||||
|
||||
|
||||
static void wpa_driver_privsep_event_sta_rx(void *ctx, u8 *buf, size_t len)
|
||||
{
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
struct ieee80211_rx_status *rx_status;
|
||||
|
||||
if (len < sizeof(*rx_status))
|
||||
return;
|
||||
rx_status = (struct ieee80211_rx_status *) buf;
|
||||
buf += sizeof(*rx_status);
|
||||
len -= sizeof(*rx_status);
|
||||
|
||||
wpa_supplicant_sta_rx(ctx, buf, len, rx_status);
|
||||
#endif /* CONFIG_CLIENT_MLME */
|
||||
}
|
||||
|
||||
|
||||
static void wpa_driver_privsep_receive(int sock, void *eloop_ctx,
|
||||
void *sock_ctx)
|
||||
{
|
||||
@ -530,10 +514,6 @@ static void wpa_driver_privsep_receive(int sock, void *eloop_ctx,
|
||||
wpa_driver_privsep_event_rx_eapol(drv->ctx, event_buf,
|
||||
event_len);
|
||||
break;
|
||||
case PRIVSEP_EVENT_STA_RX:
|
||||
wpa_driver_privsep_event_sta_rx(drv->ctx, event_buf,
|
||||
event_len);
|
||||
break;
|
||||
}
|
||||
|
||||
os_free(buf);
|
||||
|
@ -1790,11 +1790,11 @@ static void wpa_driver_test_mlme(struct wpa_driver_test_data *drv,
|
||||
socklen_t fromlen,
|
||||
const u8 *data, size_t data_len)
|
||||
{
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
struct ieee80211_rx_status rx_status;
|
||||
os_memset(&rx_status, 0, sizeof(rx_status));
|
||||
wpa_supplicant_sta_rx(drv->ctx, data, data_len, &rx_status);
|
||||
#endif /* CONFIG_CLIENT_MLME */
|
||||
union wpa_event_data event;
|
||||
os_memset(&event, 0, sizeof(event));
|
||||
event.mlme_rx.buf = data;
|
||||
event.mlme_rx.len = data_len;
|
||||
wpa_supplicant_event(drv->ctx, EVENT_MLME_RX, &event);
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "bgscan.h"
|
||||
#include "ap.h"
|
||||
#include "bss.h"
|
||||
#include "mlme.h"
|
||||
|
||||
|
||||
static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
|
||||
@ -1503,6 +1504,19 @@ void wpa_supplicant_event(void *ctx, wpa_event_type event,
|
||||
data->rx_mgmt.frame_len, data->rx_mgmt.fi);
|
||||
break;
|
||||
#endif /* CONFIG_AP */
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
case EVENT_MLME_RX: {
|
||||
struct ieee80211_rx_status rx_status;
|
||||
os_memset(&rx_status, 0, sizeof(rx_status));
|
||||
rx_status.freq = data->mlme_rx.freq;
|
||||
rx_status.channel = data->mlme_rx.channel;
|
||||
rx_status.ssi = data->mlme_rx.ssi;
|
||||
ieee80211_sta_rx(wpa_s, data->mlme_rx.buf, data->mlme_rx.len,
|
||||
&rx_status);
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_CLIENT_MLME */
|
||||
|
||||
default:
|
||||
wpa_printf(MSG_INFO, "Unknown event %d", event);
|
||||
break;
|
||||
|
@ -19,6 +19,12 @@
|
||||
|
||||
struct wpa_supplicant;
|
||||
|
||||
struct ieee80211_rx_status {
|
||||
int freq;
|
||||
int channel;
|
||||
int ssi;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
|
||||
int ieee80211_sta_init(struct wpa_supplicant *wpa_s);
|
||||
|
@ -915,35 +915,6 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
|
||||
struct ieee80211_rx_status *rx_status)
|
||||
{
|
||||
struct wpa_priv_interface *iface = ctx;
|
||||
struct msghdr msg;
|
||||
struct iovec io[3];
|
||||
int event = PRIVSEP_EVENT_STA_RX;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "STA RX from driver");
|
||||
io[0].iov_base = &event;
|
||||
io[0].iov_len = sizeof(event);
|
||||
io[1].iov_base = (u8 *) rx_status;
|
||||
io[1].iov_len = sizeof(*rx_status);
|
||||
io[2].iov_base = (u8 *) buf;
|
||||
io[2].iov_len = len;
|
||||
|
||||
os_memset(&msg, 0, sizeof(msg));
|
||||
msg.msg_iov = io;
|
||||
msg.msg_iovlen = 3;
|
||||
msg.msg_name = &iface->drv_addr;
|
||||
msg.msg_namelen = sizeof(iface->drv_addr);
|
||||
|
||||
if (sendmsg(iface->fd, &msg, 0) < 0)
|
||||
perror("sendmsg(wpas_socket)");
|
||||
}
|
||||
#endif /* CONFIG_CLIENT_MLME */
|
||||
|
||||
|
||||
static void wpa_priv_terminate(int sig, void *eloop_ctx, void *signal_ctx)
|
||||
{
|
||||
wpa_printf(MSG_DEBUG, "wpa_priv termination requested");
|
||||
|
@ -1819,14 +1819,6 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
|
||||
}
|
||||
|
||||
|
||||
void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
|
||||
struct ieee80211_rx_status *rx_status)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
ieee80211_sta_rx(wpa_s, buf, len, rx_status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpa_supplicant_driver_init - Initialize driver interface parameters
|
||||
* @wpa_s: Pointer to wpa_supplicant data
|
||||
|
Loading…
Reference in New Issue
Block a user