Эх сурвалжийг харах

qcacld-3.0: Add control to ACL

Add peer to ACL to allow / deny the connectivity with SAP.

Change-Id: I847e307748bd803f544eda2f12de81b5f5ed5309
CRs-Fixed: 3075807
Rachit Kankane 3 жил өмнө
parent
commit
e6056d8b19

+ 35 - 0
core/hdd/src/wlan_hdd_son.c

@@ -1277,6 +1277,40 @@ static void hdd_son_deauth_sta(struct wlan_objmgr_vdev *vdev,
 		hdd_err("Error in deauthenticating peer");
 }
 
+static void hdd_son_modify_acl(struct wlan_objmgr_vdev *vdev,
+			       uint8_t *peer_mac,
+			       bool allow_auth)
+{
+	QDF_STATUS status;
+	struct hdd_adapter *adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
+
+	if (!adapter) {
+		hdd_err("null adapter");
+		return;
+	}
+	hdd_debug("Peer - " QDF_MAC_ADDR_FMT " Allow Auth - %u",
+		  QDF_MAC_ADDR_REF(peer_mac), allow_auth);
+	if (allow_auth) {
+		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+					    peer_mac,
+					    eSAP_BLACK_LIST,
+					    DELETE_STA_FROM_ACL);
+		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+					    peer_mac,
+					    eSAP_WHITE_LIST,
+					    ADD_STA_TO_ACL);
+	} else {
+		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+					    peer_mac,
+					    eSAP_WHITE_LIST,
+					    DELETE_STA_FROM_ACL);
+		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+					    peer_mac,
+					    eSAP_BLACK_LIST,
+					    ADD_STA_TO_ACL);
+	}
+}
+
 void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
 {
 	struct son_callbacks cb_obj = {0};
@@ -1301,6 +1335,7 @@ void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
 	cb_obj.os_if_set_chwidth = hdd_son_set_chwidth;
 	cb_obj.os_if_get_chwidth = hdd_son_get_chwidth;
 	cb_obj.os_if_deauth_sta = hdd_son_deauth_sta;
+	cb_obj.os_if_modify_acl = hdd_son_modify_acl;
 
 	os_if_son_register_hdd_callbacks(hdd_ctx->psoc, &cb_obj);
 }

+ 16 - 0
os_if/son/inc/os_if_son.h

@@ -54,6 +54,7 @@
  * @os_if_set_chwidth: set chan width
  * @os_if_get_chwidth: get chan width
  * @os_if_deauth_sta: Deauths the target peer
+ * @os_if_modify_acl: Add/Del target peer in ACL
  */
 struct son_callbacks {
 	uint32_t (*os_if_is_acs_in_progress)(struct wlan_objmgr_vdev *vdev);
@@ -95,6 +96,9 @@ struct son_callbacks {
 	void (*os_if_deauth_sta)(struct wlan_objmgr_vdev *vdev,
 				 uint8_t *peer_mac,
 				 bool ignore_frame);
+	void (*os_if_modify_acl)(struct wlan_objmgr_vdev *vdev,
+				 uint8_t *peer_mac,
+				 bool allow_auth);
 };
 
 /**
@@ -481,4 +485,16 @@ enum ieee80211_cwm_width os_if_son_get_chwidth(struct wlan_objmgr_vdev *vdev);
 void os_if_son_deauth_peer_sta(struct wlan_objmgr_vdev *vdev,
 			       uint8_t *peer_mac,
 			       bool ignore_frame);
+
+/**
+ * os_if_son_modify_acl - Updates ACL with given peer
+ * @vdev: vdev
+ * @peer_mac: Target peer MAC address
+ * @allow_auth: True to allow specified peer to connect
+ *
+ * Return: void
+ */
+void os_if_son_modify_acl(struct wlan_objmgr_vdev *vdev,
+			  uint8_t *peer_mac,
+			  bool allow_auth);
 #endif

+ 14 - 0
os_if/son/src/os_if_son.c

@@ -925,3 +925,17 @@ void os_if_son_deauth_peer_sta(struct wlan_objmgr_vdev *vdev,
 }
 
 qdf_export_symbol(os_if_son_deauth_peer_sta);
+
+void os_if_son_modify_acl(struct wlan_objmgr_vdev *vdev,
+			  uint8_t *peer_mac,
+			  bool allow_auth)
+{
+	if (!vdev || !peer_mac) {
+		osif_err("null vdev / peer_mac");
+		return;
+	}
+	if (g_son_os_if_cb.os_if_modify_acl)
+		g_son_os_if_cb.os_if_modify_acl(vdev, peer_mac, allow_auth);
+}
+
+qdf_export_symbol(os_if_son_modify_acl);