Forráskód Böngészése

qcacld-3.0: Add check for mgmt/ctrl rx packets in pkt capture

Deliver management and control rx packets to monitor interface
only if corresponding filter is set by vendor command.

Change-Id: I9aeb8071cfc6207359f8d7ec74af2a21e2742d1e
CRs-Fixed: 3044857
Surabhi Vishnoi 3 éve
szülő
commit
aa11b6825c

+ 38 - 2
components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c

@@ -426,6 +426,7 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
 			    enum mgmt_frame_type frm_type)
 {
 	struct mon_rx_status txrx_status = {0};
+	struct pkt_capture_vdev_priv *vdev_priv;
 	struct ieee80211_frame *wh;
 	tpSirMacFrameCtl pfc;
 	qdf_nbuf_t nbuf;
@@ -433,11 +434,44 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
 	struct wlan_objmgr_vdev *vdev;
 	struct wlan_objmgr_pdev *pdev;
 
-	if (!(pkt_capture_get_pktcap_mode(psoc) & PKT_CAPTURE_MODE_MGMT_ONLY)) {
+	vdev = pkt_capture_get_vdev();
+	if (!vdev) {
+		pkt_capture_err("vdev is NULL");
 		qdf_nbuf_free(wbuf);
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	vdev_priv = pkt_capture_vdev_get_priv(vdev);
+	if (!vdev_priv) {
+		pkt_capture_err("packet capture vdev priv is NULL");
+		qdf_nbuf_free(wbuf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(wbuf));
+
+	if (pfc->type == SIR_MAC_CTRL_FRAME  &&
+	    !vdev_priv->frame_filter.ctrl_rx_frame_filter)
+		goto exit;
+
+	if (pfc->type == SIR_MAC_MGMT_FRAME  &&
+	    !vdev_priv->frame_filter.mgmt_rx_frame_filter)
+		goto exit;
+
+	if (pfc->type == SIR_MAC_MGMT_FRAME) {
+		if (pfc->subType == SIR_MAC_MGMT_BEACON) {
+			if (vdev_priv->frame_filter.mgmt_rx_frame_filter &
+			    PKT_CAPTURE_MGMT_CONNECT_NO_BEACON)
+				goto exit;
+		} else {
+			if (!((vdev_priv->frame_filter.mgmt_rx_frame_filter &
+			    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL) ||
+			    (vdev_priv->frame_filter.mgmt_rx_frame_filter &
+			    PKT_CAPTURE_MGMT_CONNECT_NO_BEACON)))
+				goto exit;
+		}
+	}
+
 	buf_len = qdf_nbuf_len(wbuf);
 	nbuf = qdf_nbuf_alloc(NULL, roundup(
 				  buf_len + RESERVE_BYTES, 4),
@@ -455,7 +489,6 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
 	pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf));
 	wh = (struct ieee80211_frame *)qdf_nbuf_data(nbuf);
 
-	vdev = pkt_capture_get_vdev();
 	pdev = wlan_vdev_get_pdev(vdev);
 
 	if ((pfc->type == IEEE80211_FC0_TYPE_MGT) &&
@@ -501,6 +534,9 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
 		qdf_nbuf_free(nbuf);
 
 	return QDF_STATUS_SUCCESS;
+exit:
+	qdf_nbuf_free(wbuf);
+	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS pkt_capture_mgmt_rx_ops(struct wlan_objmgr_psoc *psoc,