Skip to contentSkip to conversation

wiphy: add wiphy_can_offload

PATCH In review James Prestwood 2 participants 3 messages Oct 19, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH v2 1/2 wiphy: add wiphy_can_offload

This is a convenience method for detecting any supported offload extended features (4way/1x/SAE).

---
 src/wiphy.c | 11 +++++++++++
 src/wiphy.h |  1 +
 2 files changed, 12 insertions(+)
src/wiphy.c +11 -0
index 1a333aad..4d740ba3 100644
@@ -459,6 +459,17 @@ bool wiphy_can_transition_disable(struct wiphy *wiphy)
 	return true;
 }
 
+/* Catch all for the offload features */
+bool wiphy_can_offload(struct wiphy *wiphy)
+{
+	return wiphy_has_ext_feature(wiphy,
+				NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK) ||
+				wiphy_has_ext_feature(wiphy,
+				NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X) ||
+				wiphy_has_ext_feature(wiphy,
+				NL80211_EXT_FEATURE_SAE_OFFLOAD);
+}
+
 bool wiphy_supports_ext_key_id(struct wiphy *wiphy)
 {
 	return wiphy_has_ext_feature(wiphy, NL80211_EXT_FEATURE_EXT_KEY_ID);
src/wiphy.h +1 -0
index f7b6e1c4..9f0d6d07 100644
@@ -83,6 +83,7 @@ uint32_t wiphy_get_supported_bands(struct wiphy *wiphy);
 const struct scan_freq_set *wiphy_get_supported_freqs(
 						const struct wiphy *wiphy);
 bool wiphy_can_transition_disable(struct wiphy *wiphy);
+bool wiphy_can_offload(struct wiphy *wiphy);
 bool wiphy_supports_cmds_auth_assoc(struct wiphy *wiphy);
 bool wiphy_can_randomize_mac_addr(struct wiphy *wiphy);
 bool wiphy_rrm_capable(struct wiphy *wiphy);
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v2 2/2 station: disable OCV if offloading is supported

It was seen during testing that several offload-capable cards were not including the OCI in the 4-way handshake. This made any OCV capable AP unconnectable.

To be safe disable OCV on any cards that support offloading.

---
 src/station.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
src/station.c +14 -1
index a972b4fa..7fca7108 100644
@@ -1087,7 +1087,20 @@ build_ie:
 					&disable_ocv))
 		disable_ocv = false;
 
-	info.ocvc = !disable_ocv && bss_info.ocvc && info.mfpc;
+	/*
+	 * Obviously do not enable OCV if explicitly disabled or no AP support.
+	 *
+	 * Not obviously hostapd rejects OCV support if MFPC is not enabled.
+	 * This is not really specified by the spec, but we have to work around
+	 * this limitation.
+	 *
+	 * Another limitation is full mac cards. With limited testing it was
+	 * seen that they do not include the OCI in the 4-way handshake yet
+	 * still advertise the capability. Because of this OCV is disabled if
+	 * any offload features are detected (since IWD prefers to use offload).
+	 */
+	info.ocvc = !disable_ocv && bss_info.ocvc && info.mfpc &&
+			!wiphy_can_offload(wiphy);;
 
 	/*
 	 * IEEE 802.11-2020 9.4.2.24.4 states extended key IDs can only be used
Signature · 1 line
2.31.1
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 7 lines · James Prestwood

This is a convenience method for detecting any supported offload extended features (4way/1x/SAE).

---
  src/wiphy.c | 11 +++++++++++
  src/wiphy.h |  1 +
  2 files changed, 12 insertions(+)

All applied, thanks.

Regards,
-Denis