@@ -58,8 +58,8 @@ static int rsn_preauth_key_mgmt(int akmp)
}
-static void rsn_preauth_receive(void *ctx, const u8 *src_addr,
- const u8 *buf, size_t len)
+void rsn_preauth_receive(void *ctx, const u8 *src_addr,
+ const u8 *buf, size_t len)
{
struct wpa_sm *sm = ctx;
@@ -14,6 +14,8 @@ struct wpa_scan_results;
#if defined(IEEE8021X_EAPOL) && !defined(CONFIG_NO_WPA)
void pmksa_candidate_free(struct wpa_sm *sm);
+void rsn_preauth_receive(void *ctx, const u8 *src_addr,
+ const u8 *buf, size_t len);
int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst,
struct eap_peer_config *eap_conf);
void rsn_preauth_deinit(struct wpa_sm *sm);
@@ -33,6 +35,11 @@ static inline void pmksa_candidate_free(struct wpa_sm *sm)
{
}
+static inline void rsn_preauth_receive(void *ctx, const u8 *src_addr,
+ const u8 *buf, size_t len)
+{
+}
+
static inline void rsn_preauth_candidate_process(struct wpa_sm *sm)
{
}
@@ -4872,6 +4872,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
data->eapol_rx.data,
data->eapol_rx.data_len);
break;
+ case EVENT_RSN_PREAUTH_RX:
+ wpa_supplicant_rx_rsn_preauth(wpa_s, data->rsn_preauth_rx.src,
+ data->rsn_preauth_rx.data,
+ data->rsn_preauth_rx.data_len);
+ break;
case EVENT_SIGNAL_CHANGE:
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SIGNAL_CHANGE
"above=%d signal=%d noise=%d txrate=%d",
@@ -4657,6 +4657,34 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
}
}
+/**
+ * wpa_supplicant_rx_rsn_preauth - Deliver a received PREAUTH frame to
+ * wpa_supplicant
+ * @ctx: Context pointer (wpa_s); this is the ctx variable registered
+ * with struct wpa_driver_ops::init()
+ * @src_addr: Source address of the PREAUTH frame
+ * @buf: EAPOL data starting from the PREAUTH header (i.e., no Ethernet header)
+ * @len: Length of the PREAUTH data
+ *
+ * This function is called for each received PREAUTH frame. Most driver
+ * interfaces rely on more generic OS mechanism for receiving frames through
+ * l2_packet, but if such a mechanism is not available, the driver wrapper may
+ * take care of received PREAUTH frames and deliver them to the core supplicant
+ * code by calling this function.
+ */
+void wpa_supplicant_rx_rsn_preauth(void *ctx, const u8 *src_addr,
+ const u8 *buf, size_t len)
+{
+ struct wpa_supplicant *wpa_s = ctx;
+
+ wpa_dbg(wpa_s, MSG_DEBUG, "RX RSN PREAUTH from " MACSTR, MAC2STR(src_addr));
+ wpa_hexdump(MSG_MSGDUMP, "RX RSN PREAUTH", buf, len);
+
+ if (wpa_s->wpa) {
+ rsn_preauth_receive(wpa_s->wpa, src_addr, buf, len);
+ }
+}
+
int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
{
@@ -1372,6 +1372,8 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
void wpa_supplicant_terminate_proc(struct wpa_global *global);
void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
const u8 *buf, size_t len);
+void wpa_supplicant_rx_rsn_preauth(void *ctx, const u8 *src_addr,
+ const u8 *buf, size_t len);
void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);
This patch enables wpa_supplicant to receive pre-auth frames over nl80211. Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de> --- src/rsn_supp/preauth.c | 4 ++-- src/rsn_supp/preauth.h | 7 +++++++ wpa_supplicant/events.c | 5 +++++ wpa_supplicant/wpa_supplicant.c | 28 ++++++++++++++++++++++++++++ wpa_supplicant/wpa_supplicant_i.h | 2 ++ 5 files changed, 44 insertions(+), 2 deletions(-)