[PATCH 2/4] nl80211: differentiate between ETH_P_PAE and ETH_P_RSN_PREAUTH for control port rx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nl80211 control port event handling currently does not differentiate
between EAPOL and PREAUTH frames. This patch add this and is later used
to receive PREAUTH frames in hostapd and wpa_supplicant over nl80211.

Signed-off-by: Markus Theil <markus.theil@xxxxxxxxxxxxx>
---
 src/drivers/driver_nl80211_event.c | 38 ++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 7 deletions(-)

diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index 8327644fb..625030adb 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -2451,12 +2451,36 @@ static void nl80211_sta_opmode_change_event(struct wpa_driver_nl80211_data *drv,
 static void nl80211_control_port_frame(struct wpa_driver_nl80211_data *drv,
 				       struct nlattr **tb)
 {
-	if (!tb[NL80211_ATTR_MAC] || !tb[NL80211_ATTR_FRAME])
+	const u8 *src_addr = NULL;
+	const u8 *dst_addr = NULL;
+
+	if (!tb[NL80211_ATTR_MAC] ||
+	    !tb[NL80211_ATTR_FRAME] ||
+	    !tb[NL80211_ATTR_CONTROL_PORT_ETHERTYPE])
 		return;
 
-	drv_event_eapol_rx(drv->ctx, nla_data(tb[NL80211_ATTR_MAC]),
-			   nla_data(tb[NL80211_ATTR_FRAME]),
-			   nla_len(tb[NL80211_ATTR_FRAME]));
+	src_addr = nla_data(tb[NL80211_ATTR_MAC]);
+
+	switch(nla_get_u16(tb[NL80211_ATTR_CONTROL_PORT_ETHERTYPE])) {
+	case ETH_P_RSN_PREAUTH:
+		/* TODO: re-enable when upstream in kernel */
+		/*
+		if (tb[NL80211_ATTR_DST_MAC])
+			dst_addr = nla_data(tb[NL80211_ATTR_DST_MAC]);
+		*/
+
+		drv_event_rsn_preauth_rx(drv->ctx,
+					 src_addr,
+					 dst_addr,
+					 nla_data(tb[NL80211_ATTR_FRAME]),
+					 nla_len(tb[NL80211_ATTR_FRAME]));
+		break;
+	case ETH_P_PAE:
+		drv_event_eapol_rx(drv->ctx, src_addr,
+				   nla_data(tb[NL80211_ATTR_FRAME]),
+				   nla_len(tb[NL80211_ATTR_FRAME]));
+		break;
+	}
 }
 
 
@@ -2675,9 +2699,6 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
 	case NL80211_CMD_UPDATE_OWE_INFO:
 		mlme_event_dh_event(drv, bss, tb);
 		break;
-	case NL80211_CMD_CONTROL_PORT_FRAME:
-		nl80211_control_port_frame(drv, tb);
-		break;
 	default:
 		wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
 			"(cmd=%d)", cmd);
@@ -2767,6 +2788,9 @@ int process_bss_event(struct nl_msg *msg, void *arg)
 	case NL80211_CMD_EXTERNAL_AUTH:
 		nl80211_external_auth(bss->drv, tb);
 		break;
+	case NL80211_CMD_CONTROL_PORT_FRAME:
+		nl80211_control_port_frame(bss->drv, tb);
+		break;
 	default:
 		wpa_printf(MSG_DEBUG, "nl80211: Ignored unknown event "
 			   "(cmd=%d)", gnlh->cmd);
-- 
2.17.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux