[nl80211] Add support for 4-way handshake offloading to firmware in NL80211 driver

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

 



Hi all,

While using wpa_supplicant on a device (Raspberry Pi 3B+) with bcm43455c0 chipset and broadcom drivers, we noticed that wpa_supplicant would correctly connect to a WPA2-Enterprise network and do the 4-way handshake but it would immediately disconnect afterward.

After debugging the broadcom kernel driver, we noticed that wpa_supplicant is not sending the NL80211_ATTR_WANT_1X_4WAY_HS flag although the broadcom driver reports through NL80211 that it supports 4-way handshake offloading to firmware. This breaks some checks on the broadcom driver side as it is expected to have this flag set if the PMK is set into the driver.

I inlined below a simple patch to fix this. Let me know if this can be merged into the latest master.

Best regards,

Mathieu Monney

---

>From 8477d67439b2d5877f7f60b1d23ef982345df62e Mon Sep 17 00:00:00 2001
From: Mathieu Bastien Monney <mamonney@xxxxxxxxx>
Date: Tue, 25 Sep 2018 10:22:41 +0200
Subject: [PATCH] nl80211: Add proper flag for 4-way handshake offloading to
 firmware

Signed-off-by: Mathieu Bastien Monney <mamonney@xxxxxxxxx>
---
 src/drivers/driver_nl80211.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 39a02d3ee..4aff5feab 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2902,8 +2902,11 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss,
 #endif /* CONFIG_DRIVER_NL80211_QCA */

 	if (alg == WPA_ALG_PMK &&
-	    (drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE))
+		(drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE)) {
+		if(nla_put_flag(msg, NL80211_ATTR_WANT_1X_4WAY_HS))
+			return -1;
 		return nl80211_set_pmk(drv, key, key_len, addr);
+	}

 	if (alg == WPA_ALG_NONE) {
 		msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_DEL_KEY);
@@ -5406,11 +5409,15 @@ static int nl80211_connect_common(struct wpa_driver_nl80211_data *drv,
 	}

 	/* Add PSK in case of 4-way handshake offload */
-	if (params->psk &&
-	    (drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE)) {
-		wpa_hexdump_key(MSG_DEBUG, "  * PSK", params->psk, 32);
-		if (nla_put(msg, NL80211_ATTR_PMK, 32, params->psk))
+	if (drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE) {
+		/* Ask the driver we want offloading */
+		if(nla_put_flag(msg, NL80211_ATTR_WANT_1X_4WAY_HS))
 			return -1;
+		if (params->psk) {
+			wpa_hexdump_key(MSG_DEBUG, "  * PSK", params->psk, 32);
+			if (nla_put(msg, NL80211_ATTR_PMK, 32, params->psk))
+				return -1;
+		}
 	}

 	if (nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT))
--
2.15.2 (Apple Git-101.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