Skip to contentSkip to conversation

wifi: brcmfmac: leave the AP 4-way handshake to the host on Apple chips

PATCH Superseded Andre Eikmeyer 3 participants 5 messages Nov 4 – Nov 18 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: brcmfmac: leave the AP 4-way handshake to the host on Apple chips

The Apple firmware for the BCM4364 and BCM4377 lists "idauth" in its capabilities, so brcmfmac enables BRCMF_FEAT_FWAUTH and advertises NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK. hostapd and wpa_supplicant then pass the PSK to the driver and leave the AP side of the 4-way handshake to the firmware. On the BCM4364 that handshake never completes. The client associates, no EAPOL-Key frame is sent, and the firmware removes the station after about 8 s.

Measured on a MacBookPro15,1 (BCM4364/3, firmware 9.30.514.0.32.5.94, FWID 01-47278712) with a WPA2-PSK access point and a Samsung Galaxy S22 Ultra as client:

offload advertised: NEW_STATION, DEL_STATION 7.8 s later, no EAPOL offload not advertised: 4-way handshake by wpa_supplicant completes,
AP-STA-CONNECTED, DHCP lease, traffic flows

Clear BRCMF_FEAT_FWAUTH on the chips in Apple's T2 Macs, so the host runs the handshake.

---
The KaiT2en community runs this patch with its kernels, no regression was reported.

 .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +14 -0
index 488364e..05e9750 100644
@@ -318,6 +318,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
 					BIT(BRCMF_FEAT_WOWL_GTK);
 		}
 	}
+	/* The Apple firmware for these chips lists "idauth", but in AP mode
+	 * its authenticator never completes the 4-way handshake and the
+	 * station is dropped after about 8 s. Leave the handshake to the host.
+	 */
+	switch (drvr->bus_if->chip) {
+	case BRCM_CC_4355_CHIP_ID:
+	case BRCM_CC_4364_CHIP_ID:
+	case BRCM_CC_4377_CHIP_ID:
+		ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_FWAUTH);
+		break;
+	default:
+		break;
+	}
+
 	/* MBSS does not work for all chips */
 	switch (drvr->bus_if->chip) {
 	case BRCM_CC_4330_CHIP_ID:
Signature · 1 line
2.56.0
maintainer
#1 lore raw
Quoted 11 lines · Andre Eikmeyer

The Apple firmware for the BCM4364 and BCM4377 lists "idauth" in its capabilities, so brcmfmac enables BRCMF_FEAT_FWAUTH and advertises NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK. hostapd and wpa_supplicant then pass the PSK to the driver and leave the AP side of the 4-way handshake to the firmware. On the BCM4364 that handshake never completes.

[...]

Clear BRCMF_FEAT_FWAUTH on the chips in Apple's T2 Macs, so the host runs the handshake.

[...]

Quoted 14 lines
---
 .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +6 -0
@@ -318,6 +318,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
 					BIT(BRCMF_FEAT_WOWL_GTK);
 		}
 	}
+	/* The Apple firmware for these chips lists "idauth", but in AP mode
+	 * its authenticator never completes the 4-way handshake and the
+	 * station is dropped after about 8 s. Leave the handshake to the host.
+	 */
+	switch (drvr->bus_if->chip) {
+	case BRCM_CC_4355_CHIP_ID:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c void brcmf_feat_attach(struct brcmf_pub *drvr) · line 336

Quoted 10 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +8 -0
+	case BRCM_CC_4364_CHIP_ID:
+	case BRCM_CC_4377_CHIP_ID:
+		ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_FWAUTH);
+		break;
+	default:
+		break;
+	}
+
 	/* MBSS does not work for all chips */
 	switch (drvr->bus_if->chip) {

The commit message and the test report only cover BCM4364 and BCM4377, but the code also clears FWAUTH for BCM4355. Where does that come from? Was it tested, and is BCM4355 found in T2 Macs? If not, please drop it or justify it.

The chip ID check has the same problem as in the ARP/ND offload patch [1]:
the issue is described as specific to the Apple firmware, but the quirk applies to every BCM4355, BCM4364 and BCM4377, and those users would lose offloaded AP PSK. Please restrict it as suggested there.

Note that BRCMF_FEAT_FWAUTH is required for NL80211_EXT_FEATURE_SAE_OFFLOAD_AP in brcmf_setup_wiphy(). Please mention in the commit message whether that is affected on these chips (i.e. whether the firmware offers "sae" at all) or confirm it is intentionally dropped too.

Have you looked at the actual root cause (e.g. missing/incorrect "idauth" related iovars such as setting the PMK or wsec_info for AP on this firmware)? If the offload is never usable on these firmwares, say so in the commit message with reference to the firmware version(s) checked.

[...]

Minor: please add the target tree to the subject (wifibot series_format warning).

[1] https://lore.kernel.org/all/[email protected]/

Regards,
Arend

#2 lore raw
Quoted 40 lines · Arend van Spriel
Quoted 11 lines · Andre Eikmeyer

The Apple firmware for the BCM4364 and BCM4377 lists "idauth" in its capabilities, so brcmfmac enables BRCMF_FEAT_FWAUTH and advertises NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK. hostapd and wpa_supplicant then pass the PSK to the driver and leave the AP side of the 4-way handshake to the firmware. On the BCM4364 that handshake never completes.

[...]

Clear BRCMF_FEAT_FWAUTH on the chips in Apple's T2 Macs, so the host runs the handshake.

[...]

Quoted 21 lines

---
.../wireless/broadcom/brcm80211/brcmfmac/feature.c | 14 ++++++++++++++

1 file changed, 14 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +13 -0
@@ -318,6 +318,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
                   BIT(BRCMF_FEAT_WOWL_GTK);
       }
   }
+    /* The Apple firmware for these chips lists "idauth", but in AP mode
+     * its authenticator never completes the 4-way handshake and the
+     * station is dropped after about 8 s. Leave the handshake to the host.
+     */
+    switch (drvr->bus_if->chip) {
+    case BRCM_CC_4355_CHIP_ID:
+    case BRCM_CC_4364_CHIP_ID:
+    case BRCM_CC_4377_CHIP_ID:
+        ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_FWAUTH);
+        break;
+    default:
+        break;
+    }
Quoted 8 lines

drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c void brcmf_feat_attach(struct brcmf_pub *drvr) · line 336

Quoted 3 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +1 -0
+
   /* MBSS does not work for all chips */
   switch (drvr->bus_if->chip) {

The commit message and the test report only cover BCM4364 and BCM4377, but the code also clears FWAUTH for BCM4355. Where does that come from? Was it tested, and is BCM4355 found in T2 Macs? If not, please drop it or justify it.

4355 is also a Mac specific chip found in MacBookAir8,1 and 8,2. I'm actually surprised you forgot about that especially when there was a whole issue when Cypress named their chip firmware wrongly as 4355.

Quoted 26 lines

The chip ID check has the same problem as in the ARP/ND offload patch [1]:
the issue is described as specific to the Apple firmware, but the quirk applies to every BCM4355, BCM4364 and BCM4377, and those users would lose offloaded AP PSK. Please restrict it as suggested there.

Note that BRCMF_FEAT_FWAUTH is required for NL80211_EXT_FEATURE_SAE_OFFLOAD_AP in brcmf_setup_wiphy(). Please mention in the commit message whether that is affected on these chips (i.e. whether the firmware offers "sae" at all) or confirm it is intentionally dropped too.

Have you looked at the actual root cause (e.g. missing/incorrect "idauth" related iovars such as setting the PMK or wsec_info for AP on this firmware)? If the offload is never usable on these firmwares, say so in the commit message with reference to the firmware version(s) checked.

[...]

Minor: please add the target tree to the subject (wifibot series_format warning).

[1] https://lore.kernel.org/all/[email protected]/

Regards,
Arend

maintainer
#3 lore raw
Quoted 49 lines · Aditya Garg
Quoted 40 lines · Arend van Spriel
Quoted 11 lines · Andre Eikmeyer

The Apple firmware for the BCM4364 and BCM4377 lists "idauth" in its capabilities, so brcmfmac enables BRCMF_FEAT_FWAUTH and advertises NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK. hostapd and wpa_supplicant then pass the PSK to the driver and leave the AP side of the 4-way handshake to the firmware. On the BCM4364 that handshake never completes.

[...]

Clear BRCMF_FEAT_FWAUTH on the chips in Apple's T2 Macs, so the host runs the handshake.

[...]

Quoted 21 lines

---
.../wireless/broadcom/brcm80211/brcmfmac/feature.c | 14 ++++++++++++++

1 file changed, 14 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +13 -0
@@ -318,6 +318,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
                    BIT(BRCMF_FEAT_WOWL_GTK);
        }
    }
+    /* The Apple firmware for these chips lists "idauth", but in AP mode
+     * its authenticator never completes the 4-way handshake and the
+     * station is dropped after about 8 s. Leave the handshake to the host.
+     */
+    switch (drvr->bus_if->chip) {
+    case BRCM_CC_4355_CHIP_ID:
+    case BRCM_CC_4364_CHIP_ID:
+    case BRCM_CC_4377_CHIP_ID:
+        ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_FWAUTH);
+        break;
+    default:
+        break;
+    }
Quoted 8 lines

drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c void brcmf_feat_attach(struct brcmf_pub *drvr) · line 336

Quoted 3 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +1 -0
+
    /* MBSS does not work for all chips */
    switch (drvr->bus_if->chip) {

The commit message and the test report only cover BCM4364 and BCM4377, but the code also clears FWAUTH for BCM4355. Where does that come from? Was it tested, and is BCM4355 found in T2 Macs? If not, please drop it or justify it.

Quoted 1 line

4355 is also a Mac specific chip found in MacBookAir8,1 and 8,2. I'm actually surprised you forgot about that especially when there was a whole issue when Cypress named their chip firmware wrongly as 4355.

Getting older and a bit senile I guess :-p Still it pops up here in the patch without mentioning it in the commit message so my question still stands. Also are there any logs made while debugging this issue? Having firmware console logging enabled might be useful to get a clue what is holding the firmware from completing the handshake.

Regards,
Arend

#4 lore raw

PATCH v2 1/1 wifi: brcmfmac: leave the AP 4-way handshake to the host on Apple chips

In reply to Andre Eikmeyer

The Apple firmware for the BCM4364 and BCM4377 lists "idauth" in its capabilities, so brcmfmac enables BRCMF_FEAT_FWAUTH and advertises NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK and, with "sae", NL80211_EXT_FEATURE_SAE_OFFLOAD_AP. hostapd and wpa_supplicant then leave the AP side of the handshake to the firmware, which doesn't complete.

With a WPA2-PSK AP, brcmfmac sets the PMK in the firmware without error, the client associates, the firmware sends no EAPOL-Key frame and removes the station after about 8 s. Seen on the BCM4364 (MacBookPro15,1) and on the BCM4377 (MacBookAir9,1). With a WPA3-SAE AP and PMF required on the BCM4377, the client associates and is removed the same way without being authorized.

Clear BRCMF_FEAT_FWAUTH on these chips when the board type is Apple, so the host runs the handshake. A WPA2-PSK AP then works. This also drops SAE_OFFLOAD_AP, which is not usable on this firmware. A WPA3-SAE AP does not work without the offload either, the client does not associate.

---
Changes in v2:
- Restrict the quirk to Apple boards with settings->board_type
- Drop the BCM4355, due to lack of testers
- Test the BCM4377 as well with SAE_OFFLOAD_AP
- Target wireless-next
- v1: https://lore.kernel.org/all/[email protected]/

The T2 Linux community runs this patch with its kernels, no regression was reported.

 .../broadcom/brcm80211/brcmfmac/feature.c         | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +15 -0
index 27fa3a7941d9..54f61618b9a1 100644
@@ -423,6 +423,21 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
 					BIT(BRCMF_FEAT_WOWL_GTK);
 		}
 	}
+	/* The Apple firmware for these chips lists "idauth", but in AP mode
+	 * it never completes the 4-way handshake or SAE, and the station is
+	 * dropped. Leave the handshake to the host.
+	 */
+	if (drvr->settings->board_type &&
+	    strstarts(drvr->settings->board_type, "apple,")) {
+		switch (drvr->bus_if->chip) {
+		case BRCM_CC_4364_CHIP_ID:
+		case BRCM_CC_4377_CHIP_ID:
+			ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_FWAUTH);
+			break;
+		default:
+			break;
+		}
+	}
 	/* MBSS does not work for all chips */
 	switch (drvr->bus_if->chip) {
 	case BRCM_CC_4330_CHIP_ID:

base-commit: 5dbf2415ca9821a611d09308e3b29d2c37e7cd77

Signature · 1 line
2.56.0