[PATCH 1/4] driver: add rsn pre-auth rx event

Markus Theil <[email protected]>
Newsgroups gmane.linux.drivers.hostap
Message-ID <[email protected]>
This patch adds an event for receiving pre-auth frames directly from
drivers. Source and destination MACs are included in the corresponding
struct to allow for forwarding of pre-auth frames in AP mode.

Signed-off-by: Markus Theil <[email protected]>
---
 src/drivers/driver.h        | 31 +++++++++++++++++++++++++++++++
 src/drivers/driver_common.c |  1 +
 2 files changed, 32 insertions(+)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 9bdf88011..65dc5de97 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -4636,6 +4636,14 @@ enum wpa_event_type {
 	 */
 	EVENT_EAPOL_RX,
 
+	/**
+	 * EVENT_RSN_PREAUTH_RX - Report received RSN Pre-auth frame
+	 *
+	 * When in AP mode with hostapd, this event is required to be used to
+	 * deliver the receive RSN Pre-auth frames from the driver.
+	 */
+	EVENT_RSN_PREAUTH_RX,
+
 	/**
 	 * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
 	 *
@@ -5531,6 +5539,16 @@ union wpa_event_data {
 		size_t data_len;
 	} eapol_rx;
 
+	/**
+	 * struct rsn_preauth_rx - Data for EVENT_RSN_PREAUTH_RX events
+	 */
+	struct rsn_preauth_rx {
+		const u8 *src;
+		const u8 *dst;
+		const u8 *data;
+		size_t data_len;
+	} rsn_preauth_rx;
+
 	/**
 	 * signal_change - Data for EVENT_SIGNAL_CHANGE events
 	 */
@@ -5854,6 +5872,19 @@ static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
 	wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
 }
 
+static inline void drv_event_rsn_preauth_rx(void *ctx, const u8 *src,
+					    const u8 *dst, const u8 *data,
+					    size_t data_len)
+{
+	union wpa_event_data event;
+	os_memset(&event, 0, sizeof(event));
+	event.rsn_preauth_rx.src = src;
+	event.rsn_preauth_rx.dst = dst;
+	event.rsn_preauth_rx.data = data;
+	event.rsn_preauth_rx.data_len = data_len;
+	wpa_supplicant_event(ctx, EVENT_RSN_PREAUTH_RX, &event);
+}
+
 /* driver_common.c */
 void wpa_scan_results_free(struct wpa_scan_results *res);
 
diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c
index 731c6a3b1..d6cb4cf74 100644
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -52,6 +52,7 @@ const char * event_to_string(enum wpa_event_type event)
 	E2S(RX_PROBE_REQ);
 	E2S(NEW_STA);
 	E2S(EAPOL_RX);
+	E2S(RSN_PREAUTH_RX);
 	E2S(SIGNAL_CHANGE);
 	E2S(INTERFACE_ENABLED);
 	E2S(INTERFACE_DISABLED);
-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.