Ver Fonte

qcacld-3.0: Send STA authorized status to supplicant for AP

Currently there is no support from driver to send STA authorized
event to supplicant.

Use QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES vendor command to
send STA authorized event to supplicant.

Change-Id: I46416949f04dd28a1713cbebf1f7d0e84b5efda2
CRs-Fixed: 2172816
Ashish Kumar Dhanotiya há 7 anos atrás
pai
commit
42b0378a80

+ 64 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -1485,6 +1485,10 @@ static const struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] =
 		.vendor_id = QCA_NL80211_VENDOR_ID,
 		.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN_EXT
 	},
+	[QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES_INDEX] = {
+		.vendor_id = QCA_NL80211_VENDOR_ID,
+		.subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES,
+	},
 #ifdef WLAN_UMAC_CONVERGENCE
 	COMMON_VENDOR_EVENTS
 #endif
@@ -13773,6 +13777,59 @@ static int wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
 }
 #endif /* KERNEL_VERSION(4, 12, 0) */
 
+QDF_STATUS wlan_hdd_send_sta_authorized_event(
+					struct hdd_adapter *adapter,
+					struct hdd_context *hdd_ctx,
+					const struct qdf_mac_addr *mac_addr)
+{
+	struct sk_buff *vendor_event;
+	QDF_STATUS status;
+	struct nl80211_sta_flag_update sta_flags;
+
+	hdd_enter();
+	if (!hdd_ctx) {
+		hdd_err("HDD context is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	vendor_event =
+		cfg80211_vendor_event_alloc(
+			hdd_ctx->wiphy, &adapter->wdev, sizeof(sta_flags) +
+			QDF_MAC_ADDR_SIZE + NLMSG_HDRLEN,
+			QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES_INDEX,
+			GFP_KERNEL);
+	if (!vendor_event) {
+		hdd_err("cfg80211_vendor_event_alloc failed");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	sta_flags.mask |= BIT(NL80211_STA_FLAG_AUTHORIZED);
+	sta_flags.set = true;
+
+	status = nla_put(vendor_event,
+			 QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_STA_FLAGS,
+			 sizeof(struct  nl80211_sta_flag_update),
+			 &sta_flags);
+	if (status) {
+		hdd_err("STA flag put fails");
+		kfree_skb(vendor_event);
+		return QDF_STATUS_E_FAILURE;
+	}
+	status = nla_put(vendor_event,
+			 QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_MAC_ADDR,
+			 QDF_MAC_ADDR_SIZE, mac_addr->bytes);
+	if (status) {
+		hdd_err("STA MAC put fails");
+		kfree_skb(vendor_event);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+
+	hdd_exit();
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * __wlan_hdd_change_station() - change station
  * @wiphy: Pointer to the wiphy structure
@@ -13849,6 +13906,13 @@ static int __wlan_hdd_change_station(struct wiphy *wiphy,
 				hdd_debug("Not able to change TL state to AUTHENTICATED");
 				return -EINVAL;
 			}
+			status = wlan_hdd_send_sta_authorized_event(
+								adapter,
+								hdd_ctx,
+								&STAMacAddress);
+			if (status != QDF_STATUS_SUCCESS) {
+				return -EINVAL;
+			}
 		}
 	} else if ((adapter->device_mode == QDF_STA_MODE) ||
 		   (adapter->device_mode == QDF_P2P_CLIENT_MODE)) {

+ 13 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -592,4 +592,17 @@ int wlan_hdd_send_mode_change_event(void);
 int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx,
 			      bool notify_sap_event);
 
+/*
+ * wlan_hdd_send_sta_authorized_event: Function to send station authorized
+ * event to user space in case of SAP
+ * @adapter: Pointer to the adapter
+ * @hdd_ctx: HDD Context
+ * @mac_addr: MAC address of the STA for whic the Authorized event needs to
+ * be sent
+ * This api is used to send station authorized event to user space
+ */
+QDF_STATUS wlan_hdd_send_sta_authorized_event(
+					struct hdd_adapter *adapter,
+					struct hdd_context *hdd_ctx,
+					const struct qdf_mac_addr *mac_addr);
 #endif

+ 4 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -2088,6 +2088,10 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 			hdd_softap_change_sta_state(adapter,
 						    &key_complete->peerMacAddr,
 						    OL_TXRX_PEER_STATE_AUTH);
+		status = wlan_hdd_send_sta_authorized_event(
+						adapter, hdd_ctx,
+						&key_complete->peerMacAddr);
+
 		}
 		return QDF_STATUS_SUCCESS;
 	case eSAP_STA_MIC_FAILURE_EVENT:

+ 4 - 0
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -1088,6 +1088,10 @@ QDF_STATUS hdd_softap_register_sta(struct hdd_adapter *adapter,
 						OL_TXRX_PEER_STATE_AUTH, false);
 
 		adapter->sta_info[sta_id].peer_state = OL_TXRX_PEER_STATE_AUTH;
+		if (!qdf_is_macaddr_broadcast(sta_mac))
+			qdf_status = wlan_hdd_send_sta_authorized_event(
+							adapter, hdd_ctx,
+							sta_mac);
 	} else {
 
 		hdd_info("ULA auth StaId= %d.  Changing TL state to CONNECTED at Join time",