diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c index cb6679cf8f2c..961a4ae040a8 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c @@ -459,6 +459,51 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev, qdf_nbuf_free(wbuf); } +/** + * pkt_capture_is_beacon_forward_enable() - API to check whether particular + * beacon needs to be forwarded on mon interface based on vendor command + * @vdev: vdev object + * @wbuf: netbuf + * + * Return: bool + */ +static bool +pkt_capture_is_beacon_forward_enable(struct wlan_objmgr_vdev *vdev, + qdf_nbuf_t wbuf) +{ + struct pkt_capture_vdev_priv *vdev_priv; + struct qdf_mac_addr connected_bssid = {0}; + tpSirMacMgmtHdr mac_hdr; + bool my_beacon = false; + + vdev_priv = pkt_capture_vdev_get_priv(vdev); + if (!vdev_priv) { + pkt_capture_err("packet capture vdev priv is NULL"); + return false; + } + + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_CONNECT_NO_BEACON) + return false; + + mac_hdr = (tpSirMacMgmtHdr)(qdf_nbuf_data(wbuf)); + wlan_vdev_get_bss_peer_mac(vdev, &connected_bssid); + + if (qdf_is_macaddr_equal((struct qdf_mac_addr *)mac_hdr->bssId, + &connected_bssid)) + my_beacon = true; + + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_CONNECT_BEACON && !my_beacon) + return false; + + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_CONNECT_SCAN_BEACON && my_beacon) + return false; + + return true; +} + /** * process_pktcapture_mgmt_rx_data_cb() - process management rx packets * @rx_params: mgmt rx event params @@ -508,8 +553,7 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc, 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) + if (!pkt_capture_is_beacon_forward_enable(vdev, wbuf)) goto exit; } else { if (!((vdev_priv->frame_filter.mgmt_rx_frame_filter & diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h index 9b0c4bcc6900..3c1316af8957 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h @@ -51,9 +51,9 @@ enum pkt_capture_mode { enum pkt_capture_config { PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE = BIT(0), PACKET_CAPTURE_CONFIG_QOS_ENABLE = BIT(1), - PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE = BIT(2), - PACKET_CAPTURE_CONFIG_BEACON_ENABLE = BIT(3), - PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE = BIT(4), + PACKET_CAPTURE_CONFIG_BEACON_ENABLE = BIT(2), + PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE = BIT(3), + PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE = BIT(4), }; /**