ソースを参照

qcacmn: Add support to save gtk and set hlp data

Host add support to save gtk and set hlp data from fils ie of connect
response.

Change-Id: I5e6b9882359697f09a0935a9c07f3427dbe04cc2
CRs-Fixed: 2849123
Abhishek Ambure 4 年 前
コミット
4fb0c8fccb

+ 66 - 1
os_if/linux/mlme/inc/osif_cm_util.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2020-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -153,6 +153,36 @@ typedef QDF_STATUS
 				   struct wlan_cm_connect_resp *rsp,
 				   enum osif_cb_type type);
 
+#ifdef WLAN_FEATURE_FILS_SK
+/**
+ * typedef osif_cm_save_gtk_cb  - save gtk callback
+ * @vdev: vdev pointer
+ * @rsp: connect response
+ *
+ * this callback save gtk to the legacy module
+ *
+ * context: any context.
+ * return: qdf_status
+ */
+typedef QDF_STATUS (*osif_cm_save_gtk_cb)(struct wlan_objmgr_vdev *vdev,
+					  struct wlan_cm_connect_resp *rsp);
+
+/**
+ * typedef osif_cm_set_hlp_data_cb  - set hlp data for dhcp callback
+ * @dev: pointer to net device
+ * @vdev: vdev pointer
+ * @rsp: connect response
+ *
+ * this callback sets hlp data for dhcp to the legacy module
+ *
+ * context: any context.
+ * return: qdf_status
+ */
+typedef QDF_STATUS (*osif_cm_set_hlp_data_cb)(struct net_device *dev,
+					      struct wlan_objmgr_vdev *vdev,
+					      struct wlan_cm_connect_resp *rsp);
+#endif
+
 /**
  * typedef  osif_cm_disconnect_comp_cb: Disonnect complete callback
  * @vdev: vdev pointer
@@ -228,6 +258,10 @@ struct osif_cm_ops {
 #ifdef CONN_MGR_ADV_FEATURE
 	osif_cm_netif_queue_ctrl_cb netif_queue_control_cb;
 #endif
+#ifdef WLAN_FEATURE_FILS_SK
+	osif_cm_save_gtk_cb save_gtk_cb;
+	osif_cm_set_hlp_data_cb set_hlp_data_cb;
+#endif
 };
 
 /**
@@ -279,6 +313,37 @@ QDF_STATUS osif_cm_netif_queue_ind(struct wlan_objmgr_vdev *vdev,
 				   enum netif_action_type action,
 				   enum netif_reason_type reason);
 #endif
+
+#ifdef WLAN_FEATURE_FILS_SK
+/**
+ * osif_cm_save_gtk() - Function to save gtk in legacy module
+ * @vdev: vdev pointer
+ * @rsp: Pointer to connect response
+ *
+ * This function saves gtk in legacy module
+ *
+ * Context: Any context.
+ * Return: QDF_STATUS
+ */
+QDF_STATUS osif_cm_save_gtk(struct wlan_objmgr_vdev *vdev,
+			    struct wlan_cm_connect_resp *rsp);
+
+/**
+ * osif_cm_set_hlp_data() - Function to set hlp data for dhcp in legacy module
+ * @dev: Pointer to net device
+ * @vdev: vdev pointer
+ * @rsp: Pointer to connect response
+ *
+ * This function sets hlp data for dhcp in legacy module
+ *
+ * Context: Any context.
+ * Return: QDF_STATUS
+ */
+QDF_STATUS osif_cm_set_hlp_data(struct net_device *dev,
+				struct wlan_objmgr_vdev *vdev,
+				struct wlan_cm_connect_resp *rsp);
+#endif
+
 /**
  * osif_cm_set_legacy_cb() - Sets legacy callbacks to osif
  * @osif_legacy_ops:  Function pointer to legacy ops structure

+ 17 - 9
os_if/linux/mlme/src/osif_cm_connect_rsp.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2020-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -306,6 +306,7 @@ osif_get_statuscode(enum wlan_status_code status)
  * @dev: network device
  * @bss: bss info
  * @connect_rsp: Connection manager connect response
+ * @vdev: pointer to vdev
  *
  * This API is used as wrapper to send FILS key/sequence number
  * params etc. to supplicant in case of FILS connection
@@ -314,7 +315,8 @@ osif_get_statuscode(enum wlan_status_code status)
  * Return: None
  */
 static void osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss,
-			      struct wlan_cm_connect_resp *rsp)
+			      struct wlan_cm_connect_resp *rsp,
+			      struct wlan_objmgr_vdev *vdev)
 {
 	struct cfg80211_connect_resp_params conn_rsp_params;
 	enum ieee80211_statuscode status = WLAN_STATUS_SUCCESS;
@@ -343,16 +345,18 @@ static void osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss,
 		conn_rsp_params.bss = bss;
 		osif_populate_fils_params(&conn_rsp_params,
 					  rsp->connect_ies.fils_ie);
-		/* save GTK */
+		osif_cm_save_gtk(vdev, rsp);
 	}
 
 	cfg80211_connect_done(dev, &conn_rsp_params, GFP_KERNEL);
-	/* hlp data for DHCP */
+	if (rsp->connect_ies.fils_ie && rsp->connect_ies.fils_ie->hlp_data_len)
+		osif_cm_set_hlp_data(dev, vdev, rsp);
 }
 #else /* CFG80211_CONNECT_DONE */
 static inline void
 osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss,
-		  struct wlan_cm_connect_resp *rsp)
+		  struct wlan_cm_connect_resp *rsp,
+		  struct wlan_objmgr_vdev *vdev)
 { }
 #endif /* CFG80211_CONNECT_DONE */
 #endif /* WLAN_FEATURE_FILS_SK */
@@ -366,6 +370,7 @@ osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss,
  * @dev: network device
  * @bss: bss info
  * @connect_rsp: Connection manager connect response
+ * @vdev: pointer to vdev
  *
  * The API is a wrapper to send connection status to supplicant
  *
@@ -374,13 +379,14 @@ osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss,
  */
 static int osif_update_connect_results(struct net_device *dev,
 				       struct cfg80211_bss *bss,
-				       struct wlan_cm_connect_resp *rsp)
+				       struct wlan_cm_connect_resp *rsp,
+				       struct wlan_objmgr_vdev *vdev)
 {
 	if (!rsp->is_fils_connection) {
 		osif_debug("fils IE is NULL");
 		return -EINVAL;
 	}
-	osif_connect_done(dev, bss, rsp);
+	osif_connect_done(dev, bss, rsp, vdev);
 
 	return 0;
 }
@@ -388,7 +394,8 @@ static int osif_update_connect_results(struct net_device *dev,
 
 static inline int osif_update_connect_results(struct net_device *dev,
 					      struct cfg80211_bss *bss,
-					      struct wlan_cm_connect_resp *rsp)
+					      struct wlan_cm_connect_resp *rsp,
+					      struct wlan_objmgr_vdev *vdev)
 {
 	return -EINVAL;
 }
@@ -410,7 +417,8 @@ static void osif_indcate_connect_results(struct wlan_objmgr_vdev *vdev,
 					    rsp->ssid.length);
 	}
 
-	if (osif_update_connect_results(osif_priv->wdev->netdev, bss, rsp))
+	if (osif_update_connect_results(osif_priv->wdev->netdev, bss,
+					rsp, vdev))
 		osif_connect_bss(osif_priv->wdev->netdev, bss, rsp);
 }
 #else  /* CFG80211_CONNECT_BSS */

+ 32 - 1
os_if/linux/mlme/src/osif_cm_util.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2020-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -416,6 +416,37 @@ QDF_STATUS osif_cm_netif_queue_ind(struct wlan_objmgr_vdev *vdev,
 }
 #endif
 
+#ifdef WLAN_FEATURE_FILS_SK
+QDF_STATUS osif_cm_save_gtk(struct wlan_objmgr_vdev *vdev,
+			    struct wlan_cm_connect_resp *rsp)
+{
+	osif_cm_save_gtk_cb cb = NULL;
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (osif_cm_legacy_ops)
+		cb = osif_cm_legacy_ops->save_gtk_cb;
+	if (cb)
+		ret = cb(vdev, rsp);
+
+	return ret;
+}
+
+QDF_STATUS osif_cm_set_hlp_data(struct net_device *dev,
+				struct wlan_objmgr_vdev *vdev,
+				struct wlan_cm_connect_resp *rsp)
+{
+	osif_cm_set_hlp_data_cb cb = NULL;
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (osif_cm_legacy_ops)
+		cb = osif_cm_legacy_ops->set_hlp_data_cb;
+	if (cb)
+		ret = cb(dev, vdev, rsp);
+
+	return ret;
+}
+#endif
+
 void osif_cm_set_legacy_cb(struct osif_cm_ops *osif_legacy_ops)
 {
 	osif_cm_legacy_ops = osif_legacy_ops;

+ 28 - 20
umac/mlme/connection_mgr/core/src/wlan_cm_connect.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2020-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -559,23 +559,9 @@ static void cm_update_fils_scan_filter(struct scan_filter *filter,
 		     REALM_HASH_LEN);
 }
 
-static inline bool cm_is_fils_connection(struct cnx_mgr *cm_ctx,
-					 struct wlan_cm_connect_resp *resp)
+static inline bool cm_is_fils_connection(struct wlan_cm_connect_resp *resp)
 {
-	int32_t key_mgmt;
-
-	key_mgmt = wlan_crypto_get_param(cm_ctx->vdev,
-					 WLAN_CRYPTO_PARAM_KEY_MGMT);
-
-	if (!(key_mgmt & (1 << WLAN_CRYPTO_KEY_MGMT_FILS_SHA256 |
-			  1 << WLAN_CRYPTO_KEY_MGMT_FILS_SHA384 |
-			  1 << WLAN_CRYPTO_KEY_MGMT_FT_FILS_SHA256 |
-			  1 << WLAN_CRYPTO_KEY_MGMT_FT_FILS_SHA384)))
-		return false;
-
-	resp->is_fils_connection = true;
-
-	return true;
+	return resp->is_fils_connection;
 }
 
 static QDF_STATUS cm_set_fils_key(struct cnx_mgr *cm_ctx,
@@ -603,8 +589,7 @@ static inline void cm_update_fils_scan_filter(struct scan_filter *filter,
 					      struct cm_connect_req *cm_req)
 { }
 
-static inline bool cm_is_fils_connection(struct cnx_mgr *cm_ctx,
-					 struct wlan_cm_connect_resp *resp)
+static inline bool cm_is_fils_connection(struct wlan_cm_connect_resp *resp)
 {
 	return false;
 }
@@ -767,7 +752,7 @@ static void cm_set_fils_wep_key(struct cnx_mgr *cm_ctx,
 	struct qdf_mac_addr broadcast_mac = QDF_MAC_ADDR_BCAST_INIT;
 
 	/* Check and set FILS keys */
-	if (cm_is_fils_connection(cm_ctx, resp)) {
+	if (cm_is_fils_connection(resp)) {
 		cm_set_fils_key(cm_ctx, resp);
 		return;
 	}
@@ -1440,11 +1425,33 @@ static void cm_copy_fils_info(struct wlan_cm_vdev_connect_req *req,
 {
 	req->fils_info = &cm_req->connect_req.req.fils_info;
 }
+
+static inline void cm_set_fils_connection(struct cnx_mgr *cm_ctx,
+					  struct wlan_cm_connect_resp *resp)
+{
+	int32_t key_mgmt;
+
+	key_mgmt = wlan_crypto_get_param(cm_ctx->vdev,
+					 WLAN_CRYPTO_PARAM_KEY_MGMT);
+
+	if (!(key_mgmt & (1 << WLAN_CRYPTO_KEY_MGMT_FILS_SHA256 |
+			  1 << WLAN_CRYPTO_KEY_MGMT_FILS_SHA384 |
+			  1 << WLAN_CRYPTO_KEY_MGMT_FT_FILS_SHA256 |
+			  1 << WLAN_CRYPTO_KEY_MGMT_FT_FILS_SHA384)))
+		resp->is_fils_connection = false;
+	else
+		resp->is_fils_connection = true;
+}
 #else
 static inline void cm_copy_fils_info(struct wlan_cm_vdev_connect_req *req,
 				     struct cm_req *cm_req)
 {
 }
+
+static inline void cm_set_fils_connection(struct cnx_mgr *cm_ctx,
+					  struct wlan_cm_connect_resp *resp)
+{
+}
 #endif
 
 QDF_STATUS
@@ -1580,6 +1587,7 @@ QDF_STATUS cm_connect_complete(struct cnx_mgr *cm_ctx,
 		return QDF_STATUS_SUCCESS;
 
 	sm_state = cm_get_state(cm_ctx);
+	cm_set_fils_connection(cm_ctx, resp);
 	if (QDF_IS_STATUS_SUCCESS(resp->connect_status) &&
 	    sm_state == WLAN_CM_S_CONNECTED) {
 		cm_update_scan_db_on_connect_success(cm_ctx, resp);