Explorar el Código

qcacld-3.0: Extract and cache PMKID from EXTERNAL_AUTH command

hostapd/wpa_supplicant sends PMKID in EXTERNAL_AUTH command.
Extract and cache the same.

Change-Id: If490c3fb7e0119910e73dffc8701434752aabd6c
CRs-Fixed: 2396367
Srinivas Dasari hace 6 años
padre
commit
29186ca799
Se han modificado 1 ficheros con 47 adiciones y 2 borrados
  1. 47 2
      core/hdd/src/wlan_hdd_cfg80211.c

+ 47 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -20835,13 +20835,55 @@ wlan_hdd_cfg80211_update_connect_params(struct wiphy *wiphy,
 
 #if defined(WLAN_FEATURE_SAE) && \
 	defined(CFG80211_EXTERNAL_AUTH_SUPPORT)
+#if defined(CFG80211_EXTERNAL_AUTH_AP_SUPPORT)
+/**
+ * wlan_hdd_extauth_cache_pmkid() - Extract and cache pmkid
+ * @adapter: hdd vdev/net_device context
+ * @mac_handle: Handle to the MAC
+ * @params: Pointer to external auth params.
+ *
+ * Extract the PMKID and BSS from external auth params and add to the
+ * PMKSA Cache in CSR.
+ */
+static void
+wlan_hdd_extauth_cache_pmkid(struct hdd_adapter *adapter,
+			     mac_handle_t mac_handle,
+			     struct cfg80211_external_auth_params *params)
+{
+	tPmkidCacheInfo pmk_cache;
+	QDF_STATUS result;
+	if (params->pmkid) {
+		qdf_mem_zero(&pmk_cache, sizeof(pmk_cache));
+		qdf_mem_copy(pmk_cache.BSSID.bytes, params->bssid,
+			     QDF_MAC_ADDR_SIZE);
+		qdf_mem_copy(pmk_cache.PMKID, params->pmkid,
+			     CSR_RSN_PMKID_SIZE);
+		result = sme_roam_set_pmkid_cache(mac_handle, adapter->vdev_id,
+						  &pmk_cache, 1, false);
+		if (!QDF_IS_STATUS_SUCCESS(result))
+			hdd_debug("external_auth: Failed to cache PMKID");
+	}
+}
+#else
+static void
+wlan_hdd_extauth_cache_pmkid(struct hdd_adapter *adapter,
+			     mac_handle_t mac_handle,
+			     struct cfg80211_external_auth_params *params)
+{}
+#endif
 /**
  * __wlan_hdd_cfg80211_external_auth() - Handle external auth
+ *
  * @wiphy: Pointer to wireless phy
  * @dev: net device
- * @params: Pointer to external auth params
- *
+ * @params: Pointer to external auth params.
  * Return: 0 on success, negative errno on failure
+ *
+ * Userspace sends status of the external authentication(e.g., SAE) with a peer.
+ * The message carries BSSID of the peer and auth status (WLAN_STATUS_SUCCESS/
+ * WLAN_STATUS_UNSPECIFIED_FAILURE) in params.
+ * Userspace may send PMKID in params, which can be used for
+ * further connections.
  */
 static int
 __wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy,
@@ -20870,6 +20912,9 @@ __wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy,
 		  params->status, QDF_MAC_ADDR_ARRAY(params->bssid));
 	mac_handle = hdd_ctx->mac_handle;
 	qdf_mem_copy(peer_mac_addr.bytes, params->bssid, QDF_MAC_ADDR_SIZE);
+
+	wlan_hdd_extauth_cache_pmkid(adapter, mac_handle, params);
+
 	sme_handle_sae_msg(mac_handle, adapter->vdev_id, params->status,
 			   peer_mac_addr);