Răsfoiți Sursa

qcacld-3.0: Override EAPOL BC Tx frame with AP mac addr

Take care to update the EAPOL Tx frame DA with AP mac addr if
DA is broadcast address as EAPOL BC doesnot make sense.

Change-Id: Id58b7b7971f5a7c11de0b46c6189a6e6ad1917ab
CRs-Fixed: 2745826
Manjunathappa Prakash 4 ani în urmă
părinte
comite
5bf1513217
3 a modificat fișierele cu 41 adăugiri și 0 ștergeri
  1. 2 0
      Kbuild
  2. 2 0
      configs/default_defconfig
  3. 37 0
      core/hdd/src/wlan_hdd_tx_rx.c

+ 2 - 0
Kbuild

@@ -3564,6 +3564,8 @@ cppflags-$(CONFIG_RX_FISA) += -DWLAN_SUPPORT_RX_FISA
 
 cppflags-$(CONFIG_RX_DEFRAG_DO_NOT_REINJECT) += -DRX_DEFRAG_DO_NOT_REINJECT
 
+cppflags-$(CONFIG_HANDLE_BC_EAP_TX_FRM) += -DHANDLE_BROADCAST_EAPOL_TX_FRAME
+
 cppflags-$(CONFIG_MORE_TX_DESC) += -DTX_TO_NPEERS_INC_TX_DESCS
 
 ccflags-$(CONFIG_HASTINGS_BT_WAR) += -DHASTINGS_BT_WAR

+ 2 - 0
configs/default_defconfig

@@ -1118,6 +1118,8 @@ CONFIG_MORE_TX_DESC := y
 
 endif
 
+CONFIG_HANDLE_BC_EAP_TX_FRM := y
+
 ifeq ($(CONFIG_BAND_6GHZ), y)
 
 CONFIG_6G_SCAN_CHAN_SORT_ALGO := y

+ 37 - 0
core/hdd/src/wlan_hdd_tx_rx.c

@@ -923,6 +923,41 @@ void hdd_get_transmit_mac_addr(struct hdd_adapter *adapter, struct sk_buff *skb,
 	}
 }
 
+#ifdef HANDLE_BROADCAST_EAPOL_TX_FRAME
+/**
+ * wlan_hdd_fix_broadcast_eapol() - Fix broadcast eapol
+ * @adapter: pointer to adapter
+ * @skb: pointer to OS packet (sk_buff)
+ *
+ * Override DA of broadcast eapol with bssid addr.
+ *
+ * Return: None
+ */
+static void wlan_hdd_fix_broadcast_eapol(struct hdd_adapter *adapter,
+					 struct sk_buff *skb)
+{
+	struct ethhdr *eh = (struct ethhdr *)skb->data;
+	unsigned char *ap_mac_addr =
+		&adapter->session.station.conn_info.bssid.bytes[0];
+
+	if (qdf_unlikely((QDF_NBUF_CB_GET_PACKET_TYPE(skb) ==
+			  QDF_NBUF_CB_PACKET_TYPE_EAPOL) &&
+			 QDF_NBUF_CB_GET_IS_BCAST(skb))) {
+		hdd_debug("SA: "QDF_MAC_ADDR_STR " override DA: "QDF_MAC_ADDR_STR " with AP mac address "QDF_MAC_ADDR_STR,
+			  QDF_MAC_ADDR_ARRAY(&eh->h_source[0]),
+			  QDF_MAC_ADDR_ARRAY(&eh->h_dest[0]),
+			  QDF_MAC_ADDR_ARRAY(ap_mac_addr));
+
+		qdf_mem_copy(&eh->h_dest, ap_mac_addr, QDF_MAC_ADDR_SIZE);
+	}
+}
+#else
+static void wlan_hdd_fix_broadcast_eapol(struct hdd_adapter *adapter,
+					 struct sk_buff *skb)
+{
+}
+#endif /* HANDLE_BROADCAST_EAPOL_TX_FRAME */
+
 /**
  * __hdd_hard_start_xmit() - Transmit a frame
  * @skb: pointer to OS packet (sk_buff)
@@ -1181,6 +1216,8 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 		goto drop_pkt_and_release_skb;
 	}
 
+	wlan_hdd_fix_broadcast_eapol(adapter, skb);
+
 	if (adapter->tx_fn(soc, adapter->vdev_id, (qdf_nbuf_t)skb)) {
 		QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_INFO_HIGH,
 			  "%s: Failed to send packet to txrx for sta_id: "