PRIVSEP_EVENT_STKSTART,
PRIVSEP_EVENT_FT_RESPONSE,
PRIVSEP_EVENT_RX_EAPOL,
- PRIVSEP_EVENT_STA_RX,
};
#endif /* PRIVSEP_COMMANDS_H */
};
-struct ieee80211_rx_status {
- int channel;
- int ssi;
-};
-
-
struct hostapd_data;
struct hostap_sta_driver_data {
/**
* 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;
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;
};
/**
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);
}
-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)
{
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);
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);
}
#include "bgscan.h"
#include "ap.h"
#include "bss.h"
+#include "mlme.h"
static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
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;
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);
}
-#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");
}
-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